refactor: optimize flake.nix and modularize networking config

Cleaner deploy.nodes generation, improved devShell experience, and centralized host IP definitions.
This commit is contained in:
Tibo De Peuter 2026-03-17 18:24:17 +01:00
parent 5a031b48ed
commit 8fb651fd60
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
15 changed files with 290 additions and 51 deletions

29
test/vm-test.nix Normal file
View file

@ -0,0 +1,29 @@
{ self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
pkgs.nixosTest {
name = "deploy-user-test";
nodes = {
machine = { ... }: {
imports = [
../modules
../users
];
homelab.users.deploy.enable = true;
system.stateVersion = "24.11"; # Match the current nixpkgs version
};
};
testScript = ''
machine.wait_for_unit("multi-user.target")
# Verify user exists
machine.succeed("id deploy")
# Verify we can run nix-env as deploy via sudo
machine.succeed("sudo -u deploy -n nix-env --version")
# Verify switch-to-configuration is accessible (it's added to path by the module)
machine.succeed("whereis switch-to-configuration")
'';
}