forked from tangled.org/core
this repo has no description
at master 1.8 kB view raw
1{ 2 config, 3 lib, 4 ... 5}: let 6 cfg = config.services.tangled-appview; 7in 8 with lib; { 9 options = { 10 services.tangled-appview = { 11 enable = mkOption { 12 type = types.bool; 13 default = false; 14 description = "Enable tangled appview"; 15 }; 16 package = mkOption { 17 type = types.package; 18 description = "Package to use for the appview"; 19 }; 20 port = mkOption { 21 type = types.int; 22 default = 3000; 23 description = "Port to run the appview on"; 24 }; 25 cookie_secret = mkOption { 26 type = types.str; 27 default = "00000000000000000000000000000000"; 28 description = "Cookie secret"; 29 }; 30 environmentFile = mkOption { 31 type = with types; nullOr path; 32 default = null; 33 example = "/etc/tangled-appview.env"; 34 description = '' 35 Additional environment file as defined in {manpage}`systemd.exec(5)`. 36 37 Sensitive secrets such as {env}`TANGLED_COOKIE_SECRET` may be 38 passed to the service without makeing them world readable in the 39 nix store. 40 41 ''; 42 }; 43 }; 44 }; 45 46 config = mkIf cfg.enable { 47 systemd.services.tangled-appview = { 48 description = "tangled appview service"; 49 wantedBy = ["multi-user.target"]; 50 51 serviceConfig = { 52 ListenStream = "0.0.0.0:${toString cfg.port}"; 53 ExecStart = "${cfg.package}/bin/appview"; 54 Restart = "always"; 55 EnvironmentFile = optional (cfg.environmentFile != null) cfg.environmentFile; 56 }; 57 58 environment = { 59 TANGLED_DB_PATH = "appview.db"; 60 TANGLED_COOKIE_SECRET = cfg.cookie_secret; 61 }; 62 }; 63 }; 64 }