{ config, lib, pkgs, ... }:
let
cfg = config.services.pokesz;
pokesz = import (pkgs.fetchgit {
url = "https://git.morj.men/morj/pokesz";
deepClone = false;
leaveDotGit = false;
rev = "c89476982acb4ba9774d65b6267221eae058cdde";
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
}) { inherit pkgs; };
in {
options.services.pokesz = {
enable = lib.mkEnableOption "pokesz";
port = lib.mkOption {
type = lib.types.port;
default = 8040;
description = lib.mdDoc ''
Port to listen on. Note that service always binds to 127.0.0.1
'';
};
user = lib.mkOption {
type = lib.types.str;
default = "root";
example = "yourUser";
description = lib.mdDoc ''
The user to service as. Recommended option: administrator user.
'';
};
group = lib.mkOption {
type = lib.types.str;
default = "root";
example = "yourGroup";
description = lib.mdDoc ''
The group to service as. Recommended option: administrator group.
'';
};
};
config = lib.mkIf cfg.enable {
systemd.packages = [pokesz];
systemd.services.pokesz = {
description = "Pokazywatiel desktopa";
after = [ "network-online.target" ];
environment.PORT = toString cfg.port;
serviceConfig = {
User = cfg.user;
Group = cfg.group;
ExecStart = ''${pokesz}/bin/pokesz-start.sh'';
Restart = "on-failure";
StandardOutput = "journal";
StandardError = "journal";
};
};
};
}