2022-01-11 18:44:40 +01:00
|
|
|
{ options, config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
2022-04-23 03:10:38 +02:00
|
|
|
let
|
|
|
|
|
|
|
|
in {
|
2022-01-11 18:44:40 +01:00
|
|
|
options = {
|
2022-09-05 18:16:09 +02:00
|
|
|
user = mkOption {
|
2022-01-11 18:44:40 +01:00
|
|
|
type = types.attrs;
|
|
|
|
default = {};
|
2022-09-05 18:16:09 +02:00
|
|
|
description = "Defaults to apply to all normal users in the system.";
|
|
|
|
};
|
|
|
|
normalUsers = mkOption {
|
|
|
|
type = types.attrsOf (types.submodule { options = {
|
|
|
|
conf = mkOption {
|
|
|
|
type = types.attrs;
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
homeConf = mkOption {
|
|
|
|
type = types.attrs;
|
|
|
|
default = {};
|
|
|
|
};
|
|
|
|
};});
|
|
|
|
default = {};
|
2022-01-11 18:44:40 +01:00
|
|
|
};
|
|
|
|
home = {
|
|
|
|
_ = mkOption {
|
|
|
|
type = types.attrs;
|
|
|
|
default = {};
|
|
|
|
description = "Universal home-level user configuration";
|
|
|
|
};
|
|
|
|
configFile = mkOption {
|
|
|
|
type = types.attrs;
|
2022-09-05 18:16:09 +02:00
|
|
|
default = {};
|
|
|
|
description = "(XDG) Configuration files managed by home-manager";
|
2022-01-11 18:44:40 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
configDir = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
default = ../config;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
home-manager.useUserPackages = true;
|
|
|
|
|
2022-01-29 12:47:38 +01:00
|
|
|
user = {
|
2022-04-23 03:10:38 +02:00
|
|
|
packages = with pkgs; [ wget ];
|
|
|
|
extraGroups = [ ];
|
2022-01-29 12:47:38 +01:00
|
|
|
};
|
|
|
|
|
2022-01-11 18:44:40 +01:00
|
|
|
home._ = {
|
|
|
|
home.stateVersion = config.system.stateVersion;
|
2022-04-20 10:53:28 +02:00
|
|
|
home.file = mkAliasDefinitions options.home.configFile;
|
2022-01-11 18:44:40 +01:00
|
|
|
xdg.enable = true;
|
|
|
|
xdg.configFile = mkAliasDefinitions options.home.configFile;
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
sessionVariables = {
|
|
|
|
XDG_CACHE_HOME = "$HOME/.cache";
|
|
|
|
XDG_CONFIG_HOME = "$HOME/.config";
|
|
|
|
XDG_DATA_HOME = "$HOME/.local/share";
|
|
|
|
XDG_BIN_HOME = "$HOME/.local/bin";
|
|
|
|
XDG_DESKTOP_DIR = "$HOME";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-09-05 18:16:09 +02:00
|
|
|
users.groups = mapAttrs (_: _: {}) config.normalUsers;
|
|
|
|
|
|
|
|
users.users = mapAttrs (username: user: (mkMerge [
|
2022-04-23 03:10:38 +02:00
|
|
|
(mkAliasDefinitions options.user)
|
2022-09-05 18:16:09 +02:00
|
|
|
user.conf
|
2022-04-23 03:10:38 +02:00
|
|
|
{
|
|
|
|
isNormalUser = true;
|
2022-09-05 18:16:09 +02:00
|
|
|
group = username;
|
2022-04-23 03:10:38 +02:00
|
|
|
}
|
2022-09-05 18:16:09 +02:00
|
|
|
])) config.normalUsers;
|
2022-01-11 18:44:40 +01:00
|
|
|
|
2022-09-05 18:16:09 +02:00
|
|
|
home-manager.users = mapAttrs (username: user: (mkMerge [(mkAliasDefinitions options.home._) user.homeConf])) config.normalUsers;
|
2022-01-11 18:44:40 +01:00
|
|
|
};
|
|
|
|
}
|