forked from tangled.org/core
Monorepo for Tangled

nix: break out appview module into separate file

Signed-off-by: oppiliappan <me@oppi.li>

authored by oppi.li and committed by Tangled c17b766c 038a852f

Changed files
+46 -46
nix
modules
+1 -46
flake.nix
··· 200 200 }; 201 201 }); 202 202 203 - nixosModules.appview = { 204 - config, 205 - pkgs, 206 - lib, 207 - ... 208 - }: 209 - with lib; { 210 - options = { 211 - services.tangled-appview = { 212 - enable = mkOption { 213 - type = types.bool; 214 - default = false; 215 - description = "Enable tangled appview"; 216 - }; 217 - port = mkOption { 218 - type = types.int; 219 - default = 3000; 220 - description = "Port to run the appview on"; 221 - }; 222 - cookie_secret = mkOption { 223 - type = types.str; 224 - default = "00000000000000000000000000000000"; 225 - description = "Cookie secret"; 226 - }; 227 - }; 228 - }; 229 - 230 - config = mkIf config.services.tangled-appview.enable { 231 - systemd.services.tangled-appview = { 232 - description = "tangled appview service"; 233 - wantedBy = ["multi-user.target"]; 234 - 235 - serviceConfig = { 236 - ListenStream = "0.0.0.0:${toString config.services.tangled-appview.port}"; 237 - ExecStart = "${self.packages.${pkgs.system}.appview}/bin/appview"; 238 - Restart = "always"; 239 - }; 240 - 241 - environment = { 242 - TANGLED_DB_PATH = "appview.db"; 243 - TANGLED_COOKIE_SECRET = config.services.tangled-appview.cookie_secret; 244 - }; 245 - }; 246 - }; 247 - }; 248 - 249 203 nixosModules.knot = { 250 204 config, 251 205 pkgs, ··· 448 402 }) 449 403 ]; 450 404 }; 405 + nixosModules.appview = import ./nix/modules/appview.nix {inherit self;}; 451 406 }; 452 407 }
+45
nix/modules/appview.nix
··· 1 + {self}: { 2 + config, 3 + pkgs, 4 + lib, 5 + ... 6 + }: 7 + with lib; { 8 + options = { 9 + services.tangled-appview = { 10 + enable = mkOption { 11 + type = types.bool; 12 + default = false; 13 + description = "Enable tangled appview"; 14 + }; 15 + port = mkOption { 16 + type = types.int; 17 + default = 3000; 18 + description = "Port to run the appview on"; 19 + }; 20 + cookie_secret = mkOption { 21 + type = types.str; 22 + default = "00000000000000000000000000000000"; 23 + description = "Cookie secret"; 24 + }; 25 + }; 26 + }; 27 + 28 + config = mkIf config.services.tangled-appview.enable { 29 + systemd.services.tangled-appview = { 30 + description = "tangled appview service"; 31 + wantedBy = ["multi-user.target"]; 32 + 33 + serviceConfig = { 34 + ListenStream = "0.0.0.0:${toString config.services.tangled-appview.port}"; 35 + ExecStart = "${self.packages.${pkgs.system}.appview}/bin/appview"; 36 + Restart = "always"; 37 + }; 38 + 39 + environment = { 40 + TANGLED_DB_PATH = "appview.db"; 41 + TANGLED_COOKIE_SECRET = config.services.tangled-appview.cookie_secret; 42 + }; 43 + }; 44 + }; 45 + }