From 87b5490592effcc91bab8e55a30a106401f7d1b7 Mon Sep 17 00:00:00 2001 From: Mikael Voss Date: Sat, 31 Aug 2024 17:31:01 +0200 Subject: [PATCH] lib/removePackages: Allow removal by package --- lib/packages.nix | 9 --------- lib/removePackages.nix | 8 ++++++++ overlay/no-x.nix | 6 +++--- 3 files changed, 11 insertions(+), 12 deletions(-) delete mode 100644 lib/packages.nix create mode 100644 lib/removePackages.nix diff --git a/lib/packages.nix b/lib/packages.nix deleted file mode 100644 index e13f9da..0000000 --- a/lib/packages.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ nixpkgs, ... }: - -let - inherit (builtins) elem filter; - inherit (nixpkgs.lib.strings) getName; -in { - remove = nameList: pkgList: - filter (pkg: !elem (getName pkg) nameList) pkgList; -} diff --git a/lib/removePackages.nix b/lib/removePackages.nix new file mode 100644 index 0000000..68f7351 --- /dev/null +++ b/lib/removePackages.nix @@ -0,0 +1,8 @@ +{ nixpkgs, ... }: + +let + inherit (builtins) elem filter; + inherit (nixpkgs.lib.strings) getName; +in pkgOrNameList: pkgList: + let nameList = map (pkg: getName pkg) pkgOrNameList; + in filter (pkg: !elem (getName pkg) nameList) pkgList diff --git a/overlay/no-x.nix b/overlay/no-x.nix index 69d6981..643ef93 100644 --- a/overlay/no-x.nix +++ b/overlay/no-x.nix @@ -5,7 +5,7 @@ let inherit (nixpkgs.lib.attrsets) genAttrs; inherit (nixpkgs.lib.lists) remove toList; inherit (nixpkgs.lib.strings) mesonBool mesonEnable; - inherit (self.lib) substituteFlags packages; + inherit (self.lib) substituteFlags removePackages; final' = final; prev' = prev; @@ -92,7 +92,7 @@ in genAttrs [ keepassxc = (prev.keepassxc.overrideAttrs (prevAttrs: { buildInputs = prevAttrs.buildInputs - |> packages.remove [ "kio" ]; + |> removePackages [ "kio" ]; })).override { withKeePassX11 = false; }; @@ -183,7 +183,7 @@ in genAttrs [ utsushi = prev.utsushi.overrideAttrs (prevAttrs: { buildInputs = prevAttrs.buildInputs or [ ] - |> packages.remove [ "gtkmm" ]; + |> removePackages [ "gtkmm" ]; configureFlags = prevAttrs.configureFlags or [ ] |> substituteFlags { "--with-gtkmm" = null; }; });