mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-01 06:31:04 +01:00
Some files don't need nesting and can be root level again to reduce conflicts with other PRs. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
63 lines
1.4 KiB
Nix
63 lines
1.4 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
|
|
cfg = config.services.pueue;
|
|
yamlFormat = pkgs.formats.yaml { };
|
|
configFile = yamlFormat.generate "pueue.yaml" ({ shared = { }; } // cfg.settings);
|
|
|
|
in
|
|
{
|
|
meta.maintainers = [ lib.maintainers.AndersonTorres ];
|
|
|
|
options.services.pueue = {
|
|
enable = lib.mkEnableOption "Pueue, CLI process scheduler and manager";
|
|
|
|
package = lib.mkPackageOption pkgs "pueue" { nullable = true; };
|
|
|
|
settings = lib.mkOption {
|
|
type = yamlFormat.type;
|
|
default = { };
|
|
example = lib.literalExpression ''
|
|
{
|
|
daemon = {
|
|
default_parallel_tasks = 2;
|
|
};
|
|
}
|
|
'';
|
|
description = ''
|
|
Configuration written to
|
|
{file}`$XDG_CONFIG_HOME/pueue/pueue.yml`.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
assertions = [
|
|
(lib.hm.assertions.assertPlatform "services.pueue" pkgs lib.platforms.linux)
|
|
];
|
|
|
|
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
|
|
|
xdg.configFile."pueue/pueue.yml".source = configFile;
|
|
|
|
systemd.user = lib.mkIf (cfg.package != null) {
|
|
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" ];
|
|
};
|
|
};
|
|
};
|
|
}
|