forked from Bos55/nix-config
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:
parent
5a031b48ed
commit
8fb651fd60
15 changed files with 290 additions and 51 deletions
29
test/vm-test.nix
Normal file
29
test/vm-test.nix
Normal 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")
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue