mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 11:39:46 +01:00
60 lines
1.3 KiB
Nix
60 lines
1.3 KiB
Nix
|
{ 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 = {
|
||
|
enable = mkEnableOption "Pueue, CLI process scheduler and manager";
|
||
|
|
||
|
package = mkPackageOption pkgs "pueue" { };
|
||
|
|
||
|
settings = mkOption {
|
||
|
type = yamlFormat.type;
|
||
|
default = { };
|
||
|
example = literalExpression ''
|
||
|
{
|
||
|
daemon = {
|
||
|
default_parallel_tasks = 2;
|
||
|
};
|
||
|
}
|
||
|
'';
|
||
|
description = ''
|
||
|
Configuration written to
|
||
|
<filename>$XDG_CONFIG_HOME/pueue/pueue.yml</filename>.
|
||
|
'';
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
assertions =
|
||
|
[ (hm.assertions.assertPlatform "services.pueue" pkgs platforms.linux) ];
|
||
|
|
||
|
home.packages = [ cfg.package ];
|
||
|
|
||
|
xdg.configFile."pueue/pueue.yml".source = configFile;
|
||
|
|
||
|
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" ];
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
}
|