Merge pull request #27179 from obsidiansystems/platforms-from-stdenv
Define {build,host,target}Platform in stdenv
This commit is contained in:
@@ -37,8 +37,9 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
In Nixpkgs, these three platforms are defined as attribute sets under the names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and <literal>targetPlatform</literal>.
|
In Nixpkgs, these three platforms are defined as attribute sets under the names <literal>buildPlatform</literal>, <literal>hostPlatform</literal>, and <literal>targetPlatform</literal>.
|
||||||
All three are always defined at the top level, so one can get at them just like a dependency in a function that is imported with <literal>callPackage</literal>:
|
All three are always defined as attributes in the standard environment, and at the top level. That means one can get at them just like a dependency in a function that is imported with <literal>callPackage</literal>:
|
||||||
<programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...</programlisting>
|
<programlisting>{ stdenv, buildPlatform, hostPlatform, fooDep, barDep, .. }: ...buildPlatform...</programlisting>, or just off <varname>stdenv</varname>:
|
||||||
|
<programlisting>{ stdenv, fooDep, barDep, .. }: ...stdenv.buildPlatform...</programlisting>.
|
||||||
</para>
|
</para>
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
, zlib ? null, extraPackages ? [], extraBuildCommands ? ""
|
, zlib ? null, extraPackages ? [], extraBuildCommands ? ""
|
||||||
, dyld ? null # TODO: should this be a setup-hook on dyld?
|
, dyld ? null # TODO: should this be a setup-hook on dyld?
|
||||||
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
|
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
|
||||||
, hostPlatform, targetPlatform
|
|
||||||
, runCommand ? null
|
, runCommand ? null
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@@ -22,12 +21,14 @@ assert !nativeTools ->
|
|||||||
assert !(nativeLibc && noLibc);
|
assert !(nativeLibc && noLibc);
|
||||||
assert (noLibc || nativeLibc) == (libc == null);
|
assert (noLibc || nativeLibc) == (libc == null);
|
||||||
|
|
||||||
assert targetPlatform != hostPlatform -> runCommand != null;
|
assert stdenv.targetPlatform != stdenv.hostPlatform -> runCommand != null;
|
||||||
|
|
||||||
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
|
# For ghdl (the vhdl language provider to gcc) we need zlib in the wrapper.
|
||||||
assert cc.langVhdl or false -> zlib != null;
|
assert cc.langVhdl or false -> zlib != null;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (stdenv) hostPlatform targetPlatform;
|
||||||
|
|
||||||
# Prefix for binaries. Customarily ends with a dash separator.
|
# Prefix for binaries. Customarily ends with a dash separator.
|
||||||
#
|
#
|
||||||
# TODO(@Ericson2314) Make unconditional, or optional but always true by
|
# TODO(@Ericson2314) Make unconditional, or optional but always true by
|
||||||
|
|||||||
@@ -61,11 +61,9 @@ rec {
|
|||||||
, buildPlatform, hostPlatform, targetPlatform
|
, buildPlatform, hostPlatform, targetPlatform
|
||||||
} @ overrideArgs: let
|
} @ overrideArgs: let
|
||||||
stdenv = overrideArgs.stdenv.override {
|
stdenv = overrideArgs.stdenv.override {
|
||||||
# TODO(@Ericson2314): Cannot do this for now because then Nix thinks the
|
inherit
|
||||||
# resulting derivation should be built on the host platform.
|
buildPlatform hostPlatform targetPlatform
|
||||||
#hostPlatform = buildPlatform;
|
cc;
|
||||||
#targetPlatform = hostPlatform;
|
|
||||||
inherit cc;
|
|
||||||
|
|
||||||
allowedRequisites = null;
|
allowedRequisites = null;
|
||||||
|
|
||||||
|
|||||||
@@ -14,21 +14,18 @@ in bootStages ++ [
|
|||||||
|
|
||||||
# Build Packages
|
# Build Packages
|
||||||
(vanillaPackages: {
|
(vanillaPackages: {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = crossSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
selfBuild = false;
|
selfBuild = false;
|
||||||
|
stdenv =
|
||||||
|
assert vanillaPackages.hostPlatform == localSystem;
|
||||||
|
assert vanillaPackages.targetPlatform == localSystem;
|
||||||
|
vanillaPackages.stdenv.override { targetPlatform = crossSystem; };
|
||||||
# It's OK to change the built-time dependencies
|
# It's OK to change the built-time dependencies
|
||||||
allowCustomOverrides = true;
|
allowCustomOverrides = true;
|
||||||
inherit (vanillaPackages) stdenv;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
# Run Packages
|
# Run Packages
|
||||||
(buildPackages: {
|
(buildPackages: {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = crossSystem;
|
|
||||||
targetPlatform = crossSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
selfBuild = false;
|
selfBuild = false;
|
||||||
stdenv = buildPackages.makeStdenvCross {
|
stdenv = buildPackages.makeStdenvCross {
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ in bootStages ++ [
|
|||||||
|
|
||||||
# Additional stage, built using custom stdenv
|
# Additional stage, built using custom stdenv
|
||||||
(vanillaPackages: {
|
(vanillaPackages: {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
stdenv = config.replaceStdenv { pkgs = vanillaPackages; };
|
stdenv =
|
||||||
|
assert vanillaPackages.hostPlatform == localSystem;
|
||||||
|
assert vanillaPackages.targetPlatform == localSystem;
|
||||||
|
config.replaceStdenv { pkgs = vanillaPackages; };
|
||||||
})
|
})
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ in rec {
|
|||||||
|
|
||||||
name = "stdenv-darwin-boot-${toString step}";
|
name = "stdenv-darwin-boot-${toString step}";
|
||||||
|
|
||||||
|
buildPlatform = localSystem;
|
||||||
|
hostPlatform = localSystem;
|
||||||
|
targetPlatform = localSystem;
|
||||||
|
|
||||||
cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
|
cc = if isNull last then "/dev/null" else import ../../build-support/cc-wrapper {
|
||||||
inherit shell;
|
inherit shell;
|
||||||
inherit (last) stdenv;
|
inherit (last) stdenv;
|
||||||
@@ -73,8 +77,6 @@ in rec {
|
|||||||
nativeTools = true;
|
nativeTools = true;
|
||||||
nativePrefix = bootstrapTools;
|
nativePrefix = bootstrapTools;
|
||||||
nativeLibc = false;
|
nativeLibc = false;
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
libc = last.pkgs.darwin.Libsystem;
|
libc = last.pkgs.darwin.Libsystem;
|
||||||
isClang = true;
|
isClang = true;
|
||||||
cc = { name = "clang-9.9.9"; outPath = bootstrapTools; };
|
cc = { name = "clang-9.9.9"; outPath = bootstrapTools; };
|
||||||
@@ -90,9 +92,6 @@ in rec {
|
|||||||
'';
|
'';
|
||||||
initialPath = [ bootstrapTools ];
|
initialPath = [ bootstrapTools ];
|
||||||
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
|
|
||||||
fetchurlBoot = import ../../build-support/fetchurl {
|
fetchurlBoot = import ../../build-support/fetchurl {
|
||||||
stdenv = stage0.stdenv;
|
stdenv = stage0.stdenv;
|
||||||
curl = bootstrapTools;
|
curl = bootstrapTools;
|
||||||
@@ -107,9 +106,6 @@ in rec {
|
|||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
stdenv = thisStdenv;
|
stdenv = thisStdenv;
|
||||||
};
|
};
|
||||||
@@ -279,6 +275,10 @@ in rec {
|
|||||||
|
|
||||||
name = "stdenv-darwin";
|
name = "stdenv-darwin";
|
||||||
|
|
||||||
|
buildPlatform = localSystem;
|
||||||
|
hostPlatform = localSystem;
|
||||||
|
targetPlatform = localSystem;
|
||||||
|
|
||||||
preHook = commonPreHook + ''
|
preHook = commonPreHook + ''
|
||||||
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
|
export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
|
||||||
'';
|
'';
|
||||||
@@ -286,9 +286,6 @@ in rec {
|
|||||||
stdenvSandboxProfile = binShClosure + libSystemProfile;
|
stdenvSandboxProfile = binShClosure + libSystemProfile;
|
||||||
extraSandboxProfile = binShClosure + libSystemProfile;
|
extraSandboxProfile = binShClosure + libSystemProfile;
|
||||||
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
|
|
||||||
initialPath = import ../common-path.nix { inherit pkgs; };
|
initialPath = import ../common-path.nix { inherit pkgs; };
|
||||||
shell = "${pkgs.bash}/bin/bash";
|
shell = "${pkgs.bash}/bin/bash";
|
||||||
|
|
||||||
@@ -297,8 +294,6 @@ in rec {
|
|||||||
inherit shell;
|
inherit shell;
|
||||||
nativeTools = false;
|
nativeTools = false;
|
||||||
nativeLibc = false;
|
nativeLibc = false;
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit (pkgs) coreutils binutils gnugrep;
|
inherit (pkgs) coreutils binutils gnugrep;
|
||||||
inherit (pkgs.darwin) dyld;
|
inherit (pkgs.darwin) dyld;
|
||||||
cc = pkgs.llvmPackages.clang-unwrapped;
|
cc = pkgs.llvmPackages.clang-unwrapped;
|
||||||
@@ -338,9 +333,6 @@ in rec {
|
|||||||
stage3
|
stage3
|
||||||
stage4
|
stage4
|
||||||
(prevStage: {
|
(prevStage: {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
stdenv = stdenvDarwin prevStage;
|
stdenv = stdenvDarwin prevStage;
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ let inherit (localSystem) system; in
|
|||||||
|
|
||||||
stdenv = import ../generic {
|
stdenv = import ../generic {
|
||||||
name = "stdenv-freebsd-boot-1";
|
name = "stdenv-freebsd-boot-1";
|
||||||
|
buildPlatform = localSystem;
|
||||||
|
hostPlatform = localSystem;
|
||||||
|
targetPlatform = localSystem;
|
||||||
inherit config;
|
inherit config;
|
||||||
initialPath = [ "/" "/usr" ];
|
initialPath = [ "/" "/usr" ];
|
||||||
hostPlatform = localSystem;
|
hostPlatform = localSystem;
|
||||||
@@ -52,6 +55,9 @@ let inherit (localSystem) system; in
|
|||||||
|
|
||||||
stdenv = import ../generic {
|
stdenv = import ../generic {
|
||||||
name = "stdenv-freebsd-boot-0";
|
name = "stdenv-freebsd-boot-0";
|
||||||
|
buildPlatform = localSystem;
|
||||||
|
hostPlatform = localSystem;
|
||||||
|
targetPlatform = localSystem;
|
||||||
inherit config;
|
inherit config;
|
||||||
initialPath = [ prevStage.bootstrapTools ];
|
initialPath = [ prevStage.bootstrapTools ];
|
||||||
inherit (prevStage.stdenv)
|
inherit (prevStage.stdenv)
|
||||||
@@ -62,12 +68,12 @@ let inherit (localSystem) system; in
|
|||||||
})
|
})
|
||||||
|
|
||||||
(prevStage: {
|
(prevStage: {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
stdenv = import ../generic {
|
stdenv = import ../generic {
|
||||||
name = "stdenv-freebsd-boot-3";
|
name = "stdenv-freebsd-boot-3";
|
||||||
|
buildPlatform = localSystem;
|
||||||
|
hostPlatform = localSystem;
|
||||||
|
targetPlatform = localSystem;
|
||||||
inherit config;
|
inherit config;
|
||||||
|
|
||||||
inherit (prevStage.stdenv)
|
inherit (prevStage.stdenv)
|
||||||
@@ -77,8 +83,6 @@ let inherit (localSystem) system; in
|
|||||||
nativeTools = true;
|
nativeTools = true;
|
||||||
nativePrefix = "/usr";
|
nativePrefix = "/usr";
|
||||||
nativeLibc = true;
|
nativeLibc = true;
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit (prevStage) stdenv;
|
inherit (prevStage) stdenv;
|
||||||
cc = {
|
cc = {
|
||||||
name = "clang-9.9.9";
|
name = "clang-9.9.9";
|
||||||
|
|||||||
+39
-162
@@ -15,20 +15,32 @@ let lib = import ../../../lib; in lib.makeOverridable (
|
|||||||
, stdenvSandboxProfile ? ""
|
, stdenvSandboxProfile ? ""
|
||||||
, extraSandboxProfile ? ""
|
, extraSandboxProfile ? ""
|
||||||
|
|
||||||
, # The platforms here do *not* correspond to the stage the stdenv is
|
## Platform parameters
|
||||||
# used in, but rather the previous one, in which it was built. We
|
##
|
||||||
# use the latter two platforms, like a cross compiler, because the
|
## The "build" "host" "target" terminology below comes from GNU Autotools. See
|
||||||
# stand environment is a build tool if you squint at it, and because
|
## its documentation for more information on what those words mean. Note that
|
||||||
# neither of these are used when building stdenv so we know the
|
## each should always be defined, even when not cross compiling.
|
||||||
# build platform is irrelevant.
|
##
|
||||||
hostPlatform, targetPlatform
|
## For purposes of bootstrapping, think of each stage as a "sliding window"
|
||||||
|
## over a list of platforms. Specifically, the host platform of the previous
|
||||||
|
## stage becomes the build platform of the current one, and likewise the
|
||||||
|
## target platform of the previous stage becomes the host platform of the
|
||||||
|
## current one.
|
||||||
|
##
|
||||||
|
|
||||||
|
, # The platform on which packages are built. Consists of `system`, a
|
||||||
|
# string (e.g.,`i686-linux') identifying the most import attributes of the
|
||||||
|
# build platform, and `platform` a set of other details.
|
||||||
|
buildPlatform
|
||||||
|
|
||||||
|
, # The platform on which packages run.
|
||||||
|
hostPlatform
|
||||||
|
|
||||||
|
, # The platform which build tools (especially compilers) build for in this stage,
|
||||||
|
targetPlatform
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (targetPlatform) system;
|
|
||||||
|
|
||||||
ifDarwin = attrs: if system == "x86_64-darwin" then attrs else {};
|
|
||||||
|
|
||||||
defaultNativeBuildInputs = extraBuildInputs ++
|
defaultNativeBuildInputs = extraBuildInputs ++
|
||||||
[ ../../build-support/setup-hooks/move-docs.sh
|
[ ../../build-support/setup-hooks/move-docs.sh
|
||||||
../../build-support/setup-hooks/compress-man-pages.sh
|
../../build-support/setup-hooks/compress-man-pages.sh
|
||||||
@@ -37,7 +49,7 @@ let
|
|||||||
]
|
]
|
||||||
# FIXME this on Darwin; see
|
# FIXME this on Darwin; see
|
||||||
# https://github.com/NixOS/nixpkgs/commit/94d164dd7#commitcomment-22030369
|
# https://github.com/NixOS/nixpkgs/commit/94d164dd7#commitcomment-22030369
|
||||||
++ lib.optional result.isLinux ../../build-support/setup-hooks/audit-tmpdir.sh
|
++ lib.optional hostPlatform.isLinux ../../build-support/setup-hooks/audit-tmpdir.sh
|
||||||
++ [
|
++ [
|
||||||
../../build-support/setup-hooks/multiple-outputs.sh
|
../../build-support/setup-hooks/multiple-outputs.sh
|
||||||
../../build-support/setup-hooks/move-sbin.sh
|
../../build-support/setup-hooks/move-sbin.sh
|
||||||
@@ -46,157 +58,16 @@ let
|
|||||||
cc
|
cc
|
||||||
];
|
];
|
||||||
|
|
||||||
# `mkDerivation` wraps the builtin `derivation` function to
|
|
||||||
# produce derivations that use this stdenv and its shell.
|
|
||||||
#
|
|
||||||
# See also:
|
|
||||||
#
|
|
||||||
# * https://nixos.org/nixpkgs/manual/#sec-using-stdenv
|
|
||||||
# Details on how to use this mkDerivation function
|
|
||||||
#
|
|
||||||
# * https://nixos.org/nix/manual/#ssec-derivation
|
|
||||||
# Explanation about derivations in general
|
|
||||||
mkDerivation =
|
|
||||||
{ nativeBuildInputs ? []
|
|
||||||
, buildInputs ? []
|
|
||||||
|
|
||||||
, propagatedNativeBuildInputs ? []
|
|
||||||
, propagatedBuildInputs ? []
|
|
||||||
|
|
||||||
, crossConfig ? null
|
|
||||||
, meta ? {}
|
|
||||||
, passthru ? {}
|
|
||||||
, pos ? # position used in error messages and for meta.position
|
|
||||||
(if attrs.meta.description or null != null
|
|
||||||
then builtins.unsafeGetAttrPos "description" attrs.meta
|
|
||||||
else builtins.unsafeGetAttrPos "name" attrs)
|
|
||||||
, separateDebugInfo ? false
|
|
||||||
, outputs ? [ "out" ]
|
|
||||||
, __impureHostDeps ? []
|
|
||||||
, __propagatedImpureHostDeps ? []
|
|
||||||
, sandboxProfile ? ""
|
|
||||||
, propagatedSandboxProfile ? ""
|
|
||||||
, ... } @ attrs:
|
|
||||||
let
|
|
||||||
dependencies = [
|
|
||||||
(map (drv: drv.nativeDrv or drv) nativeBuildInputs)
|
|
||||||
(map (drv: drv.crossDrv or drv) buildInputs)
|
|
||||||
];
|
|
||||||
propagatedDependencies = [
|
|
||||||
(map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
|
|
||||||
(map (drv: drv.crossDrv or drv) propagatedBuildInputs)
|
|
||||||
];
|
|
||||||
in let
|
|
||||||
|
|
||||||
outputs' =
|
|
||||||
outputs ++
|
|
||||||
(if separateDebugInfo then assert targetPlatform.isLinux; [ "debug" ] else []);
|
|
||||||
|
|
||||||
dependencies' = let
|
|
||||||
justMap = map lib.chooseDevOutputs dependencies;
|
|
||||||
nativeBuildInputs = lib.elemAt justMap 0
|
|
||||||
++ lib.optional targetPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh;
|
|
||||||
buildInputs = lib.elemAt justMap 1
|
|
||||||
# TODO(@Ericson2314): Should instead also be appended to `nativeBuildInputs`.
|
|
||||||
++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh;
|
|
||||||
in [ nativeBuildInputs buildInputs ];
|
|
||||||
|
|
||||||
propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies;
|
|
||||||
|
|
||||||
derivationArg =
|
|
||||||
(removeAttrs attrs
|
|
||||||
["meta" "passthru" "crossAttrs" "pos"
|
|
||||||
"__impureHostDeps" "__propagatedImpureHostDeps"
|
|
||||||
"sandboxProfile" "propagatedSandboxProfile"])
|
|
||||||
// (let
|
|
||||||
# TODO(@Ericson2314): Reversing of dep lists is just temporary to avoid Darwin mass rebuild.
|
|
||||||
computedSandboxProfile =
|
|
||||||
lib.concatMap (input: input.__propagatedSandboxProfile or []) (extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies'));
|
|
||||||
computedPropagatedSandboxProfile =
|
|
||||||
lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists (lib.reverseList propagatedDependencies'));
|
|
||||||
computedImpureHostDeps =
|
|
||||||
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies')));
|
|
||||||
computedPropagatedImpureHostDeps =
|
|
||||||
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists (lib.reverseList propagatedDependencies')));
|
|
||||||
in
|
|
||||||
{
|
|
||||||
builder = attrs.realBuilder or shell;
|
|
||||||
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
|
|
||||||
stdenv = result;
|
|
||||||
system = result.system;
|
|
||||||
userHook = config.stdenv.userHook or null;
|
|
||||||
__ignoreNulls = true;
|
|
||||||
|
|
||||||
nativeBuildInputs = lib.elemAt dependencies' 0;
|
|
||||||
buildInputs = lib.elemAt dependencies' 1;
|
|
||||||
|
|
||||||
propagatedNativeBuildInputs = lib.elemAt propagatedDependencies' 0;
|
|
||||||
propagatedBuildInputs = lib.elemAt propagatedDependencies' 1;
|
|
||||||
} // ifDarwin {
|
|
||||||
# TODO: remove lib.unique once nix has a list canonicalization primitive
|
|
||||||
__sandboxProfile =
|
|
||||||
let profiles = [ extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ];
|
|
||||||
final = lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.unique profiles));
|
|
||||||
in final;
|
|
||||||
__propagatedSandboxProfile = lib.unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]);
|
|
||||||
__impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ __extraImpureHostDeps ++ [
|
|
||||||
"/dev/zero"
|
|
||||||
"/dev/random"
|
|
||||||
"/dev/urandom"
|
|
||||||
"/bin/sh"
|
|
||||||
];
|
|
||||||
__propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
|
|
||||||
} // (if outputs' != [ "out" ] then {
|
|
||||||
outputs = outputs';
|
|
||||||
} else { }));
|
|
||||||
|
|
||||||
# The meta attribute is passed in the resulting attribute set,
|
|
||||||
# but it's not part of the actual derivation, i.e., it's not
|
|
||||||
# passed to the builder and is not a dependency. But since we
|
|
||||||
# include it in the result, it *is* available to nix-env for queries.
|
|
||||||
meta = { }
|
|
||||||
# If the packager hasn't specified `outputsToInstall`, choose a default,
|
|
||||||
# which is the name of `p.bin or p.out or p`;
|
|
||||||
# if he has specified it, it will be overridden below in `// meta`.
|
|
||||||
# Note: This default probably shouldn't be globally configurable.
|
|
||||||
# Services and users should specify outputs explicitly,
|
|
||||||
# unless they are comfortable with this default.
|
|
||||||
// { outputsToInstall =
|
|
||||||
let
|
|
||||||
outs = outputs'; # the value passed to derivation primitive
|
|
||||||
hasOutput = out: builtins.elem out outs;
|
|
||||||
in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )];
|
|
||||||
}
|
|
||||||
// attrs.meta or {}
|
|
||||||
# Fill `meta.position` to identify the source location of the package.
|
|
||||||
// lib.optionalAttrs (pos != null)
|
|
||||||
{ position = pos.file + ":" + toString pos.line; }
|
|
||||||
;
|
|
||||||
|
|
||||||
in
|
|
||||||
|
|
||||||
lib.addPassthru
|
|
||||||
(derivation (import ./check-meta.nix
|
|
||||||
{
|
|
||||||
inherit lib config meta derivationArg;
|
|
||||||
mkDerivationArg = attrs;
|
|
||||||
inherit system; # TODO: cross-compilation?
|
|
||||||
}))
|
|
||||||
( {
|
|
||||||
overrideAttrs = f: mkDerivation (attrs // (f attrs));
|
|
||||||
inherit meta passthru;
|
|
||||||
} //
|
|
||||||
# Pass through extra attributes that are not inputs, but
|
|
||||||
# should be made available to Nix expressions using the
|
|
||||||
# derivation (e.g., in assertions).
|
|
||||||
passthru);
|
|
||||||
|
|
||||||
# The stdenv that we are producing.
|
# The stdenv that we are producing.
|
||||||
result =
|
stdenv =
|
||||||
derivation (
|
derivation (
|
||||||
(if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
|
(if isNull allowedRequisites then {} else { allowedRequisites = allowedRequisites ++ defaultNativeBuildInputs; }) //
|
||||||
{
|
{
|
||||||
inherit system name;
|
inherit name;
|
||||||
|
|
||||||
|
# Nix itself uses the `system` field of a derivation to decide where to
|
||||||
|
# build it. This is a bit confusing for cross compilation.
|
||||||
|
inherit (buildPlatform) system;
|
||||||
|
|
||||||
builder = shell;
|
builder = shell;
|
||||||
|
|
||||||
@@ -206,7 +77,7 @@ let
|
|||||||
|
|
||||||
inherit preHook initialPath shell defaultNativeBuildInputs;
|
inherit preHook initialPath shell defaultNativeBuildInputs;
|
||||||
}
|
}
|
||||||
// ifDarwin {
|
// lib.optionalAttrs buildPlatform.isDarwin {
|
||||||
__sandboxProfile = stdenvSandboxProfile;
|
__sandboxProfile = stdenvSandboxProfile;
|
||||||
__impureHostDeps = __stdenvImpureHostDeps;
|
__impureHostDeps = __stdenvImpureHostDeps;
|
||||||
})
|
})
|
||||||
@@ -218,6 +89,10 @@ let
|
|||||||
platforms = lib.platforms.all;
|
platforms = lib.platforms.all;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inherit buildPlatform hostPlatform targetPlatform;
|
||||||
|
|
||||||
|
inherit extraBuildInputs __extraImpureHostDeps extraSandboxProfile;
|
||||||
|
|
||||||
# Utility flags to test the type of platform.
|
# Utility flags to test the type of platform.
|
||||||
inherit (hostPlatform)
|
inherit (hostPlatform)
|
||||||
isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD
|
isDarwin isLinux isSunOS isHurd isCygwin isFreeBSD isOpenBSD
|
||||||
@@ -228,7 +103,9 @@ let
|
|||||||
# Whether we should run paxctl to pax-mark binaries.
|
# Whether we should run paxctl to pax-mark binaries.
|
||||||
needsPax = isLinux;
|
needsPax = isLinux;
|
||||||
|
|
||||||
inherit mkDerivation;
|
inherit (import ./make-derivation.nix {
|
||||||
|
inherit lib config stdenv;
|
||||||
|
}) mkDerivation;
|
||||||
|
|
||||||
# For convenience, bring in the library functions in lib/ so
|
# For convenience, bring in the library functions in lib/ so
|
||||||
# packages don't have to do that themselves.
|
# packages don't have to do that themselves.
|
||||||
@@ -247,4 +124,4 @@ let
|
|||||||
# like curl = if stdenv ? curl then stdenv.curl else ...).
|
# like curl = if stdenv ? curl then stdenv.curl else ...).
|
||||||
// extraAttrs;
|
// extraAttrs;
|
||||||
|
|
||||||
in result)
|
in stdenv)
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
{ lib, config, stdenv }:
|
||||||
|
|
||||||
|
rec {
|
||||||
|
# `mkDerivation` wraps the builtin `derivation` function to
|
||||||
|
# produce derivations that use this stdenv and its shell.
|
||||||
|
#
|
||||||
|
# See also:
|
||||||
|
#
|
||||||
|
# * https://nixos.org/nixpkgs/manual/#sec-using-stdenv
|
||||||
|
# Details on how to use this mkDerivation function
|
||||||
|
#
|
||||||
|
# * https://nixos.org/nix/manual/#ssec-derivation
|
||||||
|
# Explanation about derivations in general
|
||||||
|
mkDerivation =
|
||||||
|
{ nativeBuildInputs ? []
|
||||||
|
, buildInputs ? []
|
||||||
|
|
||||||
|
, propagatedNativeBuildInputs ? []
|
||||||
|
, propagatedBuildInputs ? []
|
||||||
|
|
||||||
|
, crossConfig ? null
|
||||||
|
, meta ? {}
|
||||||
|
, passthru ? {}
|
||||||
|
, pos ? # position used in error messages and for meta.position
|
||||||
|
(if attrs.meta.description or null != null
|
||||||
|
then builtins.unsafeGetAttrPos "description" attrs.meta
|
||||||
|
else builtins.unsafeGetAttrPos "name" attrs)
|
||||||
|
, separateDebugInfo ? false
|
||||||
|
, outputs ? [ "out" ]
|
||||||
|
, __impureHostDeps ? []
|
||||||
|
, __propagatedImpureHostDeps ? []
|
||||||
|
, sandboxProfile ? ""
|
||||||
|
, propagatedSandboxProfile ? ""
|
||||||
|
, ... } @ attrs:
|
||||||
|
let
|
||||||
|
dependencies = [
|
||||||
|
(map (drv: drv.nativeDrv or drv) nativeBuildInputs)
|
||||||
|
(map (drv: drv.crossDrv or drv) buildInputs)
|
||||||
|
];
|
||||||
|
propagatedDependencies = [
|
||||||
|
(map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
|
||||||
|
(map (drv: drv.crossDrv or drv) propagatedBuildInputs)
|
||||||
|
];
|
||||||
|
in let
|
||||||
|
|
||||||
|
outputs' =
|
||||||
|
outputs ++
|
||||||
|
(if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []);
|
||||||
|
|
||||||
|
dependencies' = let
|
||||||
|
justMap = map lib.chooseDevOutputs dependencies;
|
||||||
|
nativeBuildInputs = lib.elemAt justMap 0
|
||||||
|
++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh;
|
||||||
|
buildInputs = lib.elemAt justMap 1
|
||||||
|
# TODO(@Ericson2314): Should instead also be appended to `nativeBuildInputs`.
|
||||||
|
++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh;
|
||||||
|
in [ nativeBuildInputs buildInputs ];
|
||||||
|
|
||||||
|
propagatedDependencies' = map lib.chooseDevOutputs propagatedDependencies;
|
||||||
|
|
||||||
|
derivationArg =
|
||||||
|
(removeAttrs attrs
|
||||||
|
["meta" "passthru" "crossAttrs" "pos"
|
||||||
|
"__impureHostDeps" "__propagatedImpureHostDeps"
|
||||||
|
"sandboxProfile" "propagatedSandboxProfile"])
|
||||||
|
// (let
|
||||||
|
# TODO(@Ericson2314): Reversing of dep lists is just temporary to avoid Darwin mass rebuild.
|
||||||
|
computedSandboxProfile =
|
||||||
|
lib.concatMap (input: input.__propagatedSandboxProfile or []) (stdenv.extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies'));
|
||||||
|
computedPropagatedSandboxProfile =
|
||||||
|
lib.concatMap (input: input.__propagatedSandboxProfile or []) (lib.concatLists (lib.reverseList propagatedDependencies'));
|
||||||
|
computedImpureHostDeps =
|
||||||
|
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (stdenv.extraBuildInputs ++ lib.concatLists (lib.reverseList dependencies')));
|
||||||
|
computedPropagatedImpureHostDeps =
|
||||||
|
lib.unique (lib.concatMap (input: input.__propagatedImpureHostDeps or []) (lib.concatLists (lib.reverseList propagatedDependencies')));
|
||||||
|
in
|
||||||
|
{
|
||||||
|
builder = attrs.realBuilder or stdenv.shell;
|
||||||
|
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
|
||||||
|
inherit stdenv;
|
||||||
|
inherit (stdenv) system;
|
||||||
|
userHook = config.stdenv.userHook or null;
|
||||||
|
__ignoreNulls = true;
|
||||||
|
|
||||||
|
nativeBuildInputs = lib.elemAt dependencies' 0;
|
||||||
|
buildInputs = lib.elemAt dependencies' 1;
|
||||||
|
|
||||||
|
propagatedNativeBuildInputs = lib.elemAt propagatedDependencies' 0;
|
||||||
|
propagatedBuildInputs = lib.elemAt propagatedDependencies' 1;
|
||||||
|
} // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) {
|
||||||
|
# TODO: remove lib.unique once nix has a list canonicalization primitive
|
||||||
|
__sandboxProfile =
|
||||||
|
let profiles = [ stdenv.extraSandboxProfile ] ++ computedSandboxProfile ++ computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile sandboxProfile ];
|
||||||
|
final = lib.concatStringsSep "\n" (lib.filter (x: x != "") (lib.unique profiles));
|
||||||
|
in final;
|
||||||
|
__propagatedSandboxProfile = lib.unique (computedPropagatedSandboxProfile ++ [ propagatedSandboxProfile ]);
|
||||||
|
__impureHostDeps = computedImpureHostDeps ++ computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps ++ __impureHostDeps ++ stdenv.__extraImpureHostDeps ++ [
|
||||||
|
"/dev/zero"
|
||||||
|
"/dev/random"
|
||||||
|
"/dev/urandom"
|
||||||
|
"/bin/sh"
|
||||||
|
];
|
||||||
|
__propagatedImpureHostDeps = computedPropagatedImpureHostDeps ++ __propagatedImpureHostDeps;
|
||||||
|
} // (if outputs' != [ "out" ] then {
|
||||||
|
outputs = outputs';
|
||||||
|
} else { }));
|
||||||
|
|
||||||
|
# The meta attribute is passed in the resulting attribute set,
|
||||||
|
# but it's not part of the actual derivation, i.e., it's not
|
||||||
|
# passed to the builder and is not a dependency. But since we
|
||||||
|
# include it in the result, it *is* available to nix-env for queries.
|
||||||
|
meta = { }
|
||||||
|
# If the packager hasn't specified `outputsToInstall`, choose a default,
|
||||||
|
# which is the name of `p.bin or p.out or p`;
|
||||||
|
# if he has specified it, it will be overridden below in `// meta`.
|
||||||
|
# Note: This default probably shouldn't be globally configurable.
|
||||||
|
# Services and users should specify outputs explicitly,
|
||||||
|
# unless they are comfortable with this default.
|
||||||
|
// { outputsToInstall =
|
||||||
|
let
|
||||||
|
outs = outputs'; # the value passed to derivation primitive
|
||||||
|
hasOutput = out: builtins.elem out outs;
|
||||||
|
in [( lib.findFirst hasOutput null (["bin" "out"] ++ outs) )];
|
||||||
|
}
|
||||||
|
// attrs.meta or {}
|
||||||
|
# Fill `meta.position` to identify the source location of the package.
|
||||||
|
// lib.optionalAttrs (pos != null)
|
||||||
|
{ position = pos.file + ":" + toString pos.line; }
|
||||||
|
;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
lib.addPassthru
|
||||||
|
(derivation (import ./check-meta.nix
|
||||||
|
{
|
||||||
|
inherit lib config meta derivationArg;
|
||||||
|
mkDerivationArg = attrs;
|
||||||
|
# Nix itself uses the `system` field of a derivation to decide where
|
||||||
|
# to build it. This is a bit confusing for cross compilation.
|
||||||
|
inherit (stdenv) system;
|
||||||
|
}))
|
||||||
|
( {
|
||||||
|
overrideAttrs = f: mkDerivation (attrs // (f attrs));
|
||||||
|
inherit meta passthru;
|
||||||
|
} //
|
||||||
|
# Pass through extra attributes that are not inputs, but
|
||||||
|
# should be made available to Nix expressions using the
|
||||||
|
# derivation (e.g., in assertions).
|
||||||
|
passthru);
|
||||||
|
}
|
||||||
@@ -52,8 +52,11 @@ let
|
|||||||
let
|
let
|
||||||
|
|
||||||
thisStdenv = import ../generic {
|
thisStdenv = import ../generic {
|
||||||
inherit config extraBuildInputs;
|
|
||||||
name = "stdenv-linux-boot";
|
name = "stdenv-linux-boot";
|
||||||
|
buildPlatform = localSystem;
|
||||||
|
hostPlatform = localSystem;
|
||||||
|
targetPlatform = localSystem;
|
||||||
|
inherit config extraBuildInputs;
|
||||||
preHook =
|
preHook =
|
||||||
''
|
''
|
||||||
# Don't patch #!/interpreter because it leads to retained
|
# Don't patch #!/interpreter because it leads to retained
|
||||||
@@ -64,9 +67,6 @@ let
|
|||||||
shell = "${bootstrapTools}/bin/bash";
|
shell = "${bootstrapTools}/bin/bash";
|
||||||
initialPath = [bootstrapTools];
|
initialPath = [bootstrapTools];
|
||||||
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
|
|
||||||
fetchurlBoot = import ../../build-support/fetchurl/boot.nix {
|
fetchurlBoot = import ../../build-support/fetchurl/boot.nix {
|
||||||
inherit system;
|
inherit system;
|
||||||
};
|
};
|
||||||
@@ -76,8 +76,6 @@ let
|
|||||||
else lib.makeOverridable (import ../../build-support/cc-wrapper) {
|
else lib.makeOverridable (import ../../build-support/cc-wrapper) {
|
||||||
nativeTools = false;
|
nativeTools = false;
|
||||||
nativeLibc = false;
|
nativeLibc = false;
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
cc = prevStage.gcc-unwrapped;
|
cc = prevStage.gcc-unwrapped;
|
||||||
isGNU = true;
|
isGNU = true;
|
||||||
libc = prevStage.glibc;
|
libc = prevStage.glibc;
|
||||||
@@ -99,9 +97,6 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
stdenv = thisStdenv;
|
stdenv = thisStdenv;
|
||||||
};
|
};
|
||||||
@@ -241,8 +236,6 @@ in
|
|||||||
nativeTools = false;
|
nativeTools = false;
|
||||||
nativeLibc = false;
|
nativeLibc = false;
|
||||||
isGNU = true;
|
isGNU = true;
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
cc = prevStage.gcc-unwrapped;
|
cc = prevStage.gcc-unwrapped;
|
||||||
libc = self.glibc;
|
libc = self.glibc;
|
||||||
inherit (self) stdenv binutils coreutils gnugrep;
|
inherit (self) stdenv binutils coreutils gnugrep;
|
||||||
@@ -263,11 +256,11 @@ in
|
|||||||
# dependency (`nix-store -qR') on bootstrapTools or the first
|
# dependency (`nix-store -qR') on bootstrapTools or the first
|
||||||
# binutils built.
|
# binutils built.
|
||||||
(prevStage: {
|
(prevStage: {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
stdenv = import ../generic rec {
|
stdenv = import ../generic rec {
|
||||||
|
buildPlatform = localSystem;
|
||||||
|
hostPlatform = localSystem;
|
||||||
|
targetPlatform = localSystem;
|
||||||
inherit config;
|
inherit config;
|
||||||
|
|
||||||
preHook = ''
|
preHook = ''
|
||||||
@@ -280,9 +273,6 @@ in
|
|||||||
initialPath =
|
initialPath =
|
||||||
((import ../common-path.nix) {pkgs = prevStage;});
|
((import ../common-path.nix) {pkgs = prevStage;});
|
||||||
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
|
|
||||||
extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
|
extraBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
|
||||||
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
|
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
|
||||||
lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
|
lib.optional (system == "aarch64-linux") prevStage.updateAutotoolsGnuConfigScriptsHook;
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ let
|
|||||||
{ cc, fetchurl, extraPath ? [], overrides ? (self: super: { }) }:
|
{ cc, fetchurl, extraPath ? [], overrides ? (self: super: { }) }:
|
||||||
|
|
||||||
import ../generic {
|
import ../generic {
|
||||||
|
buildPlatform = localSystem;
|
||||||
hostPlatform = localSystem;
|
hostPlatform = localSystem;
|
||||||
targetPlatform = localSystem;
|
targetPlatform = localSystem;
|
||||||
|
|
||||||
@@ -125,8 +126,6 @@ in
|
|||||||
"i686-solaris" = "/usr/gnu";
|
"i686-solaris" = "/usr/gnu";
|
||||||
"x86_64-solaris" = "/opt/local/gcc47";
|
"x86_64-solaris" = "/opt/local/gcc47";
|
||||||
}.${system} or "/usr";
|
}.${system} or "/usr";
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit stdenv;
|
inherit stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -140,9 +139,6 @@ in
|
|||||||
|
|
||||||
# First build a stdenv based only on tools outside the store.
|
# First build a stdenv based only on tools outside the store.
|
||||||
(prevStage: {
|
(prevStage: {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
stdenv = makeStdenv {
|
stdenv = makeStdenv {
|
||||||
inherit (prevStage) cc fetchurl;
|
inherit (prevStage) cc fetchurl;
|
||||||
@@ -152,9 +148,6 @@ in
|
|||||||
# Using that, build a stdenv that adds the ‘xz’ command (which most systems
|
# Using that, build a stdenv that adds the ‘xz’ command (which most systems
|
||||||
# don't have, so we mustn't rely on the native environment providing it).
|
# don't have, so we mustn't rely on the native environment providing it).
|
||||||
(prevStage: {
|
(prevStage: {
|
||||||
buildPlatform = localSystem;
|
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
stdenv = makeStdenv {
|
stdenv = makeStdenv {
|
||||||
inherit (prevStage.stdenv) cc fetchurl;
|
inherit (prevStage.stdenv) cc fetchurl;
|
||||||
|
|||||||
@@ -10,10 +10,13 @@ bootStages ++ [
|
|||||||
(prevStage: let
|
(prevStage: let
|
||||||
inherit (prevStage) stdenv;
|
inherit (prevStage) stdenv;
|
||||||
in {
|
in {
|
||||||
inherit (prevStage) buildPlatform hostPlatform targetPlatform;
|
|
||||||
inherit config overlays;
|
inherit config overlays;
|
||||||
|
|
||||||
stdenv = import ../generic rec {
|
stdenv = import ../generic rec {
|
||||||
|
buildPlatform = localSystem;
|
||||||
|
hostPlatform = localSystem;
|
||||||
|
targetPlatform = localSystem;
|
||||||
|
|
||||||
inherit config;
|
inherit config;
|
||||||
|
|
||||||
preHook = ''
|
preHook = ''
|
||||||
@@ -30,8 +33,6 @@ bootStages ++ [
|
|||||||
nativeTools = false;
|
nativeTools = false;
|
||||||
nativePrefix = stdenv.lib.optionalString hostPlatform.isSunOS "/usr";
|
nativePrefix = stdenv.lib.optionalString hostPlatform.isSunOS "/usr";
|
||||||
nativeLibc = true;
|
nativeLibc = true;
|
||||||
hostPlatform = localSystem;
|
|
||||||
targetPlatform = localSystem;
|
|
||||||
inherit stdenv;
|
inherit stdenv;
|
||||||
inherit (prevStage) binutils coreutils gnugrep;
|
inherit (prevStage) binutils coreutils gnugrep;
|
||||||
cc = prevStage.gcc.cc;
|
cc = prevStage.gcc.cc;
|
||||||
|
|||||||
@@ -18,30 +18,6 @@
|
|||||||
, # Use to reevaluate Nixpkgs; a dirty hack that should be removed
|
, # Use to reevaluate Nixpkgs; a dirty hack that should be removed
|
||||||
nixpkgsFun
|
nixpkgsFun
|
||||||
|
|
||||||
## Platform parameters
|
|
||||||
##
|
|
||||||
## The "build" "host" "target" terminology below comes from GNU Autotools. See
|
|
||||||
## its documentation for more information on what those words mean. Note that
|
|
||||||
## each should always be defined, even when not cross compiling.
|
|
||||||
##
|
|
||||||
## For purposes of bootstrapping, think of each stage as a "sliding window"
|
|
||||||
## over a list of platforms. Specifically, the host platform of the previous
|
|
||||||
## stage becomes the build platform of the current one, and likewise the
|
|
||||||
## target platform of the previous stage becomes the host platform of the
|
|
||||||
## current one.
|
|
||||||
##
|
|
||||||
|
|
||||||
, # The platform on which packages are built. Consists of `system`, a
|
|
||||||
# string (e.g.,`i686-linux') identifying the most import attributes of the
|
|
||||||
# build platform, and `platform` a set of other details.
|
|
||||||
buildPlatform
|
|
||||||
|
|
||||||
, # The platform on which packages run.
|
|
||||||
hostPlatform
|
|
||||||
|
|
||||||
, # The platform which build tools (especially compilers) build for in this stage,
|
|
||||||
targetPlatform
|
|
||||||
|
|
||||||
## Other parameters
|
## Other parameters
|
||||||
##
|
##
|
||||||
|
|
||||||
@@ -69,10 +45,10 @@
|
|||||||
, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc
|
, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc
|
||||||
# outside of the store. Thus, GCC, GFortran, & co. must always look for files
|
# outside of the store. Thus, GCC, GFortran, & co. must always look for files
|
||||||
# in standard system directories (/usr/include, etc.)
|
# in standard system directories (/usr/include, etc.)
|
||||||
noSysDirs ? buildPlatform.system != "x86_64-freebsd"
|
noSysDirs ? stdenv.buildPlatform.system != "x86_64-freebsd"
|
||||||
&& buildPlatform.system != "i686-freebsd"
|
&& stdenv.buildPlatform.system != "i686-freebsd"
|
||||||
&& buildPlatform.system != "x86_64-solaris"
|
&& stdenv.buildPlatform.system != "x86_64-solaris"
|
||||||
&& buildPlatform.system != "x86_64-kfreebsd-gnu"
|
&& stdenv.buildPlatform.system != "x86_64-kfreebsd-gnu"
|
||||||
|
|
||||||
, # The configuration attribute set
|
, # The configuration attribute set
|
||||||
config
|
config
|
||||||
@@ -98,19 +74,18 @@ let
|
|||||||
// { recurseForDerivations = false; };
|
// { recurseForDerivations = false; };
|
||||||
__targetPackages = (if __targetPackages == null then self else __targetPackages)
|
__targetPackages = (if __targetPackages == null then self else __targetPackages)
|
||||||
// { recurseForDerivations = false; };
|
// { recurseForDerivations = false; };
|
||||||
inherit stdenv
|
inherit stdenv;
|
||||||
buildPlatform hostPlatform targetPlatform;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# The old identifiers for cross-compiling. These should eventually be removed,
|
# The old identifiers for cross-compiling. These should eventually be removed,
|
||||||
# and the packages that rely on them refactored accordingly.
|
# and the packages that rely on them refactored accordingly.
|
||||||
platformCompat = self: super: let
|
platformCompat = self: super: let
|
||||||
# TODO(@Ericson2314) this causes infinite recursion
|
inherit (super.stdenv) buildPlatform hostPlatform targetPlatform;
|
||||||
#inherit (self) buildPlatform hostPlatform targetPlatform;
|
|
||||||
in {
|
in {
|
||||||
stdenv = super.stdenv // {
|
stdenv = super.stdenv // {
|
||||||
inherit (buildPlatform) platform;
|
inherit (super.stdenv.buildPlatform) platform;
|
||||||
};
|
};
|
||||||
|
inherit buildPlatform hostPlatform targetPlatform;
|
||||||
inherit (buildPlatform) system platform;
|
inherit (buildPlatform) system platform;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user