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.
This commit is contained in:
parent
0cb16a6955
commit
97bfc2fac9
|
@ -34,7 +34,7 @@ let
|
||||||
# copy what we need. Instead of using statically linked binaries,
|
# copy what we need. Instead of using statically linked binaries,
|
||||||
# we just copy what we need from Glibc and use patchelf to make it
|
# we just copy what we need from Glibc and use patchelf to make it
|
||||||
# work.
|
# work.
|
||||||
extraUtils = pkgs.runCommand "extra-utils"
|
extraUtils = pkgs.runCommandCC "extra-utils"
|
||||||
{ buildInputs = [pkgs.nukeReferences];
|
{ buildInputs = [pkgs.nukeReferences];
|
||||||
allowedReferences = [ "out" ]; # prevent accidents like glibc being included in the initrd
|
allowedReferences = [ "out" ]; # prevent accidents like glibc being included in the initrd
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ import ./make-test.nix ({ pkgs, ... }: {
|
||||||
boot.initrd.kernelModules = [ "kcanary" ];
|
boot.initrd.kernelModules = [ "kcanary" ];
|
||||||
|
|
||||||
boot.initrd.extraUtilsCommands = let
|
boot.initrd.extraUtilsCommands = let
|
||||||
compile = name: source: pkgs.runCommand name { inherit source; } ''
|
compile = name: source: pkgs.runCommandCC name { inherit source; } ''
|
||||||
mkdir -p "$out/bin"
|
mkdir -p "$out/bin"
|
||||||
echo "$source" | gcc -Wall -o "$out/bin/$name" -xc -
|
echo "$source" | gcc -Wall -o "$out/bin/$name" -xc -
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -1,15 +1,23 @@
|
||||||
{ lib, stdenv, lndir }:
|
{ lib, stdenv, stdenvNoCC, lndir }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
runCommand' = stdenv: name: env: buildCommand:
|
||||||
|
stdenv.mkDerivation ({
|
||||||
|
inherit name buildCommand;
|
||||||
|
passAsFile = [ "buildCommand" ];
|
||||||
|
} // env);
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
# Run the shell command `buildCommand' to produce a store path named
|
# Run the shell command `buildCommand' to produce a store path named
|
||||||
# `name'. The attributes in `env' are added to the environment
|
# `name'. The attributes in `env' are added to the environment
|
||||||
# prior to running the command.
|
# prior to running the command.
|
||||||
runCommand = name: env: buildCommand:
|
runCommand = runCommandNoCC;
|
||||||
stdenv.mkDerivation ({
|
runCommandNoCC = runCommand' stdenvNoCC;
|
||||||
inherit name buildCommand;
|
runCommandCC = runCommand' stdenv;
|
||||||
passAsFile = [ "buildCommand" ];
|
|
||||||
} // env);
|
|
||||||
|
|
||||||
|
|
||||||
# Create a single file.
|
# Create a single file.
|
||||||
|
|
|
@ -82,7 +82,7 @@ let
|
||||||
|
|
||||||
trivialBuilders = self: super:
|
trivialBuilders = self: super:
|
||||||
(import ../build-support/trivial-builders.nix {
|
(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;
|
stdenvDefault = self: super: (import ./stdenv.nix topLevelArguments) {} pkgs;
|
||||||
|
|
Loading…
Reference in a new issue