NixOS system configurations + dotfiles via home-manager
1{ lib, ... }:
2let
3 options.name = lib.mkOption {
4 type = lib.types.str;
5 default = "peter";
6 };
7 openssh.authorizedKeys.keys = [
8 "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILACfyJt7+ULfX1XFhBbztlTMNDZnRNQbKj5DV2S7uVo peter@grancel"
9 "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ9oTGdaddqjAM93FQP83XABhVxZo1jo8ljb62CtUoBq peter@ruan"
10 "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKJXTjmM8sqYI1WlQJZOpoUfuN3WCGWF5CND8SySuT9O peter@crossbell"
11 "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIObxXM22QQwNosuoH9UXhJWAm5PQOMtxEHGI3ElhsdCn peter@arseille"
12 "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJojCQs1VjUFaO/2dOq2N/zQgfRtBtFE7nLu3VpJZkwt price@jurai"
13 ];
14in
15{
16 config.flake.modules.nixos.user =
17 { config, ... }:
18 let
19 cfg = config.local.user;
20 in
21 {
22 options.local.user = {
23 inherit (options) name;
24 extraGroups = lib.mkOption {
25 type = with lib.types; listOf str;
26 default = [ ];
27 apply = groups: [ "wheel" ] ++ groups;
28 };
29 };
30
31 config.users.users.${cfg.name} = {
32 isNormalUser = true;
33 inherit (cfg) extraGroups;
34 inherit openssh;
35 };
36 };
37
38 config.flake.modules.darwin.default =
39 { config, ... }:
40 let
41 cfg = config.local.user;
42 in
43 {
44 options.local.user = { inherit (options) name; };
45 config.users.users.${cfg.name} = { inherit openssh; };
46 };
47}