add nixos and darwin-nix modules

This commit is contained in:
Abel Luck 2026-02-27 09:27:34 +01:00
parent eeb8a69740
commit ba34ac0d67
4 changed files with 129 additions and 12 deletions

29
nixos-test.nix Normal file
View file

@ -0,0 +1,29 @@
self: {
name = "nix-cache-login-nixos-module";
nodes.machine =
{ ... }:
{
imports = [ self.nixosModules.default ];
services.nix-cache-login.enable = true;
};
testScript = ''
machine.wait_for_unit("multi-user.target")
# The module should install timer and service unit files for all users
machine.succeed("test -f /etc/systemd/user/nix-cache-login.timer")
machine.succeed("test -f /etc/systemd/user/nix-cache-login.service")
# wantedBy = ["timers.target"] should create this symlink
machine.succeed(
"test -L /etc/systemd/user/timers.target.wants/nix-cache-login.timer"
)
# Service unit should reference the correct subcommand
unit = machine.succeed("cat /etc/systemd/user/nix-cache-login.service")
assert "nix-cache-login refresh" in unit, (
f"ExecStart not found in service unit:\n{unit}"
)
'';
}