about summary refs log tree commit diff
path: root/nixos/tests/nix-ld.nix
blob: c62c0437e04ec08059b7613d9aaa791f3a4cc972 (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()
    machine.succeed("hello")

    # test fallback if NIX_LD is not set
    machine.succeed("unset NIX_LD; unset NIX_LD_LIBRARY_PATH; hello")
 '';
})