78 lines
1.7 KiB
Nix
78 lines
1.7 KiB
Nix
flake: {config, pkgs, lib, ...}:
|
|
|
|
let
|
|
cfg = config.services.quickpeepSearch;
|
|
inherit (flake.packages.${pkgs.stdenv.hostPlatform.system}) quickpeep;
|
|
in
|
|
|
|
with lib;
|
|
|
|
{
|
|
options = {
|
|
services.quickpeepSearch = {
|
|
enable = mkOption {
|
|
default = false;
|
|
type = with types; bool;
|
|
description = ''
|
|
Start the QuickPeep Search web interface.
|
|
'';
|
|
};
|
|
|
|
user = mkOption {
|
|
default = "quickpeep";
|
|
type = with types; uniq str;
|
|
description = ''
|
|
Name of the user.
|
|
'';
|
|
};
|
|
|
|
bindHost = mkOption {
|
|
default = "127.0.0.1";
|
|
type = with types; str;
|
|
description = ''
|
|
Host upon which to bind the web interface.
|
|
'';
|
|
};
|
|
|
|
bindPort = mkOption {
|
|
default = 9733;
|
|
type = with types; int;
|
|
description = ''
|
|
Port upon which to bind the web interface.
|
|
'';
|
|
};
|
|
|
|
configPath = mkOption {
|
|
type = with types; path;
|
|
description = ''
|
|
Config path to use, in RON format.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
users.users."${cfg.user}" = {
|
|
description = "QuickPeep User";
|
|
isSystemUser = true;
|
|
group = "${cfg.user}";
|
|
};
|
|
users.groups."${cfg.user}" = {};
|
|
|
|
systemd.services.quickpeepSearch = {
|
|
wantedBy = [ "multi-user.target" ];
|
|
after = [ "network.target" ];
|
|
description = "Start the QuickPeep Search web interface.";
|
|
|
|
environment = {
|
|
QUICKPEEP_CONFIG = cfg.configPath;
|
|
};
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
User = "${cfg.user}";
|
|
ExecStart = ''${quickpeep}/bin/quickpeep ${cfg.bindHost}:${builtins.toString cfg.bindPort}'';
|
|
};
|
|
};
|
|
};
|
|
}
|