2023-07-20 15:02:38 +03:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
myData,
|
|
|
|
...
|
2023-10-01 23:14:05 +03:00
|
|
|
}: let
|
|
|
|
cfg = config.mj.base.users;
|
|
|
|
in {
|
2023-07-20 15:02:38 +03:00
|
|
|
options.mj.base.users = with lib.types; {
|
2023-12-11 20:05:32 +02:00
|
|
|
fullDesktop = lib.mkOption {
|
2023-10-09 22:07:42 +03:00
|
|
|
type = bool;
|
|
|
|
default = false;
|
|
|
|
};
|
2023-07-20 15:02:38 +03:00
|
|
|
passwd = lib.mkOption {
|
2023-10-01 23:14:05 +03:00
|
|
|
type = attrsOf (submodule {
|
|
|
|
options = {
|
2023-11-27 17:54:44 +02:00
|
|
|
hashedPasswordFile = lib.mkOption {
|
2023-10-01 23:14:05 +03:00
|
|
|
type = nullOr path;
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
initialPassword = lib.mkOption {
|
|
|
|
type = nullOr str;
|
|
|
|
default = null;
|
|
|
|
};
|
2023-09-13 12:17:43 +03:00
|
|
|
|
2023-10-01 23:14:05 +03:00
|
|
|
extraGroups = lib.mkOption {
|
|
|
|
type = listOf str;
|
|
|
|
default = [];
|
2023-07-20 15:02:38 +03:00
|
|
|
};
|
2023-10-01 23:14:05 +03:00
|
|
|
};
|
|
|
|
});
|
2023-07-20 15:02:38 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
users = {
|
|
|
|
mutableUsers = false;
|
|
|
|
|
2023-10-01 23:14:05 +03:00
|
|
|
users = {
|
2023-07-20 15:02:38 +03:00
|
|
|
motiejus =
|
|
|
|
{
|
|
|
|
isNormalUser = true;
|
2023-10-01 23:14:05 +03:00
|
|
|
extraGroups = ["wheel"] ++ cfg.passwd.motiejus.extraGroups;
|
2023-07-24 16:31:38 +03:00
|
|
|
uid = myData.uidgid.motiejus;
|
2023-10-06 08:58:28 +03:00
|
|
|
openssh.authorizedKeys.keys = [
|
|
|
|
myData.people_pubkeys.motiejus
|
|
|
|
"from=\"${myData.hosts."mtwork.motiejus.jakst".jakstIP}\" ${myData.people_pubkeys.motiejus_work}"
|
|
|
|
];
|
2023-07-20 15:02:38 +03:00
|
|
|
}
|
2023-09-14 13:07:39 +03:00
|
|
|
// lib.filterAttrs (
|
|
|
|
n: v:
|
2023-11-27 17:54:44 +02:00
|
|
|
(n == "hashedPasswordFile" || n == "initialPassword") && v != null
|
2023-09-14 13:07:39 +03:00
|
|
|
)
|
2023-10-01 23:14:05 +03:00
|
|
|
cfg.passwd.motiejus or {};
|
2023-07-20 15:02:38 +03:00
|
|
|
|
2023-10-01 23:14:05 +03:00
|
|
|
root = assert lib.assertMsg (cfg.passwd ? root) "root password needs to be defined";
|
|
|
|
lib.filterAttrs (_: v: v != null) cfg.passwd.root;
|
2023-07-20 15:02:38 +03:00
|
|
|
};
|
|
|
|
};
|
2023-08-18 16:26:00 +03:00
|
|
|
|
2023-08-18 16:30:26 +03:00
|
|
|
home-manager.useGlobalPkgs = true;
|
2023-10-06 11:24:00 +03:00
|
|
|
home-manager.users.motiejus = {pkgs, ...}:
|
2023-10-08 16:40:16 +03:00
|
|
|
lib.mkMerge [
|
|
|
|
(import ../../../shared/home/default.nix {
|
2023-10-08 23:00:39 +03:00
|
|
|
inherit lib;
|
2023-10-08 16:40:16 +03:00
|
|
|
inherit pkgs;
|
|
|
|
inherit (config.mj) stateVersion;
|
2023-12-11 20:05:32 +02:00
|
|
|
inherit (config.mj.base.users) fullDesktop;
|
2023-10-27 10:31:00 +03:00
|
|
|
hmOnly = false;
|
2023-10-08 16:40:16 +03:00
|
|
|
email = "motiejus@jakstys.lt";
|
|
|
|
})
|
|
|
|
{
|
|
|
|
programs.bash = {
|
|
|
|
enable = true;
|
|
|
|
shellAliases = {
|
|
|
|
"l" = "echo -n ł | xclip -selection clipboard";
|
|
|
|
"gp" = "${pkgs.git}/bin/git remote | ${pkgs.parallel}/bin/parallel --verbose git push";
|
|
|
|
};
|
2023-10-06 11:24:00 +03:00
|
|
|
};
|
2023-10-08 16:40:16 +03:00
|
|
|
}
|
|
|
|
];
|
2023-07-20 15:02:38 +03:00
|
|
|
};
|
|
|
|
}
|