home-manager/mutable-files: put postScript in Service.ExecStartPost systemd directive

This commit is contained in:
Gabriel Arazas 2024-01-20 17:21:27 +08:00
parent ae735065a7
commit 1911e2575b
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC

View File

@ -155,17 +155,12 @@ in
Type = "oneshot";
RemainAfterExit = true;
ExecStart =
let
mutableFilesCmds = lib.mapAttrsToList
(path: value:
let
fetchScript' = (fetchScript path value).${value.type};
in
''
${fetchScript'}
${value.postScript}
'')
(fetchScript path value).${value.type})
cfg;
script = pkgs.writeShellApplication {
@ -175,6 +170,20 @@ in
};
in
"${script}/bin/fetch-mutable-files";
ExecStartPost =
let
mutableFilesCmds = lib.mapAttrsToList
(path: value: value.postScript)
cfg;
script = pkgs.writeShellApplication {
name = "fetch-mutable-files-post-script";
runtimeInputs = with pkgs; [ archiver curl git gopass ];
text = lib.concatStringsSep "\n" mutableFilesCmds;
};
in
"${script}/bin/fetch-mutable-files-post-script";
};
Install.WantedBy = [ "default.target" ];