Skip to content

Commit

Permalink
tests: Add a test for the home-manager module
Browse files Browse the repository at this point in the history
  • Loading branch information
traxys committed Jan 6, 2024
1 parent 5574515 commit 8d1336b
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ jobs:
with:
name: nix-community
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: ./tests/modules/check.sh
12 changes: 12 additions & 0 deletions flake-modules/tests.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
inputs,
self,
...
}: {
perSystem = {
pkgs,
config,
Expand Down Expand Up @@ -27,6 +31,14 @@
inherit pkgs;
inherit (pkgs) lib;
};

home-manager =
(import ../tests/modules/hm.nix {
inherit pkgs;
inherit (inputs) home-manager;
nixvim = self;
})
.activationPackage;
};
};
}
21 changes: 21 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};

flake-parts = {
url = "github:hercules-ci/flake-parts";
Expand Down
2 changes: 2 additions & 0 deletions statix.toml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
ignore = ["plugins/lsp/language-servers/rust-analyzer-config.nix"]
# Frequent in nix module configurations
disabled = ["repeated_keys"]
24 changes: 24 additions & 0 deletions tests/modules/hm.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
nixvim,
pkgs,
home-manager,
}:
home-manager.lib.homeManagerConfiguration {
inherit pkgs;

modules = [
{
home.username = "nixvim";
home.homeDirectory = "/invalid/dir";

home.stateVersion = "23.05";

programs.nixvim = {
enable = true;
};

programs.home-manager.enable = true;
}
nixvim.homeManagerModules.nixvim
];
}

0 comments on commit 8d1336b

Please sign in to comment.