lib/removePackages: Allow removal by package

This commit is contained in:
Mikael 2024-08-31 17:31:01 +02:00
parent 59a47afe61
commit 87b5490592
Signed by: mikael
SSH key fingerprint: SHA256:21QyD2Meiot7jOUVitIR5YkGB/XuXdCvLW1hE6dsri0
3 changed files with 11 additions and 12 deletions

View file

@ -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;
}

8
lib/removePackages.nix Normal file
View file

@ -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

View file

@ -5,7 +5,7 @@ let
inherit (nixpkgs.lib.attrsets) genAttrs; inherit (nixpkgs.lib.attrsets) genAttrs;
inherit (nixpkgs.lib.lists) remove toList; inherit (nixpkgs.lib.lists) remove toList;
inherit (nixpkgs.lib.strings) mesonBool mesonEnable; inherit (nixpkgs.lib.strings) mesonBool mesonEnable;
inherit (self.lib) substituteFlags packages; inherit (self.lib) substituteFlags removePackages;
final' = final; final' = final;
prev' = prev; prev' = prev;
@ -92,7 +92,7 @@ in genAttrs [
keepassxc = (prev.keepassxc.overrideAttrs (prevAttrs: { keepassxc = (prev.keepassxc.overrideAttrs (prevAttrs: {
buildInputs = prevAttrs.buildInputs buildInputs = prevAttrs.buildInputs
|> packages.remove [ "kio" ]; |> removePackages [ "kio" ];
})).override { })).override {
withKeePassX11 = false; withKeePassX11 = false;
}; };
@ -183,7 +183,7 @@ in genAttrs [
utsushi = prev.utsushi.overrideAttrs (prevAttrs: { utsushi = prev.utsushi.overrideAttrs (prevAttrs: {
buildInputs = prevAttrs.buildInputs or [ ] buildInputs = prevAttrs.buildInputs or [ ]
|> packages.remove [ "gtkmm" ]; |> removePackages [ "gtkmm" ];
configureFlags = prevAttrs.configureFlags or [ ] configureFlags = prevAttrs.configureFlags or [ ]
|> substituteFlags { "--with-gtkmm" = null; }; |> substituteFlags { "--with-gtkmm" = null; };
}); });