Flake for my NixOS devices
1{...}: {
2 config,
3 lib,
4 pkgs,
5 ...
6}: let
7 pubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKsVzdJra+x5aEuwTjL1FBOiMh9bftvs8QwsM1xyEbdd";
8in {
9 options.cow.bean = {
10 enable = lib.mkEnableOption "Bean user";
11 sudoer = lib.mkEnableOption "Bean being a sudoer";
12 pubkey = lib.mkOption {
13 type = lib.types.str;
14 description = "Public Key to Add for Bean";
15 default = pubkey;
16 };
17 };
18
19 config = lib.mkIf config.cow.bean.enable {
20 users.users.bean = {
21 isNormalUser = true;
22 description = "Ben C";
23 extraGroups = lib.optionals config.cow.bean.sudoer ["wheel"];
24 shell = pkgs.nushell;
25 openssh.authorizedKeys.keys = [config.cow.bean.pubkey];
26 };
27
28 home-manager.users.bean = lib.mkIf config.cow.hm.enable {
29 cow.bean = {
30 inherit (config.cow.bean) enable;
31 inherit (config.cow.bean) pubkey;
32 };
33 cow.games.enable = config.cow.gaming.enable;
34 cow.gdi = {
35 inherit (config.cow.gdi) enable doIdle;
36 };
37 };
38 };
39}