repo-clone/service.nix

31 lines
653 B
Nix
Raw Normal View History

2024-08-01 08:48:41 +00:00
{ 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 ''
2024-08-01 09:10:43 +00:00
while IFS="" read -r p || [ -n "$p" ]
do
2024-08-01 09:27:13 +00:00
args=($p)
echo ''${args[0]}
echo ''${args[1]}
2024-08-01 09:10:43 +00:00
done < "${config.repo-clone.pkg}"
2024-08-01 08:48:41 +00:00
'';
in
"${script}/bin/${execName}";
RemainAfterExit = "yes";
};
Install.WantedBy = [ "multi-user.target" ];
}