nix
nix copied to clipboard
Statically built Nix doesn't install its libraries
trafficstars
Describe the bug
$ nix-build -A pkgsStatic.nix
$ ls result/lib
systemd tmpfiles.d
However, the still installed pkg-config files claim libraries are available:
$ nix-build -A pkgsStatic.nix.dev
$ cat result-dev/lib/pkgconfig/nix-main.pc
prefix=/nix/store/756yh330xipm9fdncislpp46cxfh33an-nix-static-x86_64-unknown-linux-musl-2.11.0
libdir=/nix/store/756yh330xipm9fdncislpp46cxfh33an-nix-static-x86_64-unknown-linux-musl-2.11.0/lib
includedir=/nix/store/sssclazqrxw13h362k5afq729160zqw3-nix-static-x86_64-unknown-linux-musl-2.11.0-dev/include
Name: Nix
Description: Nix Package Manager
Version: 2.11.0
Libs: -L${libdir} -lnixmain
Cflags: -I${includedir}/nix -std=c++17
I think the static archive should be installed when static linking for the benefit of the packages that link against Nix. In nixpkgs of course we should use a separate output for this, so we don't redundantly ship parts of Nix to users of just the executable.
See also https://github.com/NixOS/nixpkgs/issues/188401#issuecomment-1242671304.