Flake for my NixOS devices
at main 118 lines 3.0 kB view raw
1{...}: { 2 pkgs, 3 lib, 4 config, 5 ... 6}: { 7 options.cow.bean = { 8 enable = lib.mkEnableOption "Bean user presets"; 9 username = lib.mkOption { 10 type = lib.types.str; 11 description = "username"; 12 default = "bean"; 13 }; 14 name = lib.mkOption { 15 type = lib.types.str; 16 description = "Friendly name of user"; 17 default = "Ben C"; 18 }; 19 pubkey = lib.mkOption { 20 type = lib.types.nullOr lib.types.str; 21 description = "Public key to accept for bean"; 22 default = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKsVzdJra+x5aEuwTjL1FBOiMh9bftvs8QwsM1xyEbdd"; 23 }; 24 email = lib.mkOption { 25 type = lib.types.str; 26 # TODO: Tangled supports DIDs instead... 27 description = "Email to use for Git operations"; 28 default = lib.join "@bwc9876" [ 29 "ben" 30 ".dev" 31 ]; 32 }; 33 }; 34 35 config = let 36 conf = config.cow.bean; 37 in 38 lib.mkIf conf.enable { 39 # My Personal config using most of my HM modules 40 41 home = { 42 file.".ssh/authorized_keys".text = lib.mkIf (conf.pubkey != null) '' 43 ${conf.pubkey} ${conf.username} 44 ''; 45 username = lib.mkDefault conf.username; 46 homeDirectory = lib.mkDefault "/home/${conf.username}"; 47 }; 48 49 programs.jujutsu.settings = { 50 user = { 51 inherit (conf) name email; 52 }; 53 git = { 54 sign-on-push = true; 55 }; 56 signing = { 57 behavior = "drop"; 58 backend = "ssh"; 59 key = lib.mkIf (conf.pubkey != null) conf.pubkey; 60 }; 61 }; 62 63 programs.git = { 64 signing = lib.mkIf (conf.pubkey != null) { 65 format = "ssh"; 66 signByDefault = true; 67 }; 68 settings = { 69 user = { 70 inherit (conf) name email; 71 signingKey = lib.mkIf (conf.pubkey != null) conf.pubkey; 72 }; 73 }; 74 }; 75 76 home.packages = lib.mkIf config.cow.gdi.enable ( 77 with pkgs; [ 78 zoom-us 79 tuxpaint 80 ] 81 ); 82 83 home.sessionVariables = { 84 "EDITOR" = "nvim"; 85 }; 86 87 xdg.mimeApps.defaultApplications = lib.mkIf config.cow.gdi.enable { 88 "image/svg+xml" = "org.inkscape.Inkscape.desktop"; 89 "image/*" = "org.gnome.Loupe.desktop"; 90 }; 91 92 cow = { 93 libraries.enable = true; 94 imperm.keepLibraries = true; 95 pictures = { 96 enable = true; 97 pfp = ../res/pictures/cow.png; 98 bg = ../res/pictures/background.png; 99 }; 100 nushell = { 101 enable = true; 102 commandNotFound = true; 103 }; 104 neovim.enable = true; 105 htop.enable = true; 106 starship.enable = true; 107 dev.enable = true; 108 jj.enable = true; 109 comma.enable = true; 110 cat.enable = true; 111 112 keepassxc = { 113 enable = true; 114 dbPath = lib.mkDefault "${config.xdg.userDirs.documents}/Keepass/DB/Database.kdbx"; 115 }; 116 }; 117 }; 118}