Skip to content

Commit

Permalink
nixos/ldso: avoid instance of nixpkgs (NixOS#288509)
Browse files Browse the repository at this point in the history
Follow-up to NixOS#269551

Avoid creating a new instance of nixpkgs to access two variables.
`pkgs.pkgsi686Linux` was being accessed whenever the feature is being
used or not.

A second instance of nixpkgs is being created in
`nixos/modules/config/stub-ld.nix` and can be disabled by setting
`environment.ldso32 = null` or `environment.stub-ld.enable = false`.

Both combined fixes this error:

    error: attribute 'i686-linux' missing
  • Loading branch information
zimbatm authored and tm-drtina committed Oct 30, 2024
1 parent af8f447 commit 68851ec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nixos/modules/config/ldso.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ let
libDir = pkgs.stdenv.hostPlatform.libDir;
ldsoBasename = builtins.unsafeDiscardStringContext (last (splitString "/" pkgs.stdenv.cc.bintools.dynamicLinker));

pkgs32 = pkgs.pkgsi686Linux;
libDir32 = pkgs32.stdenv.hostPlatform.libDir;
ldsoBasename32 = builtins.unsafeDiscardStringContext (last (splitString "/" pkgs32.stdenv.cc.bintools.dynamicLinker));
# Hard-code to avoid creating another instance of nixpkgs. Also avoids eval errors in some cases.
libDir32 = "lib"; # pkgs.pkgsi686Linux.stdenv.hostPlatform.libDir
ldsoBasename32 = "ld-linux.so.2"; # last (splitString "/" pkgs.pkgsi686Linux.stdenv.cc.bintools.dynamicLinker)
in {
options = {
environment.ldso = mkOption {
Expand Down

0 comments on commit 68851ec

Please sign in to comment.