diff options
Diffstat (limited to 'nixpkgs/pkgs/stdenv/generic')
-rw-r--r-- | nixpkgs/pkgs/stdenv/generic/check-meta.nix | 13 | ||||
-rw-r--r-- | nixpkgs/pkgs/stdenv/generic/default.nix | 11 | ||||
-rw-r--r-- | nixpkgs/pkgs/stdenv/generic/make-derivation.nix | 47 | ||||
-rw-r--r-- | nixpkgs/pkgs/stdenv/generic/setup.sh | 11 |
4 files changed, 58 insertions, 24 deletions
diff --git a/nixpkgs/pkgs/stdenv/generic/check-meta.nix b/nixpkgs/pkgs/stdenv/generic/check-meta.nix index 21ae809a222..c06f17b6fc1 100644 --- a/nixpkgs/pkgs/stdenv/generic/check-meta.nix +++ b/nixpkgs/pkgs/stdenv/generic/check-meta.nix @@ -108,7 +108,12 @@ let You can install it anyway by whitelisting this package, using the following methods: - a) for `nixos-rebuild` you can add ‘${getName attrs}’ to + a) To temporarily allow all insecure packages, you can use an environment + variable for a single invocation of the nix tools: + + $ export NIXPKGS_ALLOW_INSECURE=1 + + b) for `nixos-rebuild` you can add ‘${getName attrs}’ to `nixpkgs.config.permittedInsecurePackages` in the configuration.nix, like so: @@ -118,9 +123,9 @@ let ]; } - b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add - ‘${getName attrs}’ to `permittedInsecurePackages` in - ~/.config/nixpkgs/config.nix, like so: + c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add + ‘${getName attrs}’ to `permittedInsecurePackages` in + ~/.config/nixpkgs/config.nix, like so: { permittedInsecurePackages = [ diff --git a/nixpkgs/pkgs/stdenv/generic/default.nix b/nixpkgs/pkgs/stdenv/generic/default.nix index 77d70e84258..b5798978690 100644 --- a/nixpkgs/pkgs/stdenv/generic/default.nix +++ b/nixpkgs/pkgs/stdenv/generic/default.nix @@ -98,7 +98,7 @@ let # TODO: This really wants to be in stdenv/darwin but we don't have hostPlatform # there (yet?) so it goes here until then. preHook = preHook+ lib.optionalString buildPlatform.isDarwin '' - export NIX_BUILD_DONT_SET_RPATH=1 + export NIX_DONT_SET_RPATH_FOR_BUILD=1 '' + lib.optionalString (hostPlatform.isDarwin || (hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.elf && hostPlatform.parsed.kernel.execFormat != lib.systems.parse.execFormats.macho)) '' export NIX_DONT_SET_RPATH=1 export NIX_NO_SELF_RPATH=1 @@ -107,7 +107,7 @@ let # think the best solution would just be to fixup linux RPATHs so we don't # need to set `-rpath` anywhere. # + lib.optionalString targetPlatform.isDarwin '' - # export NIX_TARGET_DONT_SET_RPATH=1 + # export NIX_DONT_SET_RPATH_FOR_TARGET=1 # '' ; @@ -138,8 +138,11 @@ let is32bit is64bit isAarch32 isAarch64 isMips isBigEndian; - # The derivation's `system` is `buildPlatform.system`. - inherit (buildPlatform) system; + # Override `system` so that packages can get the system of the host + # platform through `stdenv.system`. `system` is originally set to the + # build platform within the derivation above so that Nix directs the build + # to correct type of machine. + inherit (hostPlatform) system; inherit (import ./make-derivation.nix { inherit lib config stdenv; diff --git a/nixpkgs/pkgs/stdenv/generic/make-derivation.nix b/nixpkgs/pkgs/stdenv/generic/make-derivation.nix index 09879451d8e..491951e6121 100644 --- a/nixpkgs/pkgs/stdenv/generic/make-derivation.nix +++ b/nixpkgs/pkgs/stdenv/generic/make-derivation.nix @@ -247,7 +247,8 @@ in rec { (/**/ if lib.isString cmakeFlags then [cmakeFlags] else if cmakeFlags == null then [] else cmakeFlags) - ++ [ "-DCMAKE_SYSTEM_NAME=${lib.findFirst lib.isString "Generic" [ stdenv.hostPlatform.uname.system ]}" ] + ++ [ "-DCMAKE_SYSTEM_NAME=${lib.findFirst lib.isString "Generic" ( + lib.optional (!stdenv.hostPlatform.isRedox) stdenv.hostPlatform.uname.system)}"] ++ lib.optional (stdenv.hostPlatform.uname.processor != null) "-DCMAKE_SYSTEM_PROCESSOR=${stdenv.hostPlatform.uname.processor}" ++ lib.optional (stdenv.hostPlatform.uname.release != null) "-DCMAKE_SYSTEM_VERSION=${stdenv.hostPlatform.release}" ++ lib.optional (stdenv.buildPlatform.uname.system != null) "-DCMAKE_HOST_SYSTEM_NAME=${stdenv.buildPlatform.uname.system}" @@ -262,7 +263,7 @@ in rec { else if isx86_32 then "x86" else if isx86_64 then "x86_64" else platform.parsed.cpu.family + builtins.toString platform.parsed.cpu.bits; - crossFile = builtins.toFile "cross-file.conf" ('' + crossFile = builtins.toFile "cross-file.conf" '' [properties] needs_exe_wrapper = true @@ -271,13 +272,7 @@ in rec { cpu_family = '${cpuFamily stdenv.targetPlatform}' cpu = '${stdenv.targetPlatform.parsed.cpu.name}' endian = ${if stdenv.targetPlatform.isLittleEndian then "'little'" else "'big'"} - '' - # TODO should have target prefix too, issue #86077 - + '' - - [binaries] - pkgconfig = 'pkg-config' - ''); + ''; in [ "--cross-file=${crossFile}" ] ++ mesonFlags; } // lib.optionalAttrs (attrs.enableParallelBuilding or false) { enableParallelChecking = attrs.enableParallelChecking or true; @@ -314,8 +309,12 @@ in rec { name = attrs.name or "${attrs.pname}-${attrs.version}"; # 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`. + # which is the name of `p.bin or p.out or p` along with `p.man` when + # present. + # + # If the packager 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. @@ -343,6 +342,32 @@ in rec { validity.handled ({ overrideAttrs = f: mkDerivation (attrs // (f attrs)); + + # A derivation that always builds successfully and whose runtime + # dependencies are the original derivations build time dependencies + # This allows easy building and distributing of all derivations + # needed to enter a nix-shell with + # nix-build shell.nix -A inputDerivation + inputDerivation = derivation (derivationArg // { + # Add a name in case the original drv didn't have one + name = derivationArg.name or "inputDerivation"; + # This always only has one output + outputs = [ "out" ]; + + # Propagate the original builder and arguments, since we override + # them and they might contain references to build inputs + _derivation_original_builder = derivationArg.builder; + _derivation_original_args = derivationArg.args; + + builder = stdenv.shell; + # The bash builtin `export` dumps all current environment variables, + # which is where all build input references end up (e.g. $PATH for + # binaries). By writing this to $out, Nix can find and register + # them as runtime dependencies (since Nix greps for store paths + # through $out to find them) + args = [ "-c" "export > $out" ]; + }); + inherit meta passthru; } // # Pass through extra attributes that are not inputs, but diff --git a/nixpkgs/pkgs/stdenv/generic/setup.sh b/nixpkgs/pkgs/stdenv/generic/setup.sh index 839757945a2..d19ed342aab 100644 --- a/nixpkgs/pkgs/stdenv/generic/setup.sh +++ b/nixpkgs/pkgs/stdenv/generic/setup.sh @@ -219,12 +219,13 @@ printWords() { # Initialisation. -# Set a fallback default value for SOURCE_DATE_EPOCH, used by some -# build tools to provide a deterministic substitute for the "current" -# time. Note that 1 = 1970-01-01 00:00:01. We don't use 0 because it -# confuses some applications. +# Set a fallback default value for SOURCE_DATE_EPOCH, used by some build tools +# to provide a deterministic substitute for the "current" time. Note that +# 315532800 = 1980-01-01 12:00:00. We use this date because python's wheel +# implementation uses zip archive and zip does not support dates going back to +# 1970. export SOURCE_DATE_EPOCH -: ${SOURCE_DATE_EPOCH:=1} +: ${SOURCE_DATE_EPOCH:=315532800} # Wildcard expansions that don't match should expand to an empty list. |