Add prototype raker module to the Nix flake
All checks were successful
continuous-integration/drone the build was successful
All checks were successful
continuous-integration/drone the build was successful
This commit is contained in:
parent
588d5bdf54
commit
23733efd3f
@ -42,6 +42,7 @@
|
|||||||
# NixOS Modules
|
# NixOS Modules
|
||||||
nixosModules = {
|
nixosModules = {
|
||||||
quickpeepSearch = import ./modules/quickpeepSearch.nix self;
|
quickpeepSearch = import ./modules/quickpeepSearch.nix self;
|
||||||
|
quickpeepRaker = import ./modules/quickpeepRaker.nix self;
|
||||||
};
|
};
|
||||||
|
|
||||||
# `nix run`
|
# `nix run`
|
||||||
|
88
nix_flake/modules/quickpeepRaker.nix
Normal file
88
nix_flake/modules/quickpeepRaker.nix
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
flake: {config, pkgs, lib, ...}:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.services.quickpeepRaker;
|
||||||
|
inherit (flake.packages.${pkgs.stdenv.hostPlatform.system}) quickpeep;
|
||||||
|
in
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
services.quickpeepRaker = {
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
type = with types; bool;
|
||||||
|
description = ''
|
||||||
|
Start the QuickPeep Raker.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
user = mkOption {
|
||||||
|
default = "quickpeep";
|
||||||
|
type = with types; uniq str;
|
||||||
|
description = ''
|
||||||
|
Name of the user.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# metricsBind = mkOption {
|
||||||
|
# default = null;
|
||||||
|
# example = "127.0.0.1:1234";
|
||||||
|
# type = with types; nullOr str;
|
||||||
|
# description = ''
|
||||||
|
# Host and port upon which to bind the Prometheus/OpenMetrics interface.
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
|
||||||
|
configPath = mkOption {
|
||||||
|
type = with types; path;
|
||||||
|
description = ''
|
||||||
|
Config path to use, in RON format.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
concurrency = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 8;
|
||||||
|
description = ''
|
||||||
|
Number of concurrent fetches to allow.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
sleepers = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 56;
|
||||||
|
description = ''
|
||||||
|
An additional number of tasks to permit in the sleeping state.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
users.users."${cfg.user}" = {
|
||||||
|
description = "QuickPeep User";
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "${cfg.user}";
|
||||||
|
};
|
||||||
|
users.groups."${cfg.user}" = {};
|
||||||
|
|
||||||
|
systemd.services.quickpeepRaker = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" ];
|
||||||
|
description = "Rakes websites and converts them to an indexable format.";
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
QUICKPEEP_CONFIG = cfg.configPath;
|
||||||
|
};
|
||||||
|
serviceConfig = {
|
||||||
|
# TODO disable automatic restart?
|
||||||
|
# TODO start it on a timer to ensure it picks up updates to stuff..?
|
||||||
|
Type = "simple";
|
||||||
|
User = "${cfg.user}";
|
||||||
|
ExecStart = ''${quickpeep}/bin/qp-raker --config ${cfg.configPath} --concurrency ${builtins.toString cfg.concurrency} --sleepers ${builtins.toString cfg.sleepers}'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user