2024-06-30 03:56:48 +03:00
|
|
|
# This is a common user configuration.
|
2024-10-11 23:27:07 +03:00
|
|
|
{
|
2024-11-04 04:37:29 +03:00
|
|
|
__findFile,
|
|
|
|
config,
|
|
|
|
const,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
util,
|
|
|
|
...
|
|
|
|
} @args: let
|
|
|
|
cfg = config.home.nixos;
|
2024-11-16 04:56:36 +03:00
|
|
|
env = import ./env args;
|
|
|
|
file = import ./file args;
|
2024-11-04 04:37:29 +03:00
|
|
|
programs = import ./program args;
|
|
|
|
in {
|
|
|
|
imports = (util.ls <user>);
|
2024-06-30 03:56:48 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
options.home.nixos = {
|
|
|
|
enable = lib.mkEnableOption "the NixOS user setup.";
|
|
|
|
users = lib.mkOption {
|
|
|
|
default = [ ];
|
|
|
|
type = with lib.types; listOf attrs;
|
|
|
|
};
|
|
|
|
};
|
2024-09-19 03:21:47 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
home-manager = {
|
|
|
|
backupFileExtension = "backup-" + pkgs.lib.readFile "${pkgs.runCommand "timestamp" { } "echo -n date '+%Y%m%d%H%M%S' > $out"}";
|
|
|
|
users = builtins.foldl' (acc: user:
|
|
|
|
acc // {
|
|
|
|
${user.username} = {
|
|
|
|
home = {
|
|
|
|
inherit (const) stateVersion;
|
2024-11-16 04:56:36 +03:00
|
|
|
inherit (env) sessionVariables;
|
2024-11-04 04:37:29 +03:00
|
|
|
inherit (user) username homeDirectory;
|
2024-11-16 04:56:36 +03:00
|
|
|
inherit file;
|
2024-06-30 03:56:48 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
# ISSUE: https://github.com/nix-community/home-manager/issues/5589
|
|
|
|
extraActivationPath = with pkgs; [ openssh ];
|
|
|
|
};
|
|
|
|
xdg = import ./xdg { inherit (user) homeDirectory; };
|
|
|
|
programs = with programs; core // desktop;
|
2024-11-16 04:56:36 +03:00
|
|
|
dconf.settings = util.catSet (util.ls ./file/dconf) args;
|
2024-11-04 04:37:29 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
) { } cfg.users;
|
|
|
|
};
|
|
|
|
};
|
2024-06-30 03:56:48 +03:00
|
|
|
}
|