From 1911e2575bc7291b4c5d9243298636ec2088a09b Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Sat, 20 Jan 2024 17:21:27 +0800 Subject: [PATCH] home-manager/mutable-files: put postScript in `Service.ExecStartPost` systemd directive --- modules/home-manager/files/mutable-files.nix | 23 ++++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/home-manager/files/mutable-files.nix b/modules/home-manager/files/mutable-files.nix index f4c3095c..03182113 100644 --- a/modules/home-manager/files/mutable-files.nix +++ b/modules/home-manager/files/mutable-files.nix @@ -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" ];