diff --git a/flake-modules/tests.nix b/flake-modules/tests.nix index 48b55865fc..f9db3edf00 100644 --- a/flake-modules/tests.nix +++ b/flake-modules/tests.nix @@ -1,4 +1,8 @@ { + inputs, + self, + ... +}: { perSystem = { pkgs, config, @@ -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; }; }; } diff --git a/flake.lock b/flake.lock index 45d81e4d75..f1bb2e71a5 100644 --- a/flake.lock +++ b/flake.lock @@ -75,6 +75,26 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704498488, + "narHash": "sha256-yINKdShHrtjdiJhov+q0s3Y3B830ujRoSbHduUNyKag=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "51e44a13acea71b36245e8bd8c7db53e0a3e61ee", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1704194953, @@ -120,6 +140,7 @@ "root": { "inputs": { "flake-parts": "flake-parts", + "home-manager": "home-manager", "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks" } diff --git a/flake.nix b/flake.nix index 5952856ad1..4cd4cafa31 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; diff --git a/statix.toml b/statix.toml index a7290782e6..e0c049b306 100644 --- a/statix.toml +++ b/statix.toml @@ -1 +1,3 @@ ignore = ["plugins/lsp/language-servers/rust-analyzer-config.nix"] +# Frequent in nix module configurations +disabled = ["repeated_keys"] diff --git a/tests/modules/hm.nix b/tests/modules/hm.nix new file mode 100644 index 0000000000..90c405fd9d --- /dev/null +++ b/tests/modules/hm.nix @@ -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 + ]; +}