Skip to content

Commit ae7bc5f

Browse files
authored
Merge pull request #12297 from NixOS/fix-static
Fix static build of nix
2 parents 4adb579 + 809f157 commit ae7bc5f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packaging/dependencies.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ let
7575
# Users who are debugging Nix builds are expected to set the environment variable `mesonBuildType`, per the
7676
# guidance in https://github.com/NixOS/nix/blob/8a3fc27f1b63a08ac983ee46435a56cf49ebaf4a/doc/manual/source/development/debugging.md?plain=1#L10.
7777
# For this reason, we don't want to refer to `finalAttrs.mesonBuildType` here, but rather use the environment variable.
78-
preConfigure = prevAttrs.preConfigure or "" + lib.optionalString (!stdenv.hostPlatform.isWindows) ''
78+
preConfigure = prevAttrs.preConfigure or "" + lib.optionalString (
79+
!stdenv.hostPlatform.isWindows
80+
# build failure
81+
&& !stdenv.hostPlatform.isStatic
82+
) ''
7983
case "$mesonBuildType" in
8084
release|minsize) appendToVar mesonFlags "-Db_lto=true" ;;
8185
*) appendToVar mesonFlags "-Db_lto=false" ;;

packaging/everything.nix

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ let
6161
nix-store-c
6262
nix-util
6363
nix-util-c
64+
] ++ lib.optionals (!stdenv.hostPlatform.isStatic) [
65+
# Currently fails in static build
6466
nix-perl-bindings
6567
];
6668
installPhase = ''
@@ -131,14 +133,16 @@ in
131133
# (checkInputs must be empty paths??)
132134
(runCommand "check-pkg-config" { checked = dev.tests.pkg-config; } "mkdir $out")
133135
] ++
136+
lib.optionals (!stdenv.hostPlatform.isStatic) (
137+
# Perl currently fails in static build
134138
(if stdenv.buildPlatform.canExecute stdenv.hostPlatform
135139
then [
136140
# TODO: add perl.tests
137141
nix-perl-bindings
138142
]
139143
else [
140144
nix-perl-bindings
141-
]);
145+
]));
142146
installCheckInputs = [
143147
nix-functional-tests
144148
];

0 commit comments

Comments
 (0)