Merge pull request #119317 from sternenseemann/static-naming

stdenv.mkDerivation: add -static to name if building statically

authored by Domen Kožar and committed by GitHub e002b635 60262e6c

+22 -15
+15 -9
pkgs/stdenv/generic/make-derivation.nix
··· 193 "__darwinAllowLocalNetworking" 194 "__impureHostDeps" "__propagatedImpureHostDeps" 195 "sandboxProfile" "propagatedSandboxProfile"]) 196 - // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) { 197 - name = "${attrs.pname}-${attrs.version}"; 198 - } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) { 199 - # Fixed-output derivations like source tarballs shouldn't get a host 200 - # suffix. But we have some weird ones with run-time deps that are 201 - # just used for their side-affects. Those might as well since the 202 - # hash can't be the same. See #32986. 203 - name = "${attrs.name or "${attrs.pname}-${attrs.version}"}-${stdenv.hostPlatform.config}"; 204 - } // { 205 builder = attrs.realBuilder or stdenv.shell; 206 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; 207 inherit stdenv;
··· 193 "__darwinAllowLocalNetworking" 194 "__impureHostDeps" "__propagatedImpureHostDeps" 195 "sandboxProfile" "propagatedSandboxProfile"]) 196 + // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) { 197 + name = 198 + let 199 + staticMarker = lib.optionalString stdenv.hostPlatform.isStatic "-static"; 200 + name' = attrs.name or 201 + "${attrs.pname}${staticMarker}-${attrs.version}"; 202 + # Fixed-output derivations like source tarballs shouldn't get a host 203 + # suffix. But we have some weird ones with run-time deps that are 204 + # just used for their side-affects. Those might as well since the 205 + # hash can't be the same. See #32986. 206 + hostSuffix = lib.optionalString 207 + (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix) 208 + "-${stdenv.hostPlatform.config}"; 209 + in name' + hostSuffix; 210 + }) // { 211 builder = attrs.realBuilder or stdenv.shell; 212 args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)]; 213 inherit stdenv;
+7 -6
pkgs/tools/package-management/nix/default.nix
··· 24 , withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp 25 , withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin), aws-sdk-cpp 26 , enableStatic ? stdenv.hostPlatform.isStatic 27 - , name, suffix ? "", src 28 , patches ? [ ] 29 }: 30 let 31 sh = busybox-sandbox-shell; 32 nix = stdenv.mkDerivation rec { 33 - inherit name src patches; 34 - version = lib.getVersion name; 35 36 is24 = lib.versionAtLeast version "2.4pre"; 37 ··· 196 nix = nixStable; 197 198 nixStable = callPackage common (rec { 199 - name = "nix-2.3.10"; 200 src = fetchurl { 201 - url = "https://nixos.org/releases/nix/${name}/${name}.tar.xz"; 202 sha256 = "a8a85e55de43d017abbf13036edfb58674ca136691582f17080c1cd12787b7ab"; 203 }; 204 ··· 213 }); 214 215 nixUnstable = lib.lowPrio (callPackage common rec { 216 - name = "nix-2.4${suffix}"; 217 suffix = "pre20210326_dd77f71"; 218 219 src = fetchFromGitHub {
··· 24 , withLibseccomp ? lib.any (lib.meta.platformMatch stdenv.hostPlatform) libseccomp.meta.platforms, libseccomp 25 , withAWS ? !enableStatic && (stdenv.isLinux || stdenv.isDarwin), aws-sdk-cpp 26 , enableStatic ? stdenv.hostPlatform.isStatic 27 + , pname, version, suffix ? "", src 28 , patches ? [ ] 29 }: 30 let 31 sh = busybox-sandbox-shell; 32 nix = stdenv.mkDerivation rec { 33 + inherit pname version src patches; 34 35 is24 = lib.versionAtLeast version "2.4pre"; 36 ··· 195 nix = nixStable; 196 197 nixStable = callPackage common (rec { 198 + pname = "nix"; 199 + version = "2.3.10"; 200 src = fetchurl { 201 + url = "https://nixos.org/releases/nix/${pname}-${version}/${pname}-${version}.tar.xz"; 202 sha256 = "a8a85e55de43d017abbf13036edfb58674ca136691582f17080c1cd12787b7ab"; 203 }; 204 ··· 213 }); 214 215 nixUnstable = lib.lowPrio (callPackage common rec { 216 + pname = "nix"; 217 + version = "2.4${suffix}"; 218 suffix = "pre20210326_dd77f71"; 219 220 src = fetchFromGitHub {