diff --git a/nixos/modules/services/audio/roon-bridge.nix b/nixos/modules/services/audio/roon-bridge.nix index 70392b647cc6..027b0332fd1e 100644 --- a/nixos/modules/services/audio/roon-bridge.nix +++ b/nixos/modules/services/audio/roon-bridge.nix @@ -70,12 +70,11 @@ in { users.groups.${cfg.group} = {}; users.users.${cfg.user} = - if cfg.user == "roon-bridge" then { + optionalAttrs (cfg.user == "roon-bridge") { isSystemUser = true; description = "Roon Bridge user"; group = cfg.group; extraGroups = [ "audio" ]; - } - else {}; + }; }; } diff --git a/nixos/modules/services/audio/roon-server.nix b/nixos/modules/services/audio/roon-server.nix index fbe74f63b9da..8691c08b0d36 100644 --- a/nixos/modules/services/audio/roon-server.nix +++ b/nixos/modules/services/audio/roon-server.nix @@ -76,12 +76,11 @@ in { users.groups.${cfg.group} = {}; users.users.${cfg.user} = - if cfg.user == "roon-server" then { + optionalAttrs (cfg.user == "roon-server") { isSystemUser = true; description = "Roon Server user"; group = cfg.group; extraGroups = [ "audio" ]; - } - else {}; + }; }; } diff --git a/nixos/modules/services/hardware/fwupd.nix b/nixos/modules/services/hardware/fwupd.nix index 9ea1d0cf4165..4e5913fd2751 100644 --- a/nixos/modules/services/hardware/fwupd.nix +++ b/nixos/modules/services/hardware/fwupd.nix @@ -50,7 +50,7 @@ let # to install it because it would create a cyclic dependency between # the outputs. We also need to enable the remote, # which should not be done by default. - if cfg.enableTestRemote then (enableRemote cfg.package.installedTests "fwupd-tests") else {} + lib.optionalAttrs cfg.enableTestRemote (enableRemote cfg.package.installedTests "fwupd-tests") ); in { diff --git a/nixos/modules/services/misc/disnix.nix b/nixos/modules/services/misc/disnix.nix index 1cdfeef57cef..13c57ce6b85b 100644 --- a/nixos/modules/services/misc/disnix.nix +++ b/nixos/modules/services/misc/disnix.nix @@ -87,8 +87,8 @@ in environment = { HOME = "/root"; } - // (if config.environment.variables ? DYSNOMIA_CONTAINERS_PATH then { inherit (config.environment.variables) DYSNOMIA_CONTAINERS_PATH; } else {}) - // (if config.environment.variables ? DYSNOMIA_MODULES_PATH then { inherit (config.environment.variables) DYSNOMIA_MODULES_PATH; } else {}); + // (optionalAttrs (config.environment.variables ? DYSNOMIA_CONTAINERS_PATH) { inherit (config.environment.variables) DYSNOMIA_CONTAINERS_PATH; }) + // (optionalAttrs (config.environment.variables ? DYSNOMIA_MODULES_PATH) { inherit (config.environment.variables) DYSNOMIA_MODULES_PATH; }); serviceConfig.ExecStart = "${cfg.package}/bin/disnix-service"; }; diff --git a/nixos/modules/services/misc/docker-registry.nix b/nixos/modules/services/misc/docker-registry.nix index 8ea81f9a7ee2..b0e910634637 100644 --- a/nixos/modules/services/misc/docker-registry.nix +++ b/nixos/modules/services/misc/docker-registry.nix @@ -15,9 +15,7 @@ let storage = { cache.blobdescriptor = blobCache; delete.enabled = cfg.enableDelete; - } // (if cfg.storagePath != null - then { filesystem.rootdirectory = cfg.storagePath; } - else {}); + } // (optionalAttrs (cfg.storagePath != null) { filesystem.rootdirectory = cfg.storagePath; }); http = { addr = "${cfg.listenAddress}:${builtins.toString cfg.port}"; headers.X-Content-Type-Options = ["nosniff"]; @@ -152,12 +150,10 @@ in { }; users.users.docker-registry = - (if cfg.storagePath != null - then { + (optionalAttrs (cfg.storagePath != null) { createHome = true; home = cfg.storagePath; - } - else {}) // { + }) // { group = "docker-registry"; isSystemUser = true; }; diff --git a/nixos/modules/services/networking/zerobin.nix b/nixos/modules/services/networking/zerobin.nix index 9e07666f3e14..735d4fa25fb1 100644 --- a/nixos/modules/services/networking/zerobin.nix +++ b/nixos/modules/services/networking/zerobin.nix @@ -75,13 +75,12 @@ in config = mkIf (cfg.enable) { users.users.${cfg.user} = - if cfg.user == "zerobin" then { + optionalAttrs (cfg.user == "zerobin") { isSystemUser = true; group = cfg.group; home = cfg.dataDir; createHome = true; - } - else {}; + }; users.groups.${cfg.group} = {}; systemd.services.zerobin = { diff --git a/nixos/modules/virtualisation/nixos-containers.nix b/nixos/modules/virtualisation/nixos-containers.nix index c3949564d4bd..5df9942dbc04 100644 --- a/nixos/modules/virtualisation/nixos-containers.nix +++ b/nixos/modules/virtualisation/nixos-containers.nix @@ -800,14 +800,14 @@ in # declarative containers ++ (mapAttrsToList (name: cfg: nameValuePair "container@${name}" (let containerConfig = cfg // ( - if cfg.enableTun then + optionalAttrs cfg.enableTun { allowedDevices = cfg.allowedDevices ++ [ { node = "/dev/net/tun"; modifier = "rw"; } ]; additionalCapabilities = cfg.additionalCapabilities ++ [ "CAP_NET_ADMIN" ]; } - else {}); + ); in recursiveUpdate unit { preStart = preStartScript containerConfig; @@ -817,7 +817,7 @@ in unitConfig.RequiresMountsFor = lib.optional (!containerConfig.ephemeral) "${stateDirectory}/%i"; environment.root = if containerConfig.ephemeral then "/run/nixos-containers/%i" else "${stateDirectory}/%i"; } // ( - if containerConfig.autoStart then + optionalAttrs containerConfig.autoStart { wantedBy = [ "machines.target" ]; wants = [ "network.target" ]; @@ -828,7 +828,7 @@ in ]; restartIfChanged = true; } - else {}) + ) )) config.containers) )); diff --git a/nixos/tests/virtualbox.nix b/nixos/tests/virtualbox.nix index 1ebd99f5d75d..062b125eb611 100644 --- a/nixos/tests/virtualbox.nix +++ b/nixos/tests/virtualbox.nix @@ -519,4 +519,4 @@ in mapAttrs (mkVBoxTest false vboxVMs) { destroy_vm_test1() destroy_vm_test2() ''; -} // (if enableUnfree then unfreeTests else {}) +} // (lib.optionalAttrs enableUnfree unfreeTests) diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index acc433496b0e..adaf80dcd916 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -388,8 +388,8 @@ stdenv.mkDerivation { }; meta = - let bintools_ = if bintools != null then bintools else {}; in - (if bintools_ ? meta then removeAttrs bintools.meta ["priority"] else {}) // + let bintools_ = lib.optionalAttrs (bintools != null) bintools; in + (lib.optionalAttrs (bintools_ ? meta) (removeAttrs bintools.meta ["priority"])) // { description = lib.attrByPath ["meta" "description"] "System binary utilities" bintools_ + " (wrapper script)"; diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index ffde44c538e3..5e919bc212bd 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -611,8 +611,8 @@ stdenv.mkDerivation { }; meta = - let cc_ = if cc != null then cc else {}; in - (if cc_ ? meta then removeAttrs cc.meta ["priority"] else {}) // + let cc_ = lib.optionalAttrs (cc != null) cc; in + (lib.optionalAttrs (cc_ ? meta) (removeAttrs cc.meta ["priority"])) // { description = lib.attrByPath ["meta" "description"] "System C compiler" cc_ + " (wrapper script)"; diff --git a/pkgs/build-support/emacs/buffer.nix b/pkgs/build-support/emacs/buffer.nix index 8f824f4e1a57..b8bd4584e322 100644 --- a/pkgs/build-support/emacs/buffer.nix +++ b/pkgs/build-support/emacs/buffer.nix @@ -73,7 +73,5 @@ rec { haskell-package-env = builtins.head haskell-package.env.nativeBuildInputs; in - if is-haskell-package - then withPackages [ haskell-package-env ] - else {}; + lib.optionalAttrs is-haskell-package (withPackages [ haskell-package-env ]); } diff --git a/pkgs/build-support/pkg-config-wrapper/default.nix b/pkgs/build-support/pkg-config-wrapper/default.nix index f68597662608..f409ca3a7d4b 100644 --- a/pkgs/build-support/pkg-config-wrapper/default.nix +++ b/pkgs/build-support/pkg-config-wrapper/default.nix @@ -119,8 +119,8 @@ stdenv.mkDerivation { }; meta = - let pkg-config_ = if pkg-config != null then pkg-config else {}; in - (if pkg-config_ ? meta then removeAttrs pkg-config.meta ["priority"] else {}) // + let pkg-config_ = lib.optionalAttrs (pkg-config != null) pkg-config; in + (lib.optionalAttrs (pkg-config_ ? meta) (removeAttrs pkg-config.meta ["priority"])) // { description = lib.attrByPath ["meta" "description"] "pkg-config" pkg-config_ + " (wrapper script)"; diff --git a/pkgs/build-support/release/binary-tarball.nix b/pkgs/build-support/release/binary-tarball.nix index 24d5b2e1cafc..37c5f8c7ee86 100644 --- a/pkgs/build-support/release/binary-tarball.nix +++ b/pkgs/build-support/release/binary-tarball.nix @@ -70,7 +70,7 @@ stdenv.mkDerivation ( test -n "$releaseName" && (echo "$releaseName" >> $out/nix-support/hydra-release-name) ''; - meta = (if args ? meta then args.meta else {}) // { + meta = (lib.optionalAttrs (args ? meta) args.meta) // { description = "Build of a generic binary distribution"; }; diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix index 6e08caf0a4e5..ab84a504b54c 100644 --- a/pkgs/build-support/release/debian-build.nix +++ b/pkgs/build-support/release/debian-build.nix @@ -86,7 +86,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation ( eval "$postInstall" ''; - meta = (if args ? meta then args.meta else {}) // { + meta = (lib.optionalAttrs (args ? meta) args.meta) // { description = "Deb package for ${diskImage.fullName}"; }; } diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix index 83e521bb65c7..583831d4821d 100644 --- a/pkgs/build-support/release/nix-build.nix +++ b/pkgs/build-support/release/nix-build.nix @@ -146,7 +146,7 @@ stdenv.mkDerivation ( postPhases = postPhases ++ ["finalPhase"]; - meta = (if args ? meta then args.meta else {}) // { + meta = (lib.optionalAttrs (args ? meta) args.meta) // { description = if doCoverageAnalysis then "Coverage analysis" else "Nix package for ${stdenv.hostPlatform.system}"; }; diff --git a/pkgs/build-support/release/rpm-build.nix b/pkgs/build-support/release/rpm-build.nix index 8f4711470509..ccbbd57107bd 100644 --- a/pkgs/build-support/release/rpm-build.nix +++ b/pkgs/build-support/release/rpm-build.nix @@ -46,7 +46,7 @@ vmTools.buildRPM ( done ''; - meta = (if args ? meta then args.meta else {}) // { + meta = (lib.optionalAttrs (args ? meta) args.meta) // { description = "RPM package for ${diskImage.fullName}"; }; } diff --git a/pkgs/build-support/rust/build-rust-crate/test/rcgen-crates.nix b/pkgs/build-support/rust/build-rust-crate/test/rcgen-crates.nix index e15390c3ffa8..ed273c01d26d 100644 --- a/pkgs/build-support/rust/build-rust-crate/test/rcgen-crates.nix +++ b/pkgs/build-support/rust/build-rust-crate/test/rcgen-crates.nix @@ -24,9 +24,7 @@ , release ? true # Additional crate2nix configuration if it exists. , crateConfig - ? if builtins.pathExists ./crate-config.nix - then pkgs.callPackage ./crate-config.nix {} - else {} + ? lib.optionalAttrs (builtins.pathExists ./crate-config.nix) (pkgs.callPackage ./crate-config.nix {}) }: rec { diff --git a/pkgs/data/icons/apple-cursor/default.nix b/pkgs/data/icons/apple-cursor/default.nix index 90898333b45c..46b4b37f78df 100644 --- a/pkgs/data/icons/apple-cursor/default.nix +++ b/pkgs/data/icons/apple-cursor/default.nix @@ -8,7 +8,7 @@ let name = variant; url = "https://github.com/ful1e5/apple_cursor/releases/download/v${version}/${variant}.${suffix}"; hash = hash; - } // (if suffix == "zip" then { stripRoot = false; } else {})); + } // (lib.optionalAttrs (suffix == "zip") { stripRoot = false; })); version = "2.0.0"; srcs = [ diff --git a/pkgs/desktops/gnustep/make/gsmakeDerivation.nix b/pkgs/desktops/gnustep/make/gsmakeDerivation.nix index 11aa53b77b5c..04cfcc1ca343 100644 --- a/pkgs/desktops/gnustep/make/gsmakeDerivation.nix +++ b/pkgs/desktops/gnustep/make/gsmakeDerivation.nix @@ -15,5 +15,5 @@ stdenv.mkDerivation (args // { maintainers = with lib.maintainers; [ ashalkhakov matthewbauer ]; platforms = lib.platforms.linux; - } // (if builtins.hasAttr "meta" args then args.meta else {}); + } // (lib.optionalAttrs (builtins.hasAttr "meta" args) args.meta); }) diff --git a/pkgs/development/compilers/cudatoolkit/redist/extension.nix b/pkgs/development/compilers/cudatoolkit/redist/extension.nix index 32215b1360c8..308397d7b063 100644 --- a/pkgs/development/compilers/cudatoolkit/redist/extension.nix +++ b/pkgs/development/compilers/cudatoolkit/redist/extension.nix @@ -26,9 +26,7 @@ final: prev: let in lib.mapAttrs buildCudaToolkitRedistPackage attrs; # All cudatoolkit redist packages for the current cuda version - cudaToolkitRedistPackages = if - lib.hasAttr cudaVersion cudaToolkitRedistManifests - then buildCudaToolkitRedistPackages { version = cudaVersion; manifest = cudaToolkitRedistManifests.${cudaVersion}; } - else {}; + cudaToolkitRedistPackages = lib.optionalAttrs (lib.hasAttr cudaVersion cudaToolkitRedistManifests) + (buildCudaToolkitRedistPackages { version = cudaVersion; manifest = cudaToolkitRedistManifests.${cudaVersion}; }); in cudaToolkitRedistPackages diff --git a/pkgs/development/coq-modules/zorns-lemma/default.nix b/pkgs/development/coq-modules/zorns-lemma/default.nix index 19696bd81d4f..8d57bc885c11 100644 --- a/pkgs/development/coq-modules/zorns-lemma/default.nix +++ b/pkgs/development/coq-modules/zorns-lemma/default.nix @@ -36,4 +36,4 @@ maintainers = with maintainers; [ siraben ]; license = licenses.lgpl21Plus; }; -}).overrideAttrs({version, ...}: if lib.versions.isGe "9.0" version then { repo = "topology"; } else {}) +}).overrideAttrs({version, ...}: lib.optionalAttrs (lib.versions.isGe "9.0" version) { repo = "topology"; }) diff --git a/pkgs/development/interpreters/lua-5/interpreter.nix b/pkgs/development/interpreters/lua-5/interpreter.nix index 4d05a2490e9e..57245bd61e76 100644 --- a/pkgs/development/interpreters/lua-5/interpreter.nix +++ b/pkgs/development/interpreters/lua-5/interpreter.nix @@ -146,7 +146,7 @@ stdenv.mkDerivation rec { luaOnBuildForHost = override pkgsBuildHost.${luaAttr}; luaOnBuildForTarget = override pkgsBuildTarget.${luaAttr}; luaOnHostForHost = override pkgsHostHost.${luaAttr}; - luaOnTargetForTarget = if lib.hasAttr luaAttr pkgsTargetTarget then (override pkgsTargetTarget.${luaAttr}) else {}; + luaOnTargetForTarget = lib.optionalAttrs (lib.hasAttr luaAttr pkgsTargetTarget) (override pkgsTargetTarget.${luaAttr}); }; meta = { diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix index ddb49b40ff64..044a16ec7234 100644 --- a/pkgs/development/interpreters/luajit/default.nix +++ b/pkgs/development/interpreters/luajit/default.nix @@ -127,7 +127,7 @@ stdenv.mkDerivation rec { luaOnBuildForHost = override pkgsBuildHost.${luaAttr}; luaOnBuildForTarget = override pkgsBuildTarget.${luaAttr}; luaOnHostForHost = override pkgsHostHost.${luaAttr}; - luaOnTargetForTarget = if lib.hasAttr luaAttr pkgsTargetTarget then (override pkgsTargetTarget.${luaAttr}) else {}; + luaOnTargetForTarget = lib.optionalAttrs (lib.hasAttr luaAttr pkgsTargetTarget) (override pkgsTargetTarget.${luaAttr}); }; meta = with lib; { diff --git a/pkgs/development/interpreters/python/cpython/default.nix b/pkgs/development/interpreters/python/cpython/default.nix index d469032e13b2..ff103373a10f 100644 --- a/pkgs/development/interpreters/python/cpython/default.nix +++ b/pkgs/development/interpreters/python/cpython/default.nix @@ -109,7 +109,7 @@ let pythonOnBuildForHost = override pkgsBuildHost.${pythonAttr}; pythonOnBuildForTarget = override pkgsBuildTarget.${pythonAttr}; pythonOnHostForHost = override pkgsHostHost.${pythonAttr}; - pythonOnTargetForTarget = if lib.hasAttr pythonAttr pkgsTargetTarget then (override pkgsTargetTarget.${pythonAttr}) else {}; + pythonOnTargetForTarget = lib.optionalAttrs (lib.hasAttr pythonAttr pkgsTargetTarget) (override pkgsTargetTarget.${pythonAttr}); }; version = with sourceVersion; "${major}.${minor}.${patch}${suffix}"; diff --git a/pkgs/development/libraries/hspell/dicts.nix b/pkgs/development/libraries/hspell/dicts.nix index 06f80bf5cf22..e11cbbce3336 100644 --- a/pkgs/development/libraries/hspell/dicts.nix +++ b/pkgs/development/libraries/hspell/dicts.nix @@ -1,4 +1,4 @@ -{ stdenv, hspell }: +{ lib, stdenv, hspell }: let dict = variant: a: stdenv.mkDerivation ({ @@ -8,7 +8,7 @@ let meta = hspell.meta // { broken = true; description = "${variant} Hebrew dictionary"; - } // (if a ? meta then a.meta else {}); + } // (lib.optionalAttrs (a ? meta) a.meta); } // (removeAttrs a ["meta"])); in { diff --git a/pkgs/development/lisp-modules-new-obsolete/ql.nix b/pkgs/development/lisp-modules-new-obsolete/ql.nix index f65a55dae117..da76d8dd5775 100644 --- a/pkgs/development/lisp-modules-new-obsolete/ql.nix +++ b/pkgs/development/lisp-modules-new-obsolete/ql.nix @@ -221,9 +221,8 @@ let }; qlpkgs = - if builtins.pathExists ./imported.nix - then import ./imported.nix { inherit (pkgs) runCommand fetchzip; pkgs = builtQlpkgs; } - else {}; + lib.optionalAttrs (builtins.pathExists ./imported.nix) + (import ./imported.nix { inherit (pkgs) runCommand fetchzip; pkgs = builtQlpkgs; }); builtQlpkgs = mapAttrs (n: v: build v) qlpkgs; diff --git a/pkgs/development/lisp-modules/ql.nix b/pkgs/development/lisp-modules/ql.nix index 7e134fbce980..90b749c7bc86 100644 --- a/pkgs/development/lisp-modules/ql.nix +++ b/pkgs/development/lisp-modules/ql.nix @@ -230,8 +230,7 @@ let }); qlpkgs = - if builtins.pathExists ./imported.nix - then pkgs.callPackage ./imported.nix { inherit build-asdf-system; } - else {}; + lib.optionalAttrs (builtins.pathExists ./imported.nix) + (pkgs.callPackage ./imported.nix { inherit build-asdf-system; }); in qlpkgs.overrideScope' overrides diff --git a/pkgs/development/ocaml-modules/num/default.nix b/pkgs/development/ocaml-modules/num/default.nix index 12f9aa4ca02b..d41d0f851fa5 100644 --- a/pkgs/development/ocaml-modules/num/default.nix +++ b/pkgs/development/ocaml-modules/num/default.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation (rec { inherit (ocaml.meta) platforms; inherit (src.meta) homepage; }; -} // (if lib.versions.majorMinor ocaml.version == "4.06" then { +} // (lib.optionalAttrs (lib.versions.majorMinor ocaml.version == "4.06") { env.NIX_CFLAGS_COMPILE = "-fcommon"; - } else {}) + }) ) diff --git a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix index ce370dd414d8..652e7e32bc50 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix @@ -320,10 +320,10 @@ stdenv.mkDerivation rec { sha256 = "1mm4awx6sa0myiz9j4hwp71rpr7yh8vihf3zm15n2ii6xb82r31k"; }; - in (if !stdenv.hostPlatform.isDarwin then { + in (lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) { # `extracted` doesn’t work on darwin shebang = callPackage ../shebang-test.nix { inherit runLocal extracted bazelTest distDir; bazel = bazel_self; }; - } else {}) // { + }) // { bashTools = callPackage ../bash-tools-test.nix { inherit runLocal bazelTest distDir; bazel = bazel_self; }; cpp = callPackage ../cpp-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazel_self; }; java = callPackage ../java-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazel_self; }; diff --git a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix index f0d2147fe7f6..8382f9d4be35 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix @@ -285,10 +285,10 @@ stdenv.mkDerivation rec { sha256 = "1mm4awx6sa0myiz9j4hwp71rpr7yh8vihf3zm15n2ii6xb82r31k"; }; - in (if !stdenv.hostPlatform.isDarwin then { + in (lib.optionalSttrs (!stdenv.hostPlatform.isDarwin) { # `extracted` doesn’t work on darwin shebang = callPackage ../shebang-test.nix { inherit runLocal extracted bazelTest distDir; bazel = bazel_self;}; - } else {}) // { + }) // { bashTools = callPackage ../bash-tools-test.nix { inherit runLocal bazelTest distDir; bazel = bazel_self;}; cpp = callPackage ../cpp-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazel_self;}; java = callPackage ../java-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazel_self;}; diff --git a/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix index de69c79b6ea0..1424817edc90 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix @@ -295,10 +295,10 @@ stdenv.mkDerivation rec { sha256 = "1mm4awx6sa0myiz9j4hwp71rpr7yh8vihf3zm15n2ii6xb82r31k"; }; - in (if !stdenv.hostPlatform.isDarwin then { + in (lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) { # `extracted` doesn’t work on darwin shebang = callPackage ../shebang-test.nix { inherit runLocal extracted bazelTest distDir; bazel = bazel_self;}; - } else {}) // { + }) // { bashTools = callPackage ../bash-tools-test.nix { inherit runLocal bazelTest distDir; bazel = bazel_self;}; cpp = callPackage ../cpp-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazel_self;}; java = callPackage ../java-test.nix { inherit runLocal bazelTest bazel-examples distDir; bazel = bazel_self;};