tests: Add a test for the nixos module (#907)

This commit is contained in:
traxys 2024-01-06 17:53:31 +01:00 committed by GitHub
parent 7582a6e413
commit 245930d735
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 64 additions and 29 deletions

View file

@ -6,11 +6,13 @@
perSystem = { perSystem = {
pkgs, pkgs,
config, config,
system,
makeNixvimWithModuleUnfree, makeNixvimWithModuleUnfree,
makeNixvimWithModule, makeNixvimWithModule,
... ...
}: { }: {
checks = { checks =
{
tests = import ../tests { tests = import ../tests {
inherit pkgs; inherit pkgs;
inherit (pkgs) lib; inherit (pkgs) lib;
@ -32,13 +34,25 @@
inherit (pkgs) lib; inherit (pkgs) lib;
}; };
home-manager = home-manager-module =
(import ../tests/modules/hm.nix { (import ../tests/modules/hm.nix {
inherit pkgs; inherit pkgs;
inherit (inputs) home-manager; inherit (inputs) home-manager;
nixvim = self; nixvim = self;
}) })
.activationPackage; .activationPackage;
}
// pkgs.lib.optionalAttrs (!pkgs.stdenv.isDarwin) {
nixos-module =
(import ../tests/modules/nixos.nix {
inherit system;
inherit (inputs) nixpkgs;
nixvim = self;
})
.config
.system
.build
.toplevel;
}; };
}; };
} }

21
tests/modules/nixos.nix Normal file
View file

@ -0,0 +1,21 @@
{
nixvim,
nixpkgs,
system,
}:
nixpkgs.lib.nixosSystem {
inherit system;
modules = [
{
system.stateVersion = "23.11";
boot.loader.systemd-boot.enable = true;
fileSystems."/" = {device = "/non/existent/device";};
programs.nixvim = {
enable = true;
};
}
nixvim.nixosModules.nixvim
];
}