diff --git a/nixos/modules/config/i18n.nix b/nixos/modules/config/i18n.nix index 6d8a7289b238..196160ee481a 100644 --- a/nixos/modules/config/i18n.nix +++ b/nixos/modules/config/i18n.nix @@ -12,7 +12,7 @@ let ] ++ lib.pipe config.i18n.extraLocaleSettings [ # See description of extraLocaleSettings for why is this ignored here. - (lib.filterAttrs (n: v: n != "LANGUAGE")) + (x: lib.removeAttrs x [ "LANGUAGE" ]) (lib.mapAttrs (n: v: (sanitizeUTF8Capitalization v))) (lib.mapAttrsToList (LCRole: lang: lang + "/" + (config.i18n.localeCharsets.${LCRole} or "UTF-8"))) ] diff --git a/nixos/modules/services/hardware/thinkfan.nix b/nixos/modules/services/hardware/thinkfan.nix index d5d1f23f1d98..daf865252653 100644 --- a/nixos/modules/services/hardware/thinkfan.nix +++ b/nixos/modules/services/hardware/thinkfan.nix @@ -101,14 +101,12 @@ let # removes NixOS special and unused attributes sensorToConf = { type, query, ... }@args: - (lib.filterAttrs ( - k: v: - v != null - && !(lib.elem k [ + (lib.filterAttrs (k: v: v != null) ( + lib.removeAttrs args [ "type" "query" - ]) - ) args) + ] + )) // { "${type}" = query; }; diff --git a/nixos/modules/services/mail/public-inbox.nix b/nixos/modules/services/mail/public-inbox.nix index 0933d2dd535d..353db2e2207c 100644 --- a/nixos/modules/services/mail/public-inbox.nix +++ b/nixos/modules/services/mail/public-inbox.nix @@ -403,7 +403,7 @@ in } ]; services.public-inbox.settings = filterAttrsRecursive (n: v: v != null) { - publicinbox = mapAttrs (n: filterAttrs (n: v: n != "description")) cfg.inboxes; + publicinbox = mapAttrs (n: v: removeAttrs v [ "description" ]) cfg.inboxes; }; users = { users.public-inbox = { diff --git a/nixos/modules/services/monitoring/grafana.nix b/nixos/modules/services/monitoring/grafana.nix index 9aad9e21fa6e..46da20bec8ad 100644 --- a/nixos/modules/services/monitoring/grafana.nix +++ b/nixos/modules/services/monitoring/grafana.nix @@ -126,7 +126,7 @@ let ''; # Get a submodule without any embedded metadata: - _filter = x: filterAttrs (k: v: k != "_module") x; + _filter = x: removeAttrs x [ "_module" ]; # https://grafana.com/docs/grafana/latest/administration/provisioning/#datasources grafanaTypes.datasourceConfig = types.submodule { diff --git a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix index 7dc40293d464..61ca738fdd31 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/mail.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/mail.nix @@ -15,6 +15,7 @@ let nameValuePair toLower filterAttrs + removeAttrs escapeShellArg literalExpression mkIf @@ -41,7 +42,7 @@ let ) else nameValuePair (toLower name) value - ) (filterAttrs (n: _: !(n == "_module")) cfg.configuration) + ) (removeAttrs cfg.configuration [ "_module" ]) ) ); diff --git a/nixos/modules/services/security/authelia.nix b/nixos/modules/services/security/authelia.nix index 5dc438473a1d..059337e3a425 100644 --- a/nixos/modules/services/security/authelia.nix +++ b/nixos/modules/services/security/authelia.nix @@ -270,7 +270,7 @@ let lib.updateManyAttrsByPath [ { path = lib.init pathList; - update = old: lib.filterAttrs (n: v: n != (lib.last pathList)) old; + update = old: lib.removeAttrs old [ (lib.last pathList) ]; } ] set; in diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index c7e81bb44335..3c827c3d6627 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -592,7 +592,7 @@ in ''; enabledUpstreamSystemUnits = filter (n: !elem n cfg.suppressedSystemUnits) upstreamSystemUnits; - enabledUnits = filterAttrs (n: v: !elem n cfg.suppressedSystemUnits) cfg.units; + enabledUnits = removeAttrs cfg.units cfg.suppressedSystemUnits; in { diff --git a/pkgs/by-name/qu/quartus-prime-lite/quartus.nix b/pkgs/by-name/qu/quartus-prime-lite/quartus.nix index 2349d765b3cd..68121d1a14ce 100644 --- a/pkgs/by-name/qu/quartus-prime-lite/quartus.nix +++ b/pkgs/by-name/qu/quartus-prime-lite/quartus.nix @@ -35,9 +35,7 @@ let }) supportedDevices ); - unsupportedDeviceIds = lib.filterAttrs ( - name: value: !(lib.hasAttr name supportedDeviceIds) - ) deviceIds; + unsupportedDeviceIds = lib.removeAttrs deviceIds (lib.attrNames supportedDeviceIds); componentHashes = { "arria_lite" = "sha256-ASvi9YX15b4XXabGjkuR5wl9wDwCijl8s750XTR/4XU="; diff --git a/pkgs/development/python-modules/dramatiq-abort/default.nix b/pkgs/development/python-modules/dramatiq-abort/default.nix index b4130f701bfe..655d2da4ec0f 100644 --- a/pkgs/development/python-modules/dramatiq-abort/default.nix +++ b/pkgs/development/python-modules/dramatiq-abort/default.nix @@ -29,7 +29,7 @@ buildPythonPackage rec { ]; optional-dependencies = { - all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + all = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "all" ])); gevent = [ gevent ]; redis = [ redis ]; }; diff --git a/pkgs/development/python-modules/markdown2/default.nix b/pkgs/development/python-modules/markdown2/default.nix index d417fb25ca10..e4a6cfd497a0 100644 --- a/pkgs/development/python-modules/markdown2/default.nix +++ b/pkgs/development/python-modules/markdown2/default.nix @@ -34,7 +34,7 @@ buildPythonPackage rec { code_syntax_highlighting = [ pygments ]; wavedrom = [ wavedrom ]; latex = [ latex2mathml ]; - all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + all = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "all" ])); }; meta = { diff --git a/pkgs/development/python-modules/odc-loader/default.nix b/pkgs/development/python-modules/odc-loader/default.nix index e97bb7e87dc6..6fb6f3422ca8 100644 --- a/pkgs/development/python-modules/odc-loader/default.nix +++ b/pkgs/development/python-modules/odc-loader/default.nix @@ -50,7 +50,7 @@ buildPythonPackage rec { optional-dependencies = { botocore = [ botocore ]; zarr = [ zarr ]; - all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + all = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "all" ])); }; nativeCheckInputs = [ diff --git a/pkgs/development/python-modules/pettingzoo/default.nix b/pkgs/development/python-modules/pettingzoo/default.nix index 1409b29e3633..e8fa3a1ed962 100644 --- a/pkgs/development/python-modules/pettingzoo/default.nix +++ b/pkgs/development/python-modules/pettingzoo/default.nix @@ -53,7 +53,7 @@ buildPythonPackage rec { ]; optional-dependencies = { - all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + all = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "all" ])); atari = [ # multi-agent-ale-py pygame diff --git a/pkgs/development/python-modules/planetary-computer/default.nix b/pkgs/development/python-modules/planetary-computer/default.nix index 7014512b6e4c..7bc6d0d61641 100644 --- a/pkgs/development/python-modules/planetary-computer/default.nix +++ b/pkgs/development/python-modules/planetary-computer/default.nix @@ -55,7 +55,7 @@ buildPythonPackage rec { optional-dependencies = { adlfs = [ adlfs ]; azure = [ azure-storage-blob ]; - all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + all = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "all" ])); }; pythonImportsCheck = [ diff --git a/pkgs/development/python-modules/pulsar-client/default.nix b/pkgs/development/python-modules/pulsar-client/default.nix index 3c9b5303ad7d..2919a84f8e79 100644 --- a/pkgs/development/python-modules/pulsar-client/default.nix +++ b/pkgs/development/python-modules/pulsar-client/default.nix @@ -67,7 +67,7 @@ buildPythonPackage rec { ratelimit ]; avro = [ fastavro ]; - all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + all = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "all" ])); }; nativeCheckInputs = [ diff --git a/pkgs/development/python-modules/pyproject-parser/default.nix b/pkgs/development/python-modules/pyproject-parser/default.nix index f3108c431c3f..95a7a7e4c2c6 100644 --- a/pkgs/development/python-modules/pyproject-parser/default.nix +++ b/pkgs/development/python-modules/pyproject-parser/default.nix @@ -46,7 +46,7 @@ buildPythonPackage rec { ]; optional-dependencies = { - all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + all = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "all" ])); cli = [ click consolekit diff --git a/pkgs/development/python-modules/tianshou/default.nix b/pkgs/development/python-modules/tianshou/default.nix index 7cb9052c2d02..2012e3f360a9 100644 --- a/pkgs/development/python-modules/tianshou/default.nix +++ b/pkgs/development/python-modules/tianshou/default.nix @@ -92,7 +92,7 @@ buildPythonPackage rec { ]; optional-dependencies = { - all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + all = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "all" ])); argparse = [ docstring-parser diff --git a/pkgs/development/python-modules/whey/default.nix b/pkgs/development/python-modules/whey/default.nix index ace0f3fbad75..e07c68a3a423 100644 --- a/pkgs/development/python-modules/whey/default.nix +++ b/pkgs/development/python-modules/whey/default.nix @@ -55,7 +55,7 @@ buildPythonPackage rec { pythonImportsCheck = [ "whey" ]; optional-dependencies = { - all = lib.flatten (lib.attrValues (lib.filterAttrs (n: v: n != "all") optional-dependencies)); + all = lib.flatten (lib.attrValues (lib.removeAttrs optional-dependencies [ "all" ])); editable = [ editables ]; diff --git a/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix b/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix index 2beaa3ed8e45..600a1acd6de6 100644 --- a/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix +++ b/pkgs/development/tools/haskell/haskell-language-server/withWrapper.nix @@ -99,7 +99,7 @@ let let # only formatters that were not requested unwanted = lib.pipe knownFormatters [ - (lib.filterAttrs (fmt: _: !(lib.elem fmt supportedFormatters))) + (fmts: lib.removeAttrs fmts supportedFormatters) lib.attrsToList ]; # all flags to disable diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix index ddda525e70b0..6719de2e3468 100644 --- a/pkgs/os-specific/linux/kernel/patches.nix +++ b/pkgs/os-specific/linux/kernel/patches.nix @@ -57,7 +57,7 @@ in { name = lib.removeSuffix ".patch" src.name; - patch = fetchurl (lib.filterAttrs (k: v: k != "extra") src); + patch = fetchurl (lib.removeAttrs src [ "extra" ]); extra = src.extra; inherit version sha256; }; diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index f7c5262acc98..a63e0c9b074b 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -731,7 +731,10 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check (disallowedPackages prevStage) # Only cctools and ld64 are rebuilt from `bintoolsPackages` to avoid rebuilding their dependencies # again in this stage after building them in stage 1. - (lib.filterAttrs (name: _: name != "ld64" && name != "cctools") (bintoolsPackages prevStage)) + (lib.removeAttrs (bintoolsPackages prevStage) [ + "ld64" + "cctools" + ]) (llvmToolsDeps prevStage) (sdkPackages prevStage) (sdkPackagesNoCC prevStage)