lol

nixos/homepage-dashboard: init

+56
+1
nixos/modules/module-list.nix
··· 646 646 ./services/misc/greenclip.nix 647 647 ./services/misc/headphones.nix 648 648 ./services/misc/heisenbridge.nix 649 + ./services/misc/homepage-dashboard.nix 649 650 ./services/misc/ihaskell.nix 650 651 ./services/misc/input-remapper.nix 651 652 ./services/misc/irkerd.nix
+55
nixos/modules/services/misc/homepage-dashboard.nix
··· 1 + { config 2 + , pkgs 3 + , lib 4 + , ... 5 + }: 6 + 7 + let 8 + cfg = config.services.homepage-dashboard; 9 + in 10 + { 11 + options = { 12 + services.homepage-dashboard = { 13 + enable = lib.mkEnableOption (lib.mdDoc "Homepage Dashboard"); 14 + 15 + package = lib.mkPackageOptionMD pkgs "homepage-dashboard" { }; 16 + 17 + openFirewall = lib.mkOption { 18 + type = lib.types.bool; 19 + default = false; 20 + description = lib.mdDoc "Open ports in the firewall for Homepage."; 21 + }; 22 + 23 + listenPort = lib.mkOption { 24 + type = lib.types.int; 25 + default = 8082; 26 + description = lib.mdDoc "Port for Homepage to bind to."; 27 + }; 28 + }; 29 + }; 30 + 31 + config = lib.mkIf cfg.enable { 32 + systemd.services.homepage-dashboard = { 33 + description = "Homepage Dashboard"; 34 + after = [ "network.target" ]; 35 + wantedBy = [ "multi-user.target" ]; 36 + 37 + environment = { 38 + HOMEPAGE_CONFIG_DIR = "/var/lib/homepage-dashboard"; 39 + PORT = "${toString cfg.listenPort}"; 40 + }; 41 + 42 + serviceConfig = { 43 + Type = "simple"; 44 + DynamicUser = true; 45 + StateDirectory = "homepage-dashboard"; 46 + ExecStart = "${lib.getExe cfg.package}"; 47 + Restart = "on-failure"; 48 + }; 49 + }; 50 + 51 + networking.firewall = lib.mkIf cfg.openFirewall { 52 + allowedTCPPorts = [ cfg.listenPort ]; 53 + }; 54 + }; 55 + }