2022-08-13 04:37:04 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.pueue;
|
|
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
|
|
configFile = yamlFormat.generate "pueue.yaml" cfg.settings;
|
|
|
|
|
|
|
|
in {
|
|
|
|
meta.maintainers = [ maintainers.AndersonTorres ];
|
|
|
|
|
|
|
|
options.services.pueue = {
|
2023-07-01 01:30:13 +02:00
|
|
|
enable =
|
|
|
|
mkEnableOption (lib.mdDoc "Pueue, CLI process scheduler and manager");
|
2022-08-13 04:37:04 +02:00
|
|
|
|
2023-07-01 11:41:32 +02:00
|
|
|
package = mkPackageOptionMD pkgs "pueue" { };
|
2022-08-13 04:37:04 +02:00
|
|
|
|
|
|
|
settings = mkOption {
|
|
|
|
type = yamlFormat.type;
|
|
|
|
default = { };
|
|
|
|
example = literalExpression ''
|
|
|
|
{
|
|
|
|
daemon = {
|
|
|
|
default_parallel_tasks = 2;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
'';
|
2023-07-01 01:30:13 +02:00
|
|
|
description = lib.mdDoc ''
|
2022-08-13 04:37:04 +02:00
|
|
|
Configuration written to
|
2023-07-01 01:30:13 +02:00
|
|
|
{file}`$XDG_CONFIG_HOME/pueue/pueue.yml`.
|
2022-08-13 04:37:04 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
assertions =
|
|
|
|
[ (hm.assertions.assertPlatform "services.pueue" pkgs platforms.linux) ];
|
|
|
|
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
2022-09-17 06:48:51 +02:00
|
|
|
xdg.configFile =
|
|
|
|
mkIf (cfg.settings != { }) { "pueue/pueue.yml".source = configFile; };
|
2022-08-13 04:37:04 +02:00
|
|
|
|
|
|
|
systemd.user = {
|
|
|
|
services.pueued = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Pueue Daemon - CLI process scheduler and manager";
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
Restart = "on-failure";
|
|
|
|
ExecStart = "${cfg.package}/bin/pueued -v -c ${configFile}";
|
|
|
|
};
|
|
|
|
|
|
|
|
Install.WantedBy = [ "default.target" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|