From 77c3aab5b860a952e9d83db56aefe23ee04ccebc Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 12 Oct 2021 19:36:09 +0200 Subject: [PATCH] pkgs: use relative stockholm.lib --- krebs/5pkgs/default.nix | 3 +-- krebs/5pkgs/haskell/blessings.nix | 5 +++-- krebs/5pkgs/haskell/default.nix | 5 +++-- krebs/5pkgs/haskell/email-header.nix | 8 +++++--- krebs/5pkgs/override/default.nix | 1 - krebs/5pkgs/simple/bling/default.nix | 5 ++--- krebs/5pkgs/simple/cgit-clear-cache.nix | 6 ++---- krebs/5pkgs/simple/default.nix | 15 +++++++-------- krebs/5pkgs/simple/eximlog.nix | 4 ++-- krebs/5pkgs/simple/flameshot-once/default.nix | 4 ++-- krebs/5pkgs/simple/flameshot-once/profile.nix | 2 +- krebs/5pkgs/simple/fzfmenu/default.nix | 4 ++-- krebs/5pkgs/simple/git-hooks/default.nix | 4 ++-- krebs/5pkgs/simple/htgen-cyberlocker/default.nix | 5 +++-- krebs/5pkgs/simple/htgen-imgur/default.nix | 7 +++---- krebs/5pkgs/simple/logf/default.nix | 2 -- krebs/5pkgs/simple/netcup/default.nix | 5 +++-- krebs/5pkgs/simple/reaktor2-plugins.nix | 4 ++-- krebs/5pkgs/simple/urix.nix | 5 ++--- krebs/5pkgs/simple/withGetopt.nix | 4 ++-- krebs/5pkgs/test/default.nix | 2 -- 21 files changed, 47 insertions(+), 53 deletions(-) diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix index c077bf4d7..f302bb76b 100644 --- a/krebs/5pkgs/default.nix +++ b/krebs/5pkgs/default.nix @@ -1,5 +1,4 @@ -with import ; - +with import ../../lib; self: super: # Import files and subdirectories like they are overlays. diff --git a/krebs/5pkgs/haskell/blessings.nix b/krebs/5pkgs/haskell/blessings.nix index b0e81fdc1..00299ca68 100644 --- a/krebs/5pkgs/haskell/blessings.nix +++ b/krebs/5pkgs/haskell/blessings.nix @@ -1,6 +1,7 @@ -with import ; -{ mkDerivation, base, fetchgit, hspec, QuickCheck, stdenv, text }: let +{ mkDerivation, base, fetchgit, hspec, QuickCheck, stdenv, stockholm, text }: +with stockholm.lib; +let cfg = { "18.03" = { version = "1.1.0"; diff --git a/krebs/5pkgs/haskell/default.nix b/krebs/5pkgs/haskell/default.nix index e824699f9..98cbcb3b9 100644 --- a/krebs/5pkgs/haskell/default.nix +++ b/krebs/5pkgs/haskell/default.nix @@ -1,8 +1,9 @@ -with import ; +self: super: +with self.stockholm.lib; + let overrides = self: super: mapNixDir (path: self.callPackage path {}) ./.; in -self: super: { haskell = super.haskell // { packages = mapAttrs (name: value: diff --git a/krebs/5pkgs/haskell/email-header.nix b/krebs/5pkgs/haskell/email-header.nix index 94b33e28b..ccc32c09b 100644 --- a/krebs/5pkgs/haskell/email-header.nix +++ b/krebs/5pkgs/haskell/email-header.nix @@ -1,8 +1,10 @@ -with import ; { mkDerivation, attoparsec, base, base64-bytestring, bytestring , case-insensitive, containers, exceptions, fetchgit, QuickCheck -, stdenv, tasty, tasty-quickcheck, text, text-icu, time -}: let +, stdenv, stockholm, tasty, tasty-quickcheck, text, text-icu, time +}: +with stockholm.lib; + +let cfg = { "18.03" = { diff --git a/krebs/5pkgs/override/default.nix b/krebs/5pkgs/override/default.nix index c2149ae55..2291132ba 100644 --- a/krebs/5pkgs/override/default.nix +++ b/krebs/5pkgs/override/default.nix @@ -1,4 +1,3 @@ -with import ; self: super: { bitlbee-facebook = super.bitlbee-facebook.overrideAttrs (old: { diff --git a/krebs/5pkgs/simple/bling/default.nix b/krebs/5pkgs/simple/bling/default.nix index 8d6207f65..1c8610325 100644 --- a/krebs/5pkgs/simple/bling/default.nix +++ b/krebs/5pkgs/simple/bling/default.nix @@ -1,6 +1,5 @@ -{ imagemagick, runCommand, ... }: - -with import ; +{ imagemagick, runCommand, stockholm, ... }: +with stockholm.lib; let krebs-v2 = [ diff --git a/krebs/5pkgs/simple/cgit-clear-cache.nix b/krebs/5pkgs/simple/cgit-clear-cache.nix index 28402c39c..31a2eccb3 100644 --- a/krebs/5pkgs/simple/cgit-clear-cache.nix +++ b/krebs/5pkgs/simple/cgit-clear-cache.nix @@ -1,8 +1,6 @@ -with import ; - -{ cache-root ? "/tmp/cgit", findutils, writeDashBin }: +{ cache-root ? "/tmp/cgit", findutils, stockholm, writeDashBin }: writeDashBin "cgit-clear-cache" '' set -efu - ${findutils}/bin/find ${shell.escape cache-root} -type f -delete + ${findutils}/bin/find ${stockholm.lib.shell.escape cache-root} -type f -delete '' diff --git a/krebs/5pkgs/simple/default.nix b/krebs/5pkgs/simple/default.nix index 6ba4fec83..10458001e 100644 --- a/krebs/5pkgs/simple/default.nix +++ b/krebs/5pkgs/simple/default.nix @@ -1,18 +1,17 @@ -with import ; - self: super: let # This callPackage will try to detect obsolete overrides. + lib = import ../../../lib; callPackage = path: args: let override = self.callPackage path args; - upstream = optionalAttrs (override ? "name") - (super.${(parseDrvName override.name).name} or {}); + upstream = lib.optionalAttrs (override ? "name") + (super.${(lib.parseDrvName override.name).name} or {}); in if upstream ? "name" && override ? "name" && - compareVersions upstream.name override.name != -1 - then trace "Upstream `${upstream.name}' gets overridden by `${override.name}'." override + lib.compareVersions upstream.name override.name != -1 + then lib.trace "Upstream `${upstream.name}' gets overridden by `${override.name}'." override else override; in - - mapNixDir (path: callPackage path {}) ./. + { stockholm.lib = lib; } // + lib.mapNixDir (path: callPackage path {}) ./. diff --git a/krebs/5pkgs/simple/eximlog.nix b/krebs/5pkgs/simple/eximlog.nix index 2d64e13e9..9e5ae8d63 100644 --- a/krebs/5pkgs/simple/eximlog.nix +++ b/krebs/5pkgs/simple/eximlog.nix @@ -1,7 +1,7 @@ -{ jq, systemd, writeDashBin }: +{ jq, stockholm, systemd, writeDashBin }: let - lib = import ; + lib = stockholm.lib; user = "exim"; # TODO make this configurable in diff --git a/krebs/5pkgs/simple/flameshot-once/default.nix b/krebs/5pkgs/simple/flameshot-once/default.nix index 20c709fb5..0524c2cfa 100644 --- a/krebs/5pkgs/simple/flameshot-once/default.nix +++ b/krebs/5pkgs/simple/flameshot-once/default.nix @@ -1,5 +1,5 @@ -with import ; -{ pkgs, ... }@args: +{ pkgs, stockholm, ... }@args: +with stockholm.lib; let # config cannot be declared in the input attribute set because that would diff --git a/krebs/5pkgs/simple/flameshot-once/profile.nix b/krebs/5pkgs/simple/flameshot-once/profile.nix index 8aacbfa42..991b46118 100644 --- a/krebs/5pkgs/simple/flameshot-once/profile.nix +++ b/krebs/5pkgs/simple/flameshot-once/profile.nix @@ -1,5 +1,5 @@ -with import ; { config, pkgs }: +with pkgs.stockholm.lib; let # Refs https://github.com/lupoDharkael/flameshot/blob/master/src/widgets/capture/capturebutton.h diff --git a/krebs/5pkgs/simple/fzfmenu/default.nix b/krebs/5pkgs/simple/fzfmenu/default.nix index 537b90f42..f208f6a3e 100644 --- a/krebs/5pkgs/simple/fzfmenu/default.nix +++ b/krebs/5pkgs/simple/fzfmenu/default.nix @@ -1,5 +1,5 @@ -with import ; -{ pkgs, ... }@args: +{ pkgs, stockholm, ... }@args: +with stockholm.lib; let # config cannot be declared in the input attribute set because that would diff --git a/krebs/5pkgs/simple/git-hooks/default.nix b/krebs/5pkgs/simple/git-hooks/default.nix index acf34ad69..00a593be3 100644 --- a/krebs/5pkgs/simple/git-hooks/default.nix +++ b/krebs/5pkgs/simple/git-hooks/default.nix @@ -1,6 +1,6 @@ -{ pkgs, ... }: +{ pkgs, stockholm, ... }: -with import ; +with stockholm.lib; { # TODO irc-announce should return a derivation diff --git a/krebs/5pkgs/simple/htgen-cyberlocker/default.nix b/krebs/5pkgs/simple/htgen-cyberlocker/default.nix index 515ea3cf9..c7d7ebfd8 100644 --- a/krebs/5pkgs/simple/htgen-cyberlocker/default.nix +++ b/krebs/5pkgs/simple/htgen-cyberlocker/default.nix @@ -1,5 +1,6 @@ -with import ; -{ pkgs, stdenv }: +{ pkgs, stockholm, stdenv }: +with stockholm.lib; + stdenv.mkDerivation rec { pname = "htgen-cyberlocker"; version = "1.0.0"; diff --git a/krebs/5pkgs/simple/htgen-imgur/default.nix b/krebs/5pkgs/simple/htgen-imgur/default.nix index fe0b2ab04..f429ff7a6 100644 --- a/krebs/5pkgs/simple/htgen-imgur/default.nix +++ b/krebs/5pkgs/simple/htgen-imgur/default.nix @@ -1,5 +1,4 @@ -with import ; -{ attr, coreutils, exiv2, findutils, gnugrep, jq, nix, utillinux, stdenv }: +{ attr, coreutils, exiv2, findutils, gnugrep, jq, nix, stockholm, utillinux, stdenv }: stdenv.mkDerivation rec { pname = "htgen-imgur"; version = "1.0.0"; @@ -9,7 +8,7 @@ stdenv.mkDerivation rec { buildPhase = '' ( exec > htgen-imgur - echo PATH=${makeBinPath [ + echo PATH=${stockholm.lib.makeBinPath [ attr coreutils exiv2 @@ -18,7 +17,7 @@ stdenv.mkDerivation rec { jq nix utillinux ]} - echo STATEDIR=${shell.escape "\${STATEDIR-$HOME}"} + echo STATEDIR=${stockholm.lib.shell.escape "\${STATEDIR-$HOME}"} cat $src/htgen-imgur ) ''; diff --git a/krebs/5pkgs/simple/logf/default.nix b/krebs/5pkgs/simple/logf/default.nix index ac95acb33..36a7fed2f 100644 --- a/krebs/5pkgs/simple/logf/default.nix +++ b/krebs/5pkgs/simple/logf/default.nix @@ -1,7 +1,5 @@ { lib, pkgs, ... }: -with import ; - let default-host-colors = pkgs.writeJSON "logf.default-host-colors.json" { }; diff --git a/krebs/5pkgs/simple/netcup/default.nix b/krebs/5pkgs/simple/netcup/default.nix index d1f46299d..408672eff 100644 --- a/krebs/5pkgs/simple/netcup/default.nix +++ b/krebs/5pkgs/simple/netcup/default.nix @@ -1,5 +1,6 @@ -{ coreutils, curl, fetchgit, gawk, gnugrep, gnused, jq, stdenv, w3m, ... }: -with import ; +{ coreutils, curl, fetchgit, gawk, gnugrep, gnused, jq, stdenv, stockholm, w3m, ... }: +with stockholm.lib; + let readJSON = path: fromJSON (readFile path); sed.escape = replaceChars ["/"] ["\\/"]; # close enough diff --git a/krebs/5pkgs/simple/reaktor2-plugins.nix b/krebs/5pkgs/simple/reaktor2-plugins.nix index 4cd9e7d89..e23b14a23 100644 --- a/krebs/5pkgs/simple/reaktor2-plugins.nix +++ b/krebs/5pkgs/simple/reaktor2-plugins.nix @@ -1,5 +1,5 @@ -with import ; -{ lib, pkgs, ... }: +{ lib, pkgs, stockholm, ... }: +with stockholm.lib; rec { generators = { diff --git a/krebs/5pkgs/simple/urix.nix b/krebs/5pkgs/simple/urix.nix index c0db8c975..73ea3e665 100644 --- a/krebs/5pkgs/simple/urix.nix +++ b/krebs/5pkgs/simple/urix.nix @@ -1,5 +1,4 @@ -let lib = import ; in -{ pkgs }: +{ pkgs, stockholm }: # urix - URI eXtractor # Extract all the URIs from standard input and write them to standard output! @@ -10,6 +9,6 @@ pkgs.execBin "urix" { argv = [ "urix" "-Eo" - "\\b${lib.uri.posix-extended-regex}\\b" + "\\b${stockholm.lib.uri.posix-extended-regex}\\b" ]; } diff --git a/krebs/5pkgs/simple/withGetopt.nix b/krebs/5pkgs/simple/withGetopt.nix index d20802fb2..7f17a5934 100644 --- a/krebs/5pkgs/simple/withGetopt.nix +++ b/krebs/5pkgs/simple/withGetopt.nix @@ -1,5 +1,5 @@ -with import ; -{ coreutils, quote, utillinux, writeDash }: +{ coreutils, quote, stockholm, utillinux, writeDash }: +with stockholm.lib; opt-spec: cmd-spec: let diff --git a/krebs/5pkgs/test/default.nix b/krebs/5pkgs/test/default.nix index 5ee8f913b..713d4673c 100644 --- a/krebs/5pkgs/test/default.nix +++ b/krebs/5pkgs/test/default.nix @@ -1,5 +1,3 @@ -with import ; - self: super: {