My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/nixos/tests/nix-serve.nix

22 lines
565 B

import ./make-test-python.nix ({ pkgs, ... }:
{
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 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"
)
'';
})