mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-22 14:45:27 +00:00
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,
|
||||
# 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
|
||||
}
|
||||
|
|
|
@ -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 -
|
||||
'';
|
||||
|
|
|
@ -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 {
|
||||
|
||||
# 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:
|
||||
stdenv.mkDerivation ({
|
||||
inherit name buildCommand;
|
||||
passAsFile = [ "buildCommand" ];
|
||||
} // env);
|
||||
runCommand = runCommandNoCC;
|
||||
runCommandNoCC = runCommand' stdenvNoCC;
|
||||
runCommandCC = runCommand' stdenv;
|
||||
|
||||
|
||||
# Create a single file.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue