diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2023-07-22 12:01:28 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-22 12:01:28 +0000 |
commit | 045f0259febde0ca2e4c55f87f5f09609558aa09 (patch) | |
tree | c4dd657566d218e1ce892c38313a71d6725c3aa8 /pkgs/build-support | |
parent | ed71ea2d5ff9fe94069c4794bc961b72d61e65ef (diff) | |
parent | f465da166263bc0d4b39dfd4ca28b777c92d4b73 (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/default.nix | 16 | ||||
-rw-r--r-- | pkgs/build-support/cc-wrapper/default.nix | 14 | ||||
-rw-r--r-- | pkgs/build-support/docker/default.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/fetchgithub/default.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/kernel/make-initrd-ng.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/nix-gitignore/default.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/rust/build-rust-crate/configure-crate.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/vm/default.nix | 2 |
8 files changed, 21 insertions, 21 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix index adaf80dcd916e..9ed4f5886f617 100644 --- a/pkgs/build-support/bintools-wrapper/default.nix +++ b/pkgs/build-support/bintools-wrapper/default.nix @@ -59,12 +59,12 @@ let bintoolsVersion = lib.getVersion bintools; bintoolsName = lib.removePrefix targetPrefix (lib.getName bintools); - libc_bin = if libc == null then "" else getBin libc; - libc_dev = if libc == null then "" else getDev libc; - libc_lib = if libc == null then "" else getLib libc; - bintools_bin = if nativeTools then "" else getBin bintools; + libc_bin = lib.optionalString (libc != null) (getBin libc); + libc_dev = lib.optionalString (libc != null) (getDev libc); + libc_lib = lib.optionalString (libc != null) (getLib libc); + bintools_bin = lib.optionalString (!nativeTools) (getBin bintools); # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. - coreutils_bin = if nativeTools then "" else getBin coreutils; + coreutils_bin = lib.optionalString (!nativeTools) (getBin coreutils); # See description in cc-wrapper. suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; @@ -103,7 +103,7 @@ in stdenv.mkDerivation { pname = targetPrefix + (if name != "" then name else "${bintoolsName}-wrapper"); - version = if bintools == null then "" else bintoolsVersion; + version = lib.optionalString (bintools != null) bintoolsVersion; preferLocalBuild = true; @@ -265,7 +265,7 @@ stdenv.mkDerivation { # install the wrapper, you get tools like objdump (same for any # binaries of libc). + optionalString (!nativeTools) '' - printWords ${bintools_bin} ${if libc == null then "" else libc_bin} > $out/nix-support/propagated-user-env-packages + printWords ${bintools_bin} ${lib.optionalString (libc != null) libc_bin} > $out/nix-support/propagated-user-env-packages '' ## @@ -381,7 +381,7 @@ stdenv.mkDerivation { # for substitution in utils.bash expandResponseParams = "${expand-response-params}/bin/expand-response-params"; shell = getBin shell + shell.shellPath or ""; - gnugrep_bin = if nativeTools then "" else gnugrep; + gnugrep_bin = lib.optionalString (!nativeTools) gnugrep; wrapperName = "BINTOOLS_WRAPPER"; inherit dynamicLinker targetPrefix suffixSalt coreutils_bin; inherit bintools_bin libc_bin libc_dev libc_lib; diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index db3efa068c0fd..551074e0a2112 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -75,14 +75,14 @@ let ccVersion = lib.getVersion cc; ccName = lib.removePrefix targetPrefix (lib.getName cc); - libc_bin = if libc == null then "" else getBin libc; - libc_dev = if libc == null then "" else getDev libc; - libc_lib = if libc == null then "" else getLib libc; + libc_bin = optionalString (libc != null) (getBin libc); + libc_dev = optionalString (libc != null) (getDev libc); + libc_lib = optionalString (libc != null) (getLib libc); cc_solib = getLib cc + optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}"; # The wrapper scripts use 'cat' and 'grep', so we may need coreutils. - coreutils_bin = if nativeTools then "" else getBin coreutils; + coreutils_bin = optionalString (!nativeTools) (getBin coreutils); # The "suffix salt" is a arbitrary string added in the end of env vars # defined by cc-wrapper's hooks so that multiple cc-wrappers can be used @@ -176,7 +176,7 @@ assert nativePrefix == bintools.nativePrefix; stdenv.mkDerivation { pname = targetPrefix + (if name != "" then name else "${ccName}-wrapper"); - version = if cc == null then "" else ccVersion; + version = optionalString (cc != null) ccVersion; preferLocalBuild = true; @@ -612,10 +612,10 @@ stdenv.mkDerivation { # for substitution in utils.bash expandResponseParams = "${expand-response-params}/bin/expand-response-params"; shell = getBin shell + shell.shellPath or ""; - gnugrep_bin = if nativeTools then "" else gnugrep; + gnugrep_bin = optionalString (!nativeTools) gnugrep; # stdenv.cc.cc should not be null and we have nothing better for now. # if the native impure bootstrap is gotten rid of this can become `inherit cc;` again. - cc = if nativeTools then "" else cc; + cc = optionalString (!nativeTools) cc; wrapperName = "CC_WRAPPER"; inherit suffixSalt coreutils_bin bintools; inherit libc_bin libc_dev libc_lib; diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 5f48fb9f7bdbe..b74d7885d54ae 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -594,7 +594,7 @@ rec { nativeBuildInputs = [ jshon pigz jq moreutils ]; # Image name must be lowercase imageName = lib.toLower name; - imageTag = if tag == null then "" else tag; + imageTag = lib.optionalString (tag != null) tag; inherit fromImage baseJson; layerClosure = writeReferencesToFile layer; passthru.buildArgs = args; diff --git a/pkgs/build-support/fetchgithub/default.nix b/pkgs/build-support/fetchgithub/default.nix index faa338b672f0c..a2498700b545d 100644 --- a/pkgs/build-support/fetchgithub/default.nix +++ b/pkgs/build-support/fetchgithub/default.nix @@ -24,7 +24,7 @@ let position = "${position.file}:${toString position.line}"; }; passthruAttrs = removeAttrs args [ "owner" "repo" "rev" "fetchSubmodules" "forceFetchGit" "private" "githubBase" "varPrefix" ]; - varBase = "NIX${if varPrefix == null then "" else "_${varPrefix}"}_GITHUB_PRIVATE_"; + varBase = "NIX${lib.optionalString (varPrefix != null) "_${varPrefix}"}_GITHUB_PRIVATE_"; useFetchGit = fetchSubmodules || (leaveDotGit == true) || deepClone || forceFetchGit || (sparseCheckout != []); # We prefer fetchzip in cases we don't need submodules as the hash # is more stable in that case. diff --git a/pkgs/build-support/kernel/make-initrd-ng.nix b/pkgs/build-support/kernel/make-initrd-ng.nix index f3cf3d59f92b0..2418838176ef3 100644 --- a/pkgs/build-support/kernel/make-initrd-ng.nix +++ b/pkgs/build-support/kernel/make-initrd-ng.nix @@ -72,7 +72,7 @@ in ${if makeUInitrd then "uInitrdCompression" else null} = uInitrdCompression; passAsFile = ["contents"]; - contents = lib.concatMapStringsSep "\n" ({ object, symlink, ... }: "${object}\n${if symlink == null then "" else symlink}") contents + "\n"; + contents = lib.concatMapStringsSep "\n" ({ object, symlink, ... }: "${object}\n${lib.optionalString (symlink != null) symlink}") contents + "\n"; nativeBuildInputs = [makeInitrdNGTool cpio] ++ lib.optional makeUInitrd ubootTools ++ lib.optional strip binutils; diff --git a/pkgs/build-support/nix-gitignore/default.nix b/pkgs/build-support/nix-gitignore/default.nix index f8e673a2a7f50..c047bfc7d9a28 100644 --- a/pkgs/build-support/nix-gitignore/default.nix +++ b/pkgs/build-support/nix-gitignore/default.nix @@ -66,7 +66,7 @@ in rec { handleSlashPrefix = l: let split = (match "^(/?)(.*)" l); - findSlash = l: if (match ".+/.+" l) != null then "" else l; + findSlash = l: lib.optionalString ((match ".+/.+" l) == null) l; hasSlash = mapAroundCharclass findSlash l != l; in (if (elemAt split 0) == "/" || hasSlash diff --git a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix index 5168eb6ab7592..60310f178747e 100644 --- a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix @@ -21,7 +21,7 @@ , verbose , workspace_member }: let version_ = lib.splitString "-" crateVersion; - versionPre = if lib.tail version_ == [] then "" else lib.elemAt version_ 1; + versionPre = lib.optionalString (lib.tail version_ != []) (lib.elemAt version_ 1); version = lib.splitVersion (lib.head version_); rustcOpts = lib.foldl' (opts: opt: opts + " " + opt) (if release then "-C opt-level=3" else "-C debuginfo=2") diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index 5cc107d2c4a8d..f6baa42348abf 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -468,7 +468,7 @@ rec { echo "installing RPMs..." PATH=/usr/bin:/bin:/usr/sbin:/sbin $chroot /mnt \ - rpm -iv --nosignature ${if runScripts then "" else "--noscripts"} $rpms + rpm -iv --nosignature ${lib.optionalString (!runScripts) "--noscripts"} $rpms echo "running post-install script..." eval "$postInstall" |