diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-27 16:36:16 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2016-09-29 13:06:43 +0200 |
commit | 97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7 (patch) | |
tree | a4374e67bc2fda865d93133423cfb69c5018f95e | |
parent | 0cb16a6955ff6ef447a81caab02a8389b2d19dd4 (diff) | |
download | nixpkgs-97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7.tar nixpkgs-97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7.tar.gz nixpkgs-97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7.tar.bz2 nixpkgs-97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7.tar.lz nixpkgs-97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7.tar.xz nixpkgs-97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7.tar.zst nixpkgs-97bfc2fac92d90c668ae1ec078356d0bd0a9ddb7.zip |
runCommand: Use stdenvNoCC
This ensures that most "trivial" derivations used to build NixOS configurations no longer depend on GCC. For commands that do invoke gcc, there is runCommandCC.
-rw-r--r-- | nixos/modules/system/boot/stage-1.nix | 2 | ||||
-rw-r--r-- | nixos/tests/boot-stage1.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/trivial-builders.nix | 20 | ||||
-rw-r--r-- | pkgs/top-level/default.nix | 2 |
4 files changed, 17 insertions, 9 deletions
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix index 8d02cd81e0e..61def24efd8 100644 --- a/nixos/modules/system/boot/stage-1.nix +++ b/nixos/modules/system/boot/stage-1.nix @@ -34,7 +34,7 @@ let # copy what we need. Instead of using statically linked binaries, # we just copy what we need from Glibc and use patchelf to make it # work. - extraUtils = pkgs.runCommand "extra-utils" + extraUtils = pkgs.runCommandCC "extra-utils" { buildInputs = [pkgs.nukeReferences]; allowedReferences = [ "out" ]; # prevent accidents like glibc being included in the initrd } diff --git a/nixos/tests/boot-stage1.nix b/nixos/tests/boot-stage1.nix index ccd8394a1f0..e9087edb5d5 100644 --- a/nixos/tests/boot-stage1.nix +++ b/nixos/tests/boot-stage1.nix @@ -62,7 +62,7 @@ import ./make-test.nix ({ pkgs, ... }: { boot.initrd.kernelModules = [ "kcanary" ]; boot.initrd.extraUtilsCommands = let - compile = name: source: pkgs.runCommand name { inherit source; } '' + compile = name: source: pkgs.runCommandCC name { inherit source; } '' mkdir -p "$out/bin" echo "$source" | gcc -Wall -o "$out/bin/$name" -xc - ''; diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index 398426bf9a4..d6f390ddfb1 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -1,16 +1,24 @@ -{ lib, stdenv, lndir }: +{ lib, stdenv, stdenvNoCC, lndir }: -rec { +let - # Run the shell command `buildCommand' to produce a store path named - # `name'. The attributes in `env' are added to the environment - # prior to running the command. - runCommand = name: env: buildCommand: + runCommand' = stdenv: name: env: buildCommand: stdenv.mkDerivation ({ inherit name buildCommand; passAsFile = [ "buildCommand" ]; } // env); +in + +rec { + + # Run the shell command `buildCommand' to produce a store path named + # `name'. The attributes in `env' are added to the environment + # prior to running the command. + runCommand = runCommandNoCC; + runCommandNoCC = runCommand' stdenvNoCC; + runCommandCC = runCommand' stdenv; + # Create a single file. writeTextFile = diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index 87813571d9a..2eb7fb34b4d 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -82,7 +82,7 @@ let trivialBuilders = self: super: (import ../build-support/trivial-builders.nix { - inherit lib; inherit (self) stdenv; inherit (self.xorg) lndir; + inherit lib; inherit (self) stdenv stdenvNoCC; inherit (self.xorg) lndir; }); stdenvDefault = self: super: (import ./stdenv.nix topLevelArguments) {} pkgs; |