nix build -L .\#checks.x86_64-linux.test.driverInteractive
(or justnix run ...
and skip 2.)./result/bin/nixos-test-driver
start_all()
Last active
March 29, 2024 20:41
-
-
Save VTimofeenko/5b8779fb2afb6e1152d352f55f7b321c to your computer and use it in GitHub Desktop.
Flake to check home-manager stuff in a nixos test driver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
description = "Nixos config flake"; | |
inputs = { | |
nixpkgs.url = "nixpkgs/nixos-23.11"; | |
home-manager.url = "github:nix-community/home-manager/release-23.11"; | |
home-manager.inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
outputs = | |
inputs@{ self, nixpkgs, ... }: | |
let | |
system = "x86_64-linux"; | |
pkgs = import nixpkgs { inherit system; }; | |
in | |
{ | |
checks.${system}.test = pkgs.testers.runNixOSTest { | |
name = "test"; | |
node.specialArgs = { | |
inherit (self) inputs outputs; | |
}; | |
nodes.machine1 = | |
{ config, pkgs, ... }: | |
{ | |
services.getty.autologinUser = "alice"; | |
imports = [ inputs.home-manager.nixosModules.home-manager ]; | |
users.users.alice = { | |
isNormalUser = true; | |
password = "hunter2"; | |
}; | |
home-manager.extraSpecialArgs = { | |
inherit (self) inputs outputs; | |
}; | |
home-manager.users.alice = | |
{ config, ... }: # config is home-manager's config, not the OS one | |
{ | |
imports = [ ]; | |
home.stateVersion = "23.11"; | |
}; | |
}; | |
testScript = "start_all()"; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment