Merge pull request #243094 from jnsgruk/homepage

homepage: init at 0.6.21
This commit is contained in:
Pol Dellaiera
2023-07-14 09:53:26 +02:00
committed by GitHub
6 changed files with 155 additions and 0 deletions

View File

@@ -646,6 +646,7 @@
./services/misc/greenclip.nix
./services/misc/headphones.nix
./services/misc/heisenbridge.nix
./services/misc/homepage-dashboard.nix
./services/misc/ihaskell.nix
./services/misc/input-remapper.nix
./services/misc/irkerd.nix

View File

@@ -0,0 +1,55 @@
{ config
, pkgs
, lib
, ...
}:
let
cfg = config.services.homepage-dashboard;
in
{
options = {
services.homepage-dashboard = {
enable = lib.mkEnableOption (lib.mdDoc "Homepage Dashboard");
package = lib.mkPackageOptionMD pkgs "homepage-dashboard" { };
openFirewall = lib.mkOption {
type = lib.types.bool;
default = false;
description = lib.mdDoc "Open ports in the firewall for Homepage.";
};
listenPort = lib.mkOption {
type = lib.types.int;
default = 8082;
description = lib.mdDoc "Port for Homepage to bind to.";
};
};
};
config = lib.mkIf cfg.enable {
systemd.services.homepage-dashboard = {
description = "Homepage Dashboard";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
environment = {
HOMEPAGE_CONFIG_DIR = "/var/lib/homepage-dashboard";
PORT = "${toString cfg.listenPort}";
};
serviceConfig = {
Type = "simple";
DynamicUser = true;
StateDirectory = "homepage-dashboard";
ExecStart = "${lib.getExe cfg.package}";
Restart = "on-failure";
};
};
networking.firewall = lib.mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.listenPort ];
};
};
}