nixpkgs/nixos/tests/nix-ld.nix

40 lines
954 B
Nix
Raw Normal View History

2024-03-24 07:51:02 +00:00
{ system ? builtins.currentSystem,
config ? {},
pkgs ? import ../.. { inherit system config; }
}:
let
inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
shared =
{ config, 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 ${config.programs.nix-ld.package}/nix-support/ldpath)
'')
];
};
in
2022-03-15 12:22:18 +00:00
{
2024-03-24 07:51:02 +00:00
nix-ld = makeTest {
name = "nix-ld";
nodes.machine = shared;
testScript = ''
start_all()
machine.succeed("hello")
'';
2022-03-15 12:22:18 +00:00
};
2024-03-24 07:51:02 +00:00
nix-ld-rs = makeTest {
name = "nix-ld-rs";
nodes.machine = {
imports = [ shared ];
programs.nix-ld.package = pkgs.nix-ld-rs;
};
testScript = ''
start_all()
machine.succeed("hello")
'';
};
}