You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following expression, where we apply an overlay that uses an older NixOS release's glibc with newer nixpkgs (the motivation for such an overlay might be building DSOs that may be linked and loaded on some other Linux distribution).
Based on https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/linux/default.nix, I'd expect to get a working stdenv with the older glibc (assuming that glibc 2.27 works with current master's toolchain, and it happens to for the revs I've chosen) and I do, until I get to the allowedRequisites check
$ nix-build ./repro.nix -A hello
...
building '/nix/store/n28xd4xq6f11lcbc1ir5lszc2bfj4n23-stdenv-linux.drv'...
output '/nix/store/cmk1rwz6raj480fqvv7rvxcabdmqh9k6-stdenv-linux' is not allowed to refer to the following paths:
/nix/store/b3vajivl1gvq1c2p1x62672sqg8f983l-linux-headers-4.19.16
Initially one might try to fix this by getting linuxHeaders from the older nixpkgs too:
However, this doesn't work, because pkgs.linuxHeaders is somehow not the same linuxHeaders that's passed as input to glibc:
Welcome to Nix version 2.3.16. Type :? for help.
nix-repl> pkgs = import ./repro.nix
nix-repl> pkgs.linuxHeaders
«derivation /nix/store/n3vbnnrggh7prji14g1g2iizdjh06afq-linux-headers-4.19.16.drv»
nix-repl> pkgs.glibc.buildInputs
[ «derivation /nix/store/z0bf9m7i2228smqc97akym9ps6a0jrd7-linux-headers-4.19.16.drv» ]
The way allowedRequisites is computed in stdenv-linux suggests that stdenv needs to be given the same linuxHeaders that was used to build glibc, so this (totally cursed) overlay actually works:
If stdenv must be passed the same linuxHeaders that's passed to glibc (and I assume that linuxHeaders that's different from top-level pkgs.linuxHeaders comes from inside the bootstrap machinery somewhere), shouldn't it grab it from glibc somehow (hopefully through a passthru and not the abomination builtins.head glibc.buildInputs?
The most likely answer: I've misunderstood something about how stdenvOverrides/the stdenv bootstrapping business works.
The text was updated successfully, but these errors were encountered:
You can use linuxHeaders = glibc.linuxHeaders; instead of linuxHeaders = builtins.head glibc.buildInputs;. However, when I try this I get the following error:
Consider the following expression, where we apply an overlay that uses an older NixOS release's glibc with newer nixpkgs (the motivation for such an overlay might be building DSOs that may be linked and loaded on some other Linux distribution).
Based on https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/linux/default.nix, I'd expect to get a working stdenv with the older glibc (assuming that glibc 2.27 works with current master's toolchain, and it happens to for the revs I've chosen) and I do, until I get to the allowedRequisites check
Initially one might try to fix this by getting linuxHeaders from the older nixpkgs too:
However, this doesn't work, because pkgs.linuxHeaders is somehow not the same linuxHeaders that's passed as input to glibc:
The way allowedRequisites is computed in stdenv-linux suggests that stdenv needs to be given the same linuxHeaders that was used to build glibc, so this (totally cursed) overlay actually works:
So it seems to me, one of these must be true:
pkgs.linuxHeaders
comes from inside the bootstrap machinery somewhere), shouldn't it grab it from glibc somehow (hopefully through a passthru and not the abominationbuiltins.head glibc.buildInputs
?The text was updated successfully, but these errors were encountered: