add homeManagerFlakeModule for declaring homeManager flake outputs

This commit is contained in:
ulic-youthlic 2025-03-13 20:11:08 +08:00
parent f7c4a7d830
commit 0ff80a7596
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
3 changed files with 11 additions and 8 deletions

View file

@ -41,8 +41,8 @@ Hey, you. This is my nixos configurations.
| `overlays.additions` | the ovelrays add packages in `<nixpkgs>` | ./overlays/additions | | `overlays.additions` | the ovelrays add packages in `<nixpkgs>` | ./overlays/additions |
| `nixosModules.default` | nixos modules shared on different nixos machines | ./nixos/modules | | `nixosModules.default` | nixos modules shared on different nixos machines | ./nixos/modules |
| `nixosConfigurations.${machine}` | machine-local nixos config | ./nixos/configurations/${machine} | | `nixosConfigurations.${machine}` | machine-local nixos config | ./nixos/configurations/${machine} |
| `homeManagerModules.default` | home-manager modules shared between different user and machine combinations | ./home/modules | | `homeModules.default` | home-manager modules shared between different user and machine combinations | ./home/modules |
| `homeManagerModules.extra` | home-manager modules only for non-nixos | ./home/extra | | `homeModules.extra` | home-manager modules only for non-nixos | ./home/extra |
| `homeManagerModules.${user}` | home-manager modules shared between different users | ./home/${user}/modules | | `homeModules.${user}` | home-manager modules shared between different users | ./home/${user}/modules |
| `homeConfigurations."${user}@${machine}"` | home-manager config for different user and machine combinations | ./home/${user}/configurations/${machine} | | `homeConfigurations."${user}@${machine}"` | home-manager config for different user and machine combinations | ./home/${user}/configurations/${machine} |
| `deploy.nodes.${machine}.system` | deploy-rs profile for deploying `nixosConfiguration.${machine}` remotely | - | | `deploy.nodes.${machine}.system` | deploy-rs profile for deploying `nixosConfiguration.${machine}` remotely | - |

View file

@ -181,6 +181,9 @@
in in
flake-parts.lib.mkFlake { inherit inputs; } { flake-parts.lib.mkFlake { inherit inputs; } {
systems = flake-utils.lib.defaultSystems; systems = flake-utils.lib.defaultSystems;
imports = [
inputs.home-manager.flakeModules.home-manager
];
perSystem = ( perSystem = (
{ pkgs, system, ... }@args: { pkgs, system, ... }@args:
{ {
@ -272,12 +275,12 @@
[ [
"${toString ./home}/${unixName}/configurations/${hostName}" "${toString ./home}/${unixName}/configurations/${hostName}"
] ]
++ (with outputs.homeManagerModules; [ ++ (with outputs.homeModules; [
default default
extra extra
]) ])
++ [ ++ [
outputs.homeManagerModules."${unixName}" outputs.homeModules."${unixName}"
]; ];
extraSpecialArgs = { extraSpecialArgs = {
inherit inherit
@ -304,7 +307,7 @@
hostName = "Cape"; hostName = "Cape";
unixName = "alice"; unixName = "alice";
}; };
homeManagerModules = homeModules =
{ {
default = import ./home/modules; default = import ./home/modules;
extra = import ./home/extra; extra = import ./home/extra;

View file

@ -47,7 +47,7 @@
{ ... }: { ... }:
{ {
imports = [ imports = [
outputs.homeManagerModules."${unixName}" outputs.homeModules."${unixName}"
(rootPath + "/home/${unixName}/configurations/${hostName}") (rootPath + "/home/${unixName}/configurations/${hostName}")
]; ];
} }
@ -58,7 +58,7 @@
inherit (pkgs) system; inherit (pkgs) system;
}; };
backupFileExtension = "backup"; backupFileExtension = "backup";
sharedModules = [ outputs.homeManagerModules.default ]; sharedModules = [ outputs.homeModules.default ];
}; };
}; };
} }