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