From d10e69c86bcd415f5c4347d3c6b981241e913465 Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sun, 5 Mar 2023 22:08:45 +0100 Subject: [PATCH] treewide: deprecate isNull https://nixos.org/manual/nix/stable/language/builtins.html#builtins-isNull --- lib/generators.nix | 2 +- maintainers/scripts/haskell/dependencies.nix | 2 +- nixos/modules/hardware/device-tree.nix | 8 ++++---- nixos/modules/security/doas.nix | 6 +++--- nixos/modules/security/pam.nix | 4 ++-- nixos/modules/services/cluster/kubernetes/pki.nix | 2 +- nixos/modules/services/hardware/undervolt.nix | 4 ++-- .../services/home-automation/home-assistant.nix | 2 +- nixos/modules/services/networking/multipath.nix | 8 ++++---- nixos/modules/services/networking/radicale.nix | 6 +++--- nixos/modules/services/system/self-deploy.nix | 2 +- nixos/modules/services/web-apps/dolibarr.nix | 2 +- nixos/modules/services/web-apps/writefreely.nix | 11 +++++------ .../editors/emacs/elisp-packages/libgenerated.nix | 14 +++++++------- pkgs/applications/science/logic/coq/default.nix | 2 +- .../virtualization/singularity/generic.nix | 6 +++--- pkgs/build-support/coq/default.nix | 2 +- pkgs/build-support/coq/meta-fetch/default.nix | 8 ++++---- pkgs/build-support/make-desktopitem/default.nix | 2 +- pkgs/data/themes/orchis-theme/default.nix | 2 +- .../nim-packages/build-nim-package/default.nix | 8 ++++---- pkgs/development/python-modules/mip/default.nix | 4 ++-- .../tools/build-managers/waf/default.nix | 2 +- .../poetry2nix/poetry2nix/overrides/default.nix | 2 +- pkgs/games/cataclysm-dda/pkgs/default.nix | 2 +- pkgs/games/curseofwar/default.nix | 2 +- pkgs/servers/nosql/arangodb/default.nix | 2 +- pkgs/stdenv/generic/make-derivation.nix | 2 +- pkgs/tools/misc/plfit/default.nix | 4 ++-- pkgs/tools/text/gawk/gawkextlib.nix | 2 +- 30 files changed, 62 insertions(+), 63 deletions(-) diff --git a/lib/generators.nix b/lib/generators.nix index 968331a0ebde..4357a0353398 100644 --- a/lib/generators.nix +++ b/lib/generators.nix @@ -422,7 +422,7 @@ ${expr "" v} (if v then "True" else "False") else if isFunction v then abort "generators.toDhall: cannot convert a function to Dhall" - else if isNull v then + else if v == null then abort "generators.toDhall: cannot convert a null to Dhall" else builtins.toJSON v; diff --git a/maintainers/scripts/haskell/dependencies.nix b/maintainers/scripts/haskell/dependencies.nix index f0620902c0ee..fd8338c0029a 100644 --- a/maintainers/scripts/haskell/dependencies.nix +++ b/maintainers/scripts/haskell/dependencies.nix @@ -3,7 +3,7 @@ let pkgs = import ../../.. {}; inherit (pkgs) lib; getDeps = _: pkg: { - deps = builtins.filter (x: !isNull x) (map (x: x.pname or null) (pkg.propagatedBuildInputs or [])); + deps = builtins.filter (x: x != null) (map (x: x.pname or null) (pkg.propagatedBuildInputs or [])); broken = (pkg.meta.hydraPlatforms or [null]) == []; }; in diff --git a/nixos/modules/hardware/device-tree.nix b/nixos/modules/hardware/device-tree.nix index 2807313a5a9c..c568f52ab677 100644 --- a/nixos/modules/hardware/device-tree.nix +++ b/nixos/modules/hardware/device-tree.nix @@ -65,7 +65,7 @@ let }; }; - filterDTBs = src: if isNull cfg.filter + filterDTBs = src: if cfg.filter == null then "${src}/dtbs" else pkgs.runCommand "dtbs-filtered" {} '' @@ -93,8 +93,8 @@ let # Fill in `dtboFile` for each overlay if not set already. # Existence of one of these is guarded by assertion below withDTBOs = xs: flip map xs (o: o // { dtboFile = - if isNull o.dtboFile then - if !isNull o.dtsFile then compileDTS o.name o.dtsFile + if o.dtboFile == null then + if o.dtsFile != null then compileDTS o.name o.dtsFile else compileDTS o.name (pkgs.writeText "dts" o.dtsText) else o.dtboFile; } ); @@ -181,7 +181,7 @@ in config = mkIf (cfg.enable) { assertions = let - invalidOverlay = o: isNull o.dtsFile && isNull o.dtsText && isNull o.dtboFile; + invalidOverlay = o: (o.dtsFile == null) && (o.dtsText == null) && (o.dtboFile == null); in lib.singleton { assertion = lib.all (o: !invalidOverlay o) cfg.overlays; message = '' diff --git a/nixos/modules/security/doas.nix b/nixos/modules/security/doas.nix index 4d15ed9a8025..be30a6b92e26 100644 --- a/nixos/modules/security/doas.nix +++ b/nixos/modules/security/doas.nix @@ -19,7 +19,7 @@ let ]; mkArgs = rule: - if (isNull rule.args) then "" + if (rule.args == null) then "" else if (length rule.args == 0) then "args" else "args ${concatStringsSep " " rule.args}"; @@ -27,9 +27,9 @@ let let opts = mkOpts rule; - as = optionalString (!isNull rule.runAs) "as ${rule.runAs}"; + as = optionalString (rule.runAs != null) "as ${rule.runAs}"; - cmd = optionalString (!isNull rule.cmd) "cmd ${rule.cmd}"; + cmd = optionalString (rule.cmd != null) "cmd ${rule.cmd}"; args = mkArgs rule; in diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix index 4224722f8792..9b00b91e1281 100644 --- a/nixos/modules/security/pam.nix +++ b/nixos/modules/security/pam.nix @@ -793,7 +793,7 @@ let }; })); - motd = if isNull config.users.motdFile + motd = if config.users.motdFile == null then pkgs.writeText "motd" config.users.motd else config.users.motdFile; @@ -1233,7 +1233,7 @@ in config = { assertions = [ { - assertion = isNull config.users.motd || isNull config.users.motdFile; + assertion = config.users.motd == null || config.users.motdFile == null; message = '' Only one of users.motd and users.motdFile can be set. ''; diff --git a/nixos/modules/services/cluster/kubernetes/pki.nix b/nixos/modules/services/cluster/kubernetes/pki.nix index 26fe0f5e9e09..38682701ea15 100644 --- a/nixos/modules/services/cluster/kubernetes/pki.nix +++ b/nixos/modules/services/cluster/kubernetes/pki.nix @@ -270,7 +270,7 @@ in ''; })]); - environment.etc.${cfg.etcClusterAdminKubeconfig}.source = mkIf (!isNull cfg.etcClusterAdminKubeconfig) + environment.etc.${cfg.etcClusterAdminKubeconfig}.source = mkIf (cfg.etcClusterAdminKubeconfig != null) clusterAdminKubeconfig; environment.systemPackages = mkIf (top.kubelet.enable || top.proxy.enable) [ diff --git a/nixos/modules/services/hardware/undervolt.nix b/nixos/modules/services/hardware/undervolt.nix index c49d944cdc18..944777475401 100644 --- a/nixos/modules/services/hardware/undervolt.nix +++ b/nixos/modules/services/hardware/undervolt.nix @@ -5,8 +5,8 @@ let cfg = config.services.undervolt; mkPLimit = limit: window: - if (isNull limit && isNull window) then null - else assert asserts.assertMsg (!isNull limit && !isNull window) "Both power limit and window must be set"; + if (limit == null && window == null) then null + else assert asserts.assertMsg (limit != null && window != null) "Both power limit and window must be set"; "${toString limit} ${toString window}"; cliArgs = lib.cli.toGNUCommandLine {} { inherit (cfg) diff --git a/nixos/modules/services/home-automation/home-assistant.nix b/nixos/modules/services/home-automation/home-assistant.nix index 6adc58ec58ec..cea8a2b14cc2 100644 --- a/nixos/modules/services/home-automation/home-assistant.nix +++ b/nixos/modules/services/home-automation/home-assistant.nix @@ -362,7 +362,7 @@ in { config = mkIf cfg.enable { assertions = [ { - assertion = cfg.openFirewall -> !isNull cfg.config; + assertion = cfg.openFirewall -> cfg.config != null; message = "openFirewall can only be used with a declarative config"; } ]; diff --git a/nixos/modules/services/networking/multipath.nix b/nixos/modules/services/networking/multipath.nix index b20ec76ddf59..bd403e109c2a 100644 --- a/nixos/modules/services/networking/multipath.nix +++ b/nixos/modules/services/networking/multipath.nix @@ -513,22 +513,22 @@ in { ${indentLines 2 devices} } - ${optionalString (!isNull defaults) '' + ${optionalString (defaults != null) '' defaults { ${indentLines 2 defaults} } ''} - ${optionalString (!isNull blacklist) '' + ${optionalString (blacklist != null) '' blacklist { ${indentLines 2 blacklist} } ''} - ${optionalString (!isNull blacklist_exceptions) '' + ${optionalString (blacklist_exceptions != null) '' blacklist_exceptions { ${indentLines 2 blacklist_exceptions} } ''} - ${optionalString (!isNull overrides) '' + ${optionalString (overrides != null) '' overrides { ${indentLines 2 overrides} } diff --git a/nixos/modules/services/networking/radicale.nix b/nixos/modules/services/networking/radicale.nix index 8e4789c7ca59..00dbd6bbe386 100644 --- a/nixos/modules/services/networking/radicale.nix +++ b/nixos/modules/services/networking/radicale.nix @@ -9,7 +9,7 @@ let listToValue = concatMapStringsSep ", " (generators.mkValueStringDefault { }); }; - pkg = if isNull cfg.package then + pkg = if cfg.package == null then pkgs.radicale else cfg.package; @@ -117,13 +117,13 @@ in { } ]; - warnings = optional (isNull cfg.package && versionOlder config.system.stateVersion "17.09") '' + warnings = optional (cfg.package == null && versionOlder config.system.stateVersion "17.09") '' The configuration and storage formats of your existing Radicale installation might be incompatible with the newest version. For upgrade instructions see https://radicale.org/2.1.html#documentation/migration-from-1xx-to-2xx. Set services.radicale.package to suppress this warning. - '' ++ optional (isNull cfg.package && versionOlder config.system.stateVersion "20.09") '' + '' ++ optional (cfg.package == null && versionOlder config.system.stateVersion "20.09") '' The configuration format of your existing Radicale installation might be incompatible with the newest version. For upgrade instructions see https://github.com/Kozea/Radicale/blob/3.0.6/NEWS.md#upgrade-checklist. diff --git a/nixos/modules/services/system/self-deploy.nix b/nixos/modules/services/system/self-deploy.nix index 16a793a42253..5f9ee06124cb 100644 --- a/nixos/modules/services/system/self-deploy.nix +++ b/nixos/modules/services/system/self-deploy.nix @@ -132,7 +132,7 @@ in requires = lib.mkIf (!(isPathType cfg.repository)) [ "network-online.target" ]; - environment.GIT_SSH_COMMAND = lib.mkIf (!(isNull cfg.sshKeyFile)) + environment.GIT_SSH_COMMAND = lib.mkIf (cfg.sshKeyFile != null) "${pkgs.openssh}/bin/ssh -i ${lib.escapeShellArg cfg.sshKeyFile}"; restartIfChanged = false; diff --git a/nixos/modules/services/web-apps/dolibarr.nix b/nixos/modules/services/web-apps/dolibarr.nix index f262099354d2..473ec7b1d4b0 100644 --- a/nixos/modules/services/web-apps/dolibarr.nix +++ b/nixos/modules/services/web-apps/dolibarr.nix @@ -16,7 +16,7 @@ let if (any (str: k == str) secretKeys) then v else if isString v then "'${v}'" else if isBool v then boolToString v - else if isNull v then "null" + else if v == null then "null" else toString v ; in diff --git a/nixos/modules/services/web-apps/writefreely.nix b/nixos/modules/services/web-apps/writefreely.nix index dec00b46f335..a7671aa717f4 100644 --- a/nixos/modules/services/web-apps/writefreely.nix +++ b/nixos/modules/services/web-apps/writefreely.nix @@ -10,12 +10,11 @@ let format = pkgs.formats.ini { mkKeyValue = key: value: let - value' = if builtins.isNull value then - "" - else if builtins.isBool value then - if value == true then "true" else "false" - else - toString value; + value' = lib.optionalString (value != null) + (if builtins.isBool value then + if value == true then "true" else "false" + else + toString value); in "${key} = ${value'}"; }; diff --git a/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix b/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix index f45aadfa67b4..36576f7c1239 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/libgenerated.nix @@ -73,28 +73,28 @@ in { error = sourceArgs.error or args.error or null; hasSource = lib.hasAttr variant args; pname = builtins.replaceStrings [ "@" ] [ "at" ] ename; - broken = ! isNull error; + broken = error != null; in if hasSource then lib.nameValuePair ename ( self.callPackage ({ melpaBuild, fetchurl, ... }@pkgargs: melpaBuild { inherit pname ename commit; - version = if isNull version then "" else - lib.concatStringsSep "." (map toString + version = lib.optionalString (version != null) + (lib.concatStringsSep "." (map toString # Hack: Melpa archives contains versions with parse errors such as [ 4 4 -4 413 ] which should be 4.4-413 # This filter method is still technically wrong, but it's computationally cheap enough and tapers over the issue - (builtins.filter (n: n >= 0) version)); + (builtins.filter (n: n >= 0) version))); # TODO: Broken should not result in src being null (hack to avoid eval errors) - src = if (isNull sha256 || broken) then null else + src = if (sha256 == null || broken) then null else lib.getAttr fetcher (fetcherGenerators args sourceArgs); - recipe = if isNull commit then null else + recipe = if commit == null then null else fetchurl { name = pname + "-recipe"; url = "https://raw.githubusercontent.com/melpa/melpa/${commit}/recipes/${ename}"; inherit sha256; }; - packageRequires = lib.optionals (! isNull deps) + packageRequires = lib.optionals (deps != null) (map (dep: pkgargs.${dep} or self.${dep} or null) deps); meta = (sourceArgs.meta or {}) // { diff --git a/pkgs/applications/science/logic/coq/default.nix b/pkgs/applications/science/logic/coq/default.nix index 49c9fc47fef2..3740d4e39268 100644 --- a/pkgs/applications/science/logic/coq/default.nix +++ b/pkgs/applications/science/logic/coq/default.nix @@ -70,7 +70,7 @@ let substituteInPlace plugins/micromega/sos.ml --replace "; csdp" "; ${csdp}/bin/csdp" substituteInPlace plugins/micromega/coq_micromega.ml --replace "System.is_in_system_path \"csdp\"" "true" ''; - ocamlPackages = if !isNull customOCamlPackages then customOCamlPackages + ocamlPackages = if customOCamlPackages != null then customOCamlPackages else with versions; switch coq-version [ { case = range "8.16" "8.17"; out = ocamlPackages_4_14; } { case = range "8.14" "8.15"; out = ocamlPackages_4_12; } diff --git a/pkgs/applications/virtualization/singularity/generic.nix b/pkgs/applications/virtualization/singularity/generic.nix index f20735e45e3d..5312dbdda0ff 100644 --- a/pkgs/applications/virtualization/singularity/generic.nix +++ b/pkgs/applications/virtualization/singularity/generic.nix @@ -76,7 +76,7 @@ in let defaultPathOriginal = "/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin"; - privileged-un-utils = if ((isNull newuidmapPath) && (isNull newgidmapPath)) then null else + privileged-un-utils = if ((newuidmapPath == null) && (newgidmapPath == null)) then null else (runCommandLocal "privileged-un-utils" { } '' mkdir -p "$out/bin" ln -s ${lib.escapeShellArg newuidmapPath} "$out/bin/newuidmap" @@ -212,10 +212,10 @@ buildGoModule { rm "$file" done ''} - ${lib.optionalString enableSuid (lib.warnIf (isNull starterSuidPath) "${projectName}: Null starterSuidPath when enableSuid produces non-SUID-ed starter-suid and run-time permission denial." '' + ${lib.optionalString enableSuid (lib.warnIf (starterSuidPath == null) "${projectName}: Null starterSuidPath when enableSuid produces non-SUID-ed starter-suid and run-time permission denial." '' chmod +x $out/libexec/${projectName}/bin/starter-suid '')} - ${lib.optionalString (enableSuid && !isNull starterSuidPath) '' + ${lib.optionalString (enableSuid && (starterSuidPath != null)) '' mv "$out"/libexec/${projectName}/bin/starter-suid{,.orig} ln -s ${lib.escapeShellArg starterSuidPath} "$out/libexec/${projectName}/bin/starter-suid" ''} diff --git a/pkgs/build-support/coq/default.nix b/pkgs/build-support/coq/default.nix index e26504a66f10..eb045ddf6865 100644 --- a/pkgs/build-support/coq/default.nix +++ b/pkgs/build-support/coq/default.nix @@ -52,7 +52,7 @@ let inherit release releaseRev; location = { inherit domain owner repo; }; } // optionalAttrs (args?fetcher) {inherit fetcher;}); - fetched = fetch (if !isNull version then version else defaultVersion); + fetched = fetch (if version != null then version else defaultVersion); display-pkg = n: sep: v: let d = displayVersion.${n} or (if sep == "" then ".." else true); in n + optionalString (v != "" && v != null) (switch d [ diff --git a/pkgs/build-support/coq/meta-fetch/default.nix b/pkgs/build-support/coq/meta-fetch/default.nix index d5fe31c6ccf7..82c29fb760b7 100644 --- a/pkgs/build-support/coq/meta-fetch/default.nix +++ b/pkgs/build-support/coq/meta-fetch/default.nix @@ -8,13 +8,13 @@ let fmt = if args?sha256 then "zip" else "tarball"; pr = match "^#(.*)$" rev; url = switch-if [ - { cond = isNull pr && !isNull (match "^github.*" domain); + { cond = pr == null && (match "^github.*" domain) != null; out = "https://${domain}/${owner}/${repo}/archive/${rev}.${ext}"; } - { cond = !isNull pr && !isNull (match "^github.*" domain); + { cond = pr != null && (match "^github.*" domain) != null; out = "https://api.${domain}/repos/${owner}/${repo}/${fmt}/pull/${head pr}/head"; } - { cond = isNull pr && !isNull (match "^gitlab.*" domain); + { cond = pr == null && (match "^gitlab.*" domain) != null; out = "https://${domain}/${owner}/${repo}/-/archive/${rev}/${repo}-${rev}.${ext}"; } - { cond = !isNull (match "(www.)?mpi-sws.org" domain); + { cond = (match "(www.)?mpi-sws.org" domain) != null; out = "https://www.mpi-sws.org/~${owner}/${repo}/download/${repo}-${rev}.${ext}";} ] (throw "meta-fetch: no fetcher found for domain ${domain} on ${rev}"); fetch = x: if args?sha256 then fetchzip (x // { inherit sha256; }) else fetchTarball x; diff --git a/pkgs/build-support/make-desktopitem/default.nix b/pkgs/build-support/make-desktopitem/default.nix index af314aa338c8..ccceb23256b6 100644 --- a/pkgs/build-support/make-desktopitem/default.nix +++ b/pkgs/build-support/make-desktopitem/default.nix @@ -89,7 +89,7 @@ let renderSection = sectionName: attrs: lib.pipe attrs [ (lib.mapAttrsToList renderLine) - (builtins.filter (v: !isNull v)) + (builtins.filter (v: v != null)) (builtins.concatStringsSep "\n") (section: '' [${sectionName}] diff --git a/pkgs/data/themes/orchis-theme/default.nix b/pkgs/data/themes/orchis-theme/default.nix index 840072295aa7..c536b7c53624 100644 --- a/pkgs/data/themes/orchis-theme/default.nix +++ b/pkgs/data/themes/orchis-theme/default.nix @@ -45,7 +45,7 @@ rec { runHook preInstall bash install.sh -d $out/share/themes -t all \ ${lib.optionalString (tweaks != []) "--tweaks " + builtins.toString tweaks} \ - ${lib.optionalString (!isNull border-radius) ("--round " + builtins.toString border-radius + "px")} + ${lib.optionalString (border-radius != null) ("--round " + builtins.toString border-radius + "px")} ${lib.optionalString withWallpapers '' mkdir -p $out/share/backgrounds cp src/wallpaper/{1080p,2k,4k}.jpg $out/share/backgrounds diff --git a/pkgs/development/nim-packages/build-nim-package/default.nix b/pkgs/development/nim-packages/build-nim-package/default.nix index 5ad181252df4..5c64b7b745c2 100644 --- a/pkgs/development/nim-packages/build-nim-package/default.nix +++ b/pkgs/development/nim-packages/build-nim-package/default.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation (attrs // { depsBuildBuild = [ nim_builder ] ++ depsBuildBuild; nativeBuildInputs = [ nim ] ++ nativeBuildInputs; - configurePhase = if isNull configurePhase then '' + configurePhase = if (configurePhase == null) then '' runHook preConfigure export NIX_NIM_BUILD_INPUTS=''${pkgsHostTarget[@]} $NIX_NIM_BUILD_INPUTS nim_builder --phase:configure @@ -17,21 +17,21 @@ stdenv.mkDerivation (attrs // { '' else configurePhase; - buildPhase = if isNull buildPhase then '' + buildPhase = if (buildPhase == null) then '' runHook preBuild nim_builder --phase:build runHook postBuild '' else buildPhase; - checkPhase = if isNull checkPhase then '' + checkPhase = if (checkPhase == null) then '' runHook preCheck nim_builder --phase:check runHook postCheck '' else checkPhase; - installPhase = if isNull installPhase then '' + installPhase = if (installPhase == null) then '' runHook preInstall nim_builder --phase:install runHook postInstall diff --git a/pkgs/development/python-modules/mip/default.nix b/pkgs/development/python-modules/mip/default.nix index 1011677338bf..e2896bf374a2 100644 --- a/pkgs/development/python-modules/mip/default.nix +++ b/pkgs/development/python-modules/mip/default.nix @@ -35,7 +35,7 @@ buildPythonPackage rec { cffi ] ++ lib.optionals gurobiSupport ([ gurobipy - ] ++ lib.optional (builtins.isNull gurobiHome) gurobi); + ] ++ lib.optional (gurobiHome == null) gurobi); # Source files have CRLF terminators, which make patch error out when supplied # with diffs made on *nix machines @@ -58,7 +58,7 @@ buildPythonPackage rec { # Make MIP use the Gurobi solver, if configured to do so makeWrapperArgs = lib.optional gurobiSupport - "--set GUROBI_HOME ${if builtins.isNull gurobiHome then gurobi.outPath else gurobiHome}"; + "--set GUROBI_HOME ${if gurobiHome == null then gurobi.outPath else gurobiHome}"; # Tests that rely on Gurobi are activated only when Gurobi support is enabled disabledTests = lib.optional (!gurobiSupport) "gurobi"; diff --git a/pkgs/development/tools/build-managers/waf/default.nix b/pkgs/development/tools/build-managers/waf/default.nix index 4e42927d0293..218783fd4926 100644 --- a/pkgs/development/tools/build-managers/waf/default.nix +++ b/pkgs/development/tools/build-managers/waf/default.nix @@ -4,7 +4,7 @@ }: let wafToolsArg = with lib.strings; - optionalString (!isNull withTools) " --tools=\"${concatStringsSep "," withTools}\""; + optionalString (withTools != null) " --tools=\"${concatStringsSep "," withTools}\""; in stdenv.mkDerivation rec { pname = "waf"; diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix b/pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix index a5bb46309f4c..cb5bda0bba76 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/overrides/default.nix @@ -50,7 +50,7 @@ let { nativeBuildInputs = (old.nativeBuildInputs or [ ]) - ++ lib.optionals (!(builtins.isNull buildSystem)) [ buildSystem ] + ++ lib.optionals (buildSystem != null) [ buildSystem ] ++ map (a: self.${a}) extraAttrs; } ) diff --git a/pkgs/games/cataclysm-dda/pkgs/default.nix b/pkgs/games/cataclysm-dda/pkgs/default.nix index 39abad809c5b..72b2c814389a 100644 --- a/pkgs/games/cataclysm-dda/pkgs/default.nix +++ b/pkgs/games/cataclysm-dda/pkgs/default.nix @@ -16,7 +16,7 @@ let pkgs' = lib.mapAttrs (_: mods: lib.filterAttrs isAvailable mods) pkgs; isAvailable = _: mod: - if isNull build then + if (build == null) then true else if build.isTiles then mod.forTiles or false diff --git a/pkgs/games/curseofwar/default.nix b/pkgs/games/curseofwar/default.nix index 6271a60f5b9c..fef456816ff2 100644 --- a/pkgs/games/curseofwar/default.nix +++ b/pkgs/games/curseofwar/default.nix @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { SDL ]; - makeFlags = (if isNull SDL then [] else [ "SDL=yes" ]) ++ [ + makeFlags = (lib.optionals (SDL != null) [ "SDL=yes" ]) ++ [ "PREFIX=$(out)" # force platform's cc on darwin, otherwise gcc is used "CC=${stdenv.cc.targetPrefix}cc" diff --git a/pkgs/servers/nosql/arangodb/default.nix b/pkgs/servers/nosql/arangodb/default.nix index 3d15654300ca..443fdeffb10a 100644 --- a/pkgs/servers/nosql/arangodb/default.nix +++ b/pkgs/servers/nosql/arangodb/default.nix @@ -25,7 +25,7 @@ let else "core"; targetArch = - if isNull targetArchitecture + if targetArchitecture == null then defaultTargetArchitecture else targetArchitecture; in diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 6bf319d07308..890cf4b668d7 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -206,7 +206,7 @@ let checkDependencyList = checkDependencyList' []; checkDependencyList' = positions: name: deps: lib.flip lib.imap1 deps (index: dep: - if lib.isDerivation dep || isNull dep || builtins.typeOf dep == "string" || builtins.typeOf dep == "path" then dep + if lib.isDerivation dep || dep == null || builtins.typeOf dep == "string" || builtins.typeOf dep == "path" then dep else if lib.isList dep then checkDependencyList' ([index] ++ positions) name dep else throw "Dependency is not of a valid type: ${lib.concatMapStrings (ix: "element ${toString ix} of ") ([index] ++ positions)}${name} for ${attrs.name or attrs.pname}"); in if builtins.length erroneousHardeningFlags != 0 diff --git a/pkgs/tools/misc/plfit/default.nix b/pkgs/tools/misc/plfit/default.nix index 60d08e69d457..78e7c3572b6f 100644 --- a/pkgs/tools/misc/plfit/default.nix +++ b/pkgs/tools/misc/plfit/default.nix @@ -20,14 +20,14 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake - ] ++ lib.optionals (!isNull python) [ + ] ++ lib.optionals (python != null) [ python swig ]; cmakeFlags = [ "-DPLFIT_USE_OPENMP=ON" - ] ++ lib.optionals (!isNull python) [ + ] ++ lib.optionals (python != null) [ "-DPLFIT_COMPILE_PYTHON_MODULE=ON" ]; diff --git a/pkgs/tools/text/gawk/gawkextlib.nix b/pkgs/tools/text/gawk/gawkextlib.nix index d15d5ce75f41..e050c9939269 100644 --- a/pkgs/tools/text/gawk/gawkextlib.nix +++ b/pkgs/tools/text/gawk/gawkextlib.nix @@ -6,7 +6,7 @@ let buildExtension = lib.makeOverridable ({ name, gawkextlib, extraBuildInputs ? [ ], doCheck ? true }: - let is_extension = !isNull gawkextlib; + let is_extension = gawkextlib != null; in stdenv.mkDerivation rec { pname = "gawkextlib-${name}"; version = "unstable-2019-11-21";