Harald Hoyer
37277447d3
Moved default SSH keys to a shared `common.nix` module for better reusability and maintainability. Updated references in both NixOS and Darwin user modules to use the centralized keys. This reduces redundancy and improves consistency across modules.
49 lines
1.2 KiB
Nix
49 lines
1.2 KiB
Nix
{
|
|
lib,
|
|
config,
|
|
pkgs,
|
|
...
|
|
}:
|
|
with lib;
|
|
with lib.metacfg;
|
|
let
|
|
common = import ../../common.nix {};
|
|
cfg = config.metacfg.user;
|
|
|
|
is-linux = pkgs.stdenv.isLinux;
|
|
is-darwin = pkgs.stdenv.isDarwin;
|
|
in
|
|
{
|
|
options.metacfg.user = with types; {
|
|
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.";
|
|
sshKeys = mkOpt (listOf str) common.defaultSSHKeys "ssh keys";
|
|
};
|
|
|
|
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;
|
|
openssh.authorizedKeys.keys = cfg.sshKeys;
|
|
};
|
|
|
|
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
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|