fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3with lib ; 4 5let 6 7cfg = config . services . pueue ; 8yamlFormat = pkgs . formats . yaml { }; 9configFile = yamlFormat . generate "pueue.yaml" cfg . settings ; 10 11in { 12meta . maintainers = [ maintainers . AndersonTorres ]; 13 14options . services . pueue = { 15enable = mkEnableOption "Pueue, CLI process scheduler and manager" ; 16 17package = mkPackageOption pkgs "pueue" { }; 18 19settings = mkOption { 20type = yamlFormat . type ; 21default = { }; 22example = literalExpression '' 23{ 24daemon = { 25default_parallel_tasks = 2; 26}; 27} 28'' ; 29description = '' 30Configuration written to 31{file}`$XDG_CONFIG_HOME/pueue/pueue.yml`. 32'' ; 33}; 34}; 35 36config = mkIf cfg . enable { 37assertions = 38[ ( hm . assertions . assertPlatform "services.pueue" pkgs platforms . linux ) ]; 39 40home . packages = [ cfg . package ]; 41 42xdg . configFile = 43mkIf ( cfg . settings != { }) { "pueue/pueue.yml" . source = configFile ; }; 44 45systemd . user = { 46services . pueued = { 47Unit = { 48Description = "Pueue Daemon - CLI process scheduler and manager" ; 49}; 50 51Service = { 52Restart = "on-failure" ; 53ExecStart = " ${ cfg . package } /bin/pueued -v -c ${ configFile } " ; 54}; 55 56Install . WantedBy = [ "default.target" ]; 57}; 58}; 59}; 60}