summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/bintools-wrapper/default.nix16
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix14
-rw-r--r--pkgs/build-support/docker/default.nix2
-rw-r--r--pkgs/build-support/fetchgithub/default.nix2
-rw-r--r--pkgs/build-support/kernel/make-initrd-ng.nix2
-rw-r--r--pkgs/build-support/nix-gitignore/default.nix2
-rw-r--r--pkgs/build-support/rust/build-rust-crate/configure-crate.nix2
-rw-r--r--pkgs/build-support/vm/default.nix2
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 acc433496b0e..cc6f0ff897ed 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 ffde44c538e3..a843e6440202 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
@@ -164,7 +164,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;
@@ -600,10 +600,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 5f48fb9f7bdb..b74d7885d54a 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 faa338b672f0..a2498700b545 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 f3cf3d59f92b..2418838176ef 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 d55465302e44..5fc1f2cf7f8c 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 5168eb6ab759..60310f178747 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 403bc9b1d2da..e05848217d2b 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"