Skip to content

Commit

Permalink
tests: Add a test for the nixos module (#907)
Browse files Browse the repository at this point in the history
  • Loading branch information
traxys authored Jan 6, 2024
1 parent 7582a6e commit 245930d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 26 deletions.
66 changes: 40 additions & 26 deletions flake-modules/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,53 @@
perSystem = {
pkgs,
config,
system,
makeNixvimWithModuleUnfree,
makeNixvimWithModule,
...
}: {
checks = {
tests = import ../tests {
inherit pkgs;
inherit (pkgs) lib;
makeNixvim = configuration:
makeNixvimWithModuleUnfree {
module = {
config = configuration;
checks =
{
tests = import ../tests {
inherit pkgs;
inherit (pkgs) lib;
makeNixvim = configuration:
makeNixvimWithModuleUnfree {
module = {
config = configuration;
};
};
};
};

extra-args-tests = import ../tests/extra-args.nix {
inherit pkgs;
inherit makeNixvimWithModule;
};
};

lib-tests = import ../tests/lib-tests.nix {
inherit pkgs;
inherit (pkgs) lib;
};
extra-args-tests = import ../tests/extra-args.nix {
inherit pkgs;
inherit makeNixvimWithModule;
};

home-manager =
(import ../tests/modules/hm.nix {
lib-tests = import ../tests/lib-tests.nix {
inherit pkgs;
inherit (inputs) home-manager;
nixvim = self;
})
.activationPackage;
};
inherit (pkgs) lib;
};

home-manager-module =
(import ../tests/modules/hm.nix {
inherit pkgs;
inherit (inputs) home-manager;
nixvim = self;
})
.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 changes: 21 additions & 0 deletions tests/modules/nixos.nix
Original file line number Diff line number Diff line change
@@ -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
];
}

0 comments on commit 245930d

Please sign in to comment.