about summary refs log tree commit diff
path: root/nixos/tests/nix-ld.nix
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2022-03-15 13:22:18 +0100
committerJörg Thalheim <joerg@thalheim.io>2022-03-21 11:15:32 +0100
commita98ea7e6f8743863aa51385c942ad482ea598707 (patch)
treedccb410fb3363538dbe976f22588caf8222d7ba9 /nixos/tests/nix-ld.nix
parent9c0dd184928e48d66a50291a7e0ee394029166ed (diff)
nix-ld: init at 1.0.0 + nixos module
Diffstat (limited to 'nixos/tests/nix-ld.nix')
-rw-r--r--nixos/tests/nix-ld.nix20
1 files changed, 20 insertions, 0 deletions
diff --git a/nixos/tests/nix-ld.nix b/nixos/tests/nix-ld.nix
new file mode 100644
index 0000000000000..5c886182d9694
--- /dev/null
+++ b/nixos/tests/nix-ld.nix
@@ -0,0 +1,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 ${pkgs.nix-ld.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")
+ '';
+})