botan3: fix selection of stdenv variant for static builds

Apparently with the move to by-name broke stdenv selection in such a way
that the resulting library archive from `pkgsStatic.botan3` no longer
was suitable for static linking, resulting in linking errors:

```
/nix/store/<...>-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: cannot find -lbz2: No such file
/nix/store/<...>-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: have you installed the static ve
/nix/store/<...>-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: cannot find -ljitterentropy: No
/nix/store/<...>-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: have you installed the static ve
/nix/store/<...>-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: cannot find -lz: No such file or
/nix/store/<...>-x86_64-unknown-linux-musl-binutils-2.44/bin/x86_64-unknown-linux-musl-ld: have you installed the static ve
```

Co-authored-by: Maximilian Bosch <maximilian@mbosch.me>
This commit is contained in:
WilliButz
2025-11-03 13:50:24 +01:00
parent 2e98a05fca
commit fc3665f74a
+4 -6
View File
@@ -1,7 +1,7 @@
{
lib,
stdenv,
buildPackages,
libcxxStdenv,
fetchurl,
pkgsStatic,
python3,
@@ -9,7 +9,6 @@
bzip2,
zlib,
jitterentropy,
darwin,
esdm,
tpm2-tss,
static ? stdenv.hostPlatform.isStatic, # generates static libraries *only*
@@ -20,7 +19,7 @@
# useful, but have to disable tests for now, as /dev/tpmrm0 is not accessible
withTpm2 ? false,
policy ? null,
}:
}@args:
assert lib.assertOneOf "policy" policy [
# no explicit policy is given. The defaults by the library are used
@@ -32,11 +31,10 @@ assert lib.assertOneOf "policy" policy [
# only allow "modern" algorithms
"modern"
];
let
stdenv' = if static then buildPackages.libcxxStdenv else stdenv;
stdenv = if static then libcxxStdenv else args.stdenv;
in
stdenv'.mkDerivation (finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
version = "3.9.0";
pname = "botan";