nixpkgs/nixos/tests/nix-serve.nix
Robert Hensing 30620e7736 nixosTests.nix-serve: Use new entrypoint
This reuses the `pkgs`, so that `pkgs.nixosTests.nix-serve` will
run with the overlays of `pkgs` applied.
2024-09-18 13:42:35 +02:00

23 lines
547 B
Nix

{ config, ... }:
{
name = "nix-serve";
nodes.machine = { pkgs, ... }: {
services.nix-serve.enable = true;
environment.systemPackages = [
pkgs.hello
];
};
testScript = let
pkgHash = builtins.head (
builtins.match "${builtins.storeDir}/([^-]+).+" (toString config.node.pkgs.hello)
);
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"
)
'';
}