options.nix
1 { 2 config, 3 flavor, 4 lib, 5 pkgs, 6 ... 7 }: 8 let 9 inherit (lib) mkOption types; 10 inherit (pkgs.stdenv) isLinux; 11 12 mkEnabledOption = 13 { 14 description ? "Enable unnamed module", 15 parent ? null, 16 }: 17 mkOption { 18 inherit description; 19 20 type = types.bool; 21 default = parent == null || parent; 22 }; 23 in 24 { 25 options.dusk = { 26 initialPassword = mkOption { 27 type = types.str; 28 description = "Initial password for the created user in the system"; 29 default = "dusk"; 30 }; 31 32 accounts.github = mkOption { 33 type = types.str; 34 description = "The user Github Account"; 35 }; 36 37 emails = { 38 primary = mkOption { 39 type = types.str; 40 description = "The primary email used by the user"; 41 }; 42 43 additional = mkOption { 44 type = types.listOf types.str; 45 description = "Additional email addresses for the user"; 46 default = [ ]; 47 }; 48 }; 49 50 name = mkOption { 51 type = types.str; 52 description = "The full name of the user"; 53 }; 54 55 username = mkOption { 56 type = types.str; 57 description = "User name of the main user of the system"; 58 }; 59 60 defaults.browser = mkOption { 61 type = types.str; 62 description = "Your default browser"; 63 default = "${pkgs.brave}/bin/brave"; 64 }; 65 66 folders = 67 let 68 home = if isLinux then "/home/${config.dusk.username}" else "/Users/${config.dusk.username}"; 69 in 70 { 71 code = mkOption { 72 type = types.str; 73 description = "Where you host your working projects"; 74 default = "${home}/Code"; 75 }; 76 77 downloads = mkOption { 78 type = types.str; 79 description = "Where you host your Downloads"; 80 default = "${home}/Downloads"; 81 }; 82 83 home = mkOption { 84 type = types.str; 85 description = "Your home folder"; 86 default = home; 87 }; 88 89 mail = mkOption { 90 type = types.str; 91 description = "Your root mail folder"; 92 default = "${home}/Mail"; 93 }; 94 }; 95 96 system = { 97 hostname = mkOption { 98 type = types.str; 99 description = "The hostname of the system on the network"; 100 default = "dusk"; 101 }; 102 103 locale = mkOption { 104 type = types.str; 105 default = "en_US.UTF-8"; 106 description = "Locale of the system"; 107 }; 108 109 timezone = mkOption { 110 type = types.str; 111 default = "America/Sao_Paulo"; 112 description = "Timezone to use for the system"; 113 }; 114 115 git = { 116 signByDefault = mkOption { 117 type = types.bool; 118 default = true; 119 description = "Whether or not git should sign all commits"; 120 }; 121 122 defaultBranch = mkOption { 123 type = types.str; 124 default = "main"; 125 description = "The default branch to use for new git repositories"; 126 }; 127 }; 128 129 zed = { 130 enable = mkEnabledOption { 131 description = "Whether or not to enable the Zed Editor"; 132 parent = true; 133 }; 134 135 ui_font_family = mkOption { 136 type = types.str; 137 default = "Inconsolata NerdFont"; 138 }; 139 140 ui_font_size = mkOption { 141 type = types.float; 142 default = 16.0; 143 }; 144 145 buffer_font_family = mkOption { 146 type = types.str; 147 default = "Inconsolata NerdFont"; 148 }; 149 150 buffer_font_size = mkOption { 151 type = types.float; 152 default = 16.0; 153 }; 154 }; 155 156 nixos = 157 let 158 cfg = config.dusk.system.nixos; 159 in 160 { 161 ai.enable = mkEnabledOption { 162 description = "Whether or not to install AI Tools"; 163 parent = flavor == "nixos"; 164 }; 165 166 bootloader.enable = mkEnabledOption { 167 description = "Whether or not to install a bootloader"; 168 parent = flavor == "nixos"; 169 }; 170 171 nvidia.enable = mkEnabledOption { 172 description = "Whether or not to enable support for Nvidia Cards"; 173 parent = flavor == "nixos"; 174 }; 175 176 desktop = { 177 enable = mkEnabledOption { 178 description = "Whether or not to enable the Graphical Desktop"; 179 parent = flavor == "nixos"; 180 }; 181 182 gnome = { 183 enable = mkEnabledOption { 184 description = "Whether or not to enable the Gnome Desktop"; 185 parent = cfg.desktop.enable; 186 }; 187 }; 188 189 hyprland = { 190 enable = mkEnabledOption { 191 description = "Whether or not to enable the Hyprland compositor"; 192 parent = cfg.desktop.enable && !cfg.desktop.gnome.enable; 193 }; 194 }; 195 196 gaming = { 197 enable = mkEnabledOption { 198 description = "Whether or not to enable Gaming support (Steam, Gamemode, Gamescope)"; 199 parent = cfg.desktop.enable; 200 }; 201 202 gamescope.enable = mkEnabledOption { 203 description = "Whether or not to enable the Gamescope compositor"; 204 parent = cfg.desktop.gaming.enable; 205 }; 206 }; 207 }; 208 209 networking = { 210 enable = mkEnabledOption { 211 description = "Whether or not to enable NetworkManager"; 212 parent = cfg.enable; 213 }; 214 215 ip = mkOption { 216 type = types.nullOr types.str; 217 default = null; 218 description = "The static ip for this machine on the local network, if any"; 219 }; 220 221 tailscale.enable = mkEnabledOption { 222 description = "Whether or not to enable Tailscale VPN"; 223 parent = cfg.networking.enable; 224 }; 225 }; 226 227 virtualisation = { 228 enable = mkEnabledOption { description = "Whether or not to enable Virtualisation Tooling"; }; 229 230 docker.enable = mkEnabledOption { 231 description = "Whether or not to enable Docker"; 232 parent = cfg.virtualisation.enable; 233 }; 234 235 libvirt.enable = mkEnabledOption { 236 description = "Whether or not to enable LibVirt"; 237 parent = cfg.virtualisation.enable; 238 }; 239 }; 240 241 server = { 242 enable = lib.mkEnableOption "Whether or not to install the server infrastructure"; 243 244 domain = mkOption { 245 type = types.str; 246 default = "${config.dusk.system.hostname}.local"; 247 description = "The root domain for all services in the system"; 248 }; 249 }; 250 }; 251 }; 252 }; 253 }