about summary refs log tree commit diff
path: root/nixos/tests/nix-ld.nix
blob: ae5297ab87eaa05f193b2b6c171e844839f71334 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import ./make-test-python.nix ({ lib, pkgs, ...} :
{
  name = "nix-ld";
  nodes.machine = { pkgs, ... }: {
    programs.nix-ld.enable = true;
    environment.systemPackages = [
      (pkgs.runCommand "patched-hello" {} ''
        install -D -m755 ${pkgs.hello}/bin/hello $out/bin/hello
        patchelf $out/bin/hello --set-interpreter $(cat ${pkgs.nix-ld}/nix-support/ldpath)
      '')
    ];
  };
  testScript = ''
    start_all()
    path = "${pkgs.stdenv.cc}/nix-support/dynamic-linker"
    with open(path) as f:
        real_ld = f.read().strip()
    machine.succeed(f"NIX_LD={real_ld} hello")
 '';
})