mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 04:19:19 -08:00
feat: home-manager?
This commit is contained in:
parent
b4b8f5988f
commit
672ffc38cc
8 changed files with 74 additions and 44 deletions
|
|
@ -8,9 +8,9 @@
|
|||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf mkOptionDefault;
|
||||
inherit (lib.modules) mkIf mkOptionDefault mkMerge;
|
||||
inherit (lib.trivial) mapNullable;
|
||||
inherit (std) string;
|
||||
inherit (std) string set;
|
||||
in {
|
||||
options = let
|
||||
inherit (lib.types) str listOf attrs unspecified enum;
|
||||
|
|
@ -78,15 +78,19 @@ in {
|
|||
home = "home";
|
||||
}
|
||||
.${string.toLower config.type};
|
||||
modules = with tree; mkIf (config.folder != "linux") [
|
||||
# per-OS modules
|
||||
modules.${config.folder}
|
||||
# per-OS configuration
|
||||
tree.${config.folder}.common
|
||||
# per-OS user definition
|
||||
home.user.${config.folder}
|
||||
# true base module
|
||||
common
|
||||
modules = mkMerge [
|
||||
(mkIf (config.folder != "linux") [
|
||||
# per-OS modules
|
||||
tree.modules.${config.folder}
|
||||
# per-OS user definition
|
||||
tree.home.user.${config.folder}
|
||||
])
|
||||
(mkIf (config.folder != "linux" && config.folder != "home") [
|
||||
# per-OS configuration
|
||||
tree.${config.folder}.common
|
||||
# true base module
|
||||
tree.common
|
||||
])
|
||||
];
|
||||
builder =
|
||||
{
|
||||
|
|
@ -114,7 +118,12 @@ in {
|
|||
];
|
||||
specialArgs = {prev = nixos;};
|
||||
};
|
||||
home = args: inputs.home-manager.lib.homeManagerConfiguration (args // { inherit pkgs; });
|
||||
home = args: let
|
||||
renamedArgs = set.rename "specialArgs" "extraSpecialArgs" args;
|
||||
renamedArgsWithPkgs = renamedArgs // { inherit lib; pkgs = pkgs.${args.system}; };
|
||||
attrsToRemove = [ "configuration" "username" "homeDirectory" "stateVersion" "extraModules" "system" ];
|
||||
safeArgs = removeAttrs renamedArgsWithPkgs attrsToRemove;
|
||||
in inputs.home-manager.lib.homeManagerConfiguration safeArgs;
|
||||
darwin = inputs.darwin.lib.darwinSystem;
|
||||
macos = inputs.darwin.lib.darwinSystem;
|
||||
}
|
||||
|
|
@ -128,6 +137,11 @@ in {
|
|||
specialArgs = {
|
||||
inherit name inputs std tree;
|
||||
systemType = config.folder;
|
||||
nur = import inputs.nur {
|
||||
pkgs = pkgs.${config.system};
|
||||
nurpkgs = pkgs.${config.system};
|
||||
};
|
||||
machine = name;
|
||||
system = config;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue