build a brandnew architecture for configurations.
This commit is contained in:
parent
08aacf8c0d
commit
6dbbce42cf
43 changed files with 425 additions and 643 deletions
|
|
@ -14,6 +14,7 @@
|
|||
])
|
||||
++ [
|
||||
./nix.nix
|
||||
./home.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
|
|
|
|||
64
nixos/modules/home.nix
Normal file
64
nixos/modules/home.nix
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
{
|
||||
inputs,
|
||||
outputs,
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
rootPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
options.youthlic.home-manager = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
whether enable home-manager or not
|
||||
'';
|
||||
};
|
||||
unixName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "david";
|
||||
example = "youthlic";
|
||||
description = ''
|
||||
unix name of home-manager user
|
||||
'';
|
||||
};
|
||||
hostName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "Tytonidae";
|
||||
description = ''
|
||||
host name of home-manager user
|
||||
'';
|
||||
};
|
||||
};
|
||||
config =
|
||||
let
|
||||
cfg = config.youthlic.home-manager;
|
||||
unixName = cfg.unixName;
|
||||
hostName = cfg.hostName;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users."${cfg.unixName}" = (
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
(rootPath + "/home/${unixName}/modules")
|
||||
(rootPath + "/home/${unixName}/configurations/${hostName}")
|
||||
];
|
||||
}
|
||||
);
|
||||
extraSpecialArgs = {
|
||||
inherit outputs inputs;
|
||||
inherit (cfg) unixName hostName;
|
||||
inherit (pkgs) system;
|
||||
};
|
||||
backupFileExtension = "backup";
|
||||
sharedModules = [ outputs.homeManagerModules.default ];
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue