{ config, service, pkgs }: let inherit (pkgs) writeShellScriptBin; in { Unit = { Description = "${service} service"; X-Restart-Triggers = [ "${config.repo-clone.pkg}" ]; }; Service = { Type = "exec"; ExecStart = let execName = service; script = writeShellScriptBin execName '' while IFS="" read -r p || [ -n "$p" ] do args=($p) echo ''${args[0]} echo ''${args[1]} done < "${config.repo-clone.pkg}" ''; in "${script}/bin/${execName}"; RemainAfterExit = "yes"; }; Install.WantedBy = [ "multi-user.target" ]; }