2024-09-17 15:01:35 +02:00
|
|
|
{ config, ... }:
|
2020-12-12 09:29:40 +01:00
|
|
|
{
|
|
|
|
name = "nix-serve";
|
2022-03-21 00:15:30 +01:00
|
|
|
nodes.machine = { pkgs, ... }: {
|
2020-12-12 09:29:40 +01:00
|
|
|
services.nix-serve.enable = true;
|
|
|
|
environment.systemPackages = [
|
|
|
|
pkgs.hello
|
|
|
|
];
|
|
|
|
};
|
|
|
|
testScript = let
|
|
|
|
pkgHash = builtins.head (
|
2024-09-17 15:01:35 +02:00
|
|
|
builtins.match "${builtins.storeDir}/([^-]+).+" (toString config.node.pkgs.hello)
|
2020-12-12 09:29:40 +01:00
|
|
|
);
|
|
|
|
in ''
|
|
|
|
start_all()
|
|
|
|
machine.wait_for_unit("nix-serve.service")
|
|
|
|
machine.wait_for_open_port(5000)
|
|
|
|
machine.succeed(
|
|
|
|
"curl --fail -g http://0.0.0.0:5000/nar/${pkgHash}.nar -o /tmp/hello.nar"
|
|
|
|
)
|
|
|
|
'';
|
2024-09-17 15:01:35 +02:00
|
|
|
}
|