2024-11-19 10:31:29 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
2024-03-21 15:00:36 +01:00
|
|
|
}:
|
2025-01-16 08:38:27 +01:00
|
|
|
with lib;
|
|
|
|
with lib.metacfg;
|
2024-03-21 15:00:36 +01:00
|
|
|
let
|
2025-01-16 08:38:27 +01:00
|
|
|
common = import ../../common.nix {};
|
2024-03-21 15:00:36 +01:00
|
|
|
cfg = config.metacfg.user;
|
|
|
|
|
|
|
|
is-linux = pkgs.stdenv.isLinux;
|
|
|
|
is-darwin = pkgs.stdenv.isDarwin;
|
|
|
|
in
|
|
|
|
{
|
2025-01-16 08:38:27 +01:00
|
|
|
options.metacfg.user = with types; {
|
2024-03-21 15:00:36 +01:00
|
|
|
name = mkOpt types.str "harald" "The user account.";
|
|
|
|
|
|
|
|
fullName = mkOpt types.str "Harald Hoyer" "The full name of the user.";
|
|
|
|
email = mkOpt types.str "harald@hoyer.xyz" "The email of the user.";
|
|
|
|
|
|
|
|
uid = mkOpt (types.nullOr types.int) 501 "The uid for the user account.";
|
2025-01-16 08:38:27 +01:00
|
|
|
sshKeys = mkOpt (listOf str) common.defaultSSHKeys "ssh keys";
|
2024-03-21 15:00:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
users.users.${cfg.name} = {
|
|
|
|
# NOTE: Setting the uid here is required for another
|
|
|
|
# module to evaluate successfully since it reads
|
|
|
|
# `users.users.${metacfg.user.name}.uid`.
|
|
|
|
uid = mkIf (cfg.uid != null) cfg.uid;
|
2024-11-27 16:37:09 +01:00
|
|
|
openssh.authorizedKeys.keys = cfg.sshKeys;
|
2024-03-21 15:00:36 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
snowfallorg.users.${config.metacfg.user.name}.home.config = {
|
|
|
|
home = {
|
|
|
|
file = {
|
|
|
|
".profile".text = ''
|
|
|
|
# The default file limit is far too low and throws an error when rebuilding the system.
|
|
|
|
# See the original with: ulimit -Sa
|
|
|
|
ulimit -n 4096
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|