wip: better home-manager integration
This commit is contained in:
parent
17ef1c563d
commit
4d6fdba390
6 changed files with 57 additions and 112 deletions
|
|
@ -1,33 +0,0 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkOption mkMerge mapAttrsToList;
|
||||
|
||||
home-submodule = { name, ... }: {
|
||||
options = {
|
||||
proxy = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
description = "Configuration to be proxied to the home-manager configuration for `home-manager.users.<name>`.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cfg = config.snowfallorg;
|
||||
in
|
||||
{
|
||||
options.snowfallorg = {
|
||||
home = mkOption {
|
||||
type = types.attrsOf (types.submodule home-submodule);
|
||||
default = { };
|
||||
description = "Options for configuring home environments.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge
|
||||
(mapAttrsToList
|
||||
(name: value: {
|
||||
home-manager.users.${name} = value.proxy;
|
||||
})
|
||||
(cfg.home));
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
{ lib, osConfig ? { }, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkOption;
|
||||
|
||||
home-submodule = { name, ... }: {
|
||||
options = {
|
||||
proxy = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
description = "Configuration to be proxied to the home-manager configuration for `home-manager.users.<name>`.";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.snowfallorg = {
|
||||
home = mkOption {
|
||||
type = types.attrsOf (types.submodule home-submodule);
|
||||
default = { };
|
||||
description = "Options for configuring home environments.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# snowfallorg.home = osConfig.snowfallorg.home or { };
|
||||
};
|
||||
}
|
||||
23
modules/home/user/default.nix
Normal file
23
modules/home/user/default.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ lib, options, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkOption mkIf;
|
||||
|
||||
cfg = options.snowfallorg;
|
||||
in
|
||||
# (builtins.trace (cfg.user.name or "no name"))
|
||||
{
|
||||
options.snowfallorg = {
|
||||
user = {
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
description = "The user's name.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# config = mkIf ((cfg.user.name or null) != null) {
|
||||
# @TODO(jakehamilton): Get user home directory from osConfig if
|
||||
# it exists.
|
||||
# };
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
{ lib, config, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) types mkOption mkMerge mapAttrsToList;
|
||||
|
||||
home-submodule = { name, ... }: {
|
||||
options = {
|
||||
proxy = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
description = "Configuration to be proxied to the home-manager configuration for `home-manager.users.<name>`.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
cfg = config.snowfallorg;
|
||||
in
|
||||
{
|
||||
options.snowfallorg = {
|
||||
home = mkOption {
|
||||
type = types.attrsOf (types.submodule home-submodule);
|
||||
default = { };
|
||||
description = "Options for configuring home environments.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkMerge
|
||||
(mapAttrsToList
|
||||
(name: value: {
|
||||
home-manager.users.${name} = value.proxy;
|
||||
})
|
||||
(cfg.home));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue