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