From ea85f4b1fdf3f25cf97dc49f4a9ec4eafda2ea25 Mon Sep 17 00:00:00 2001 From: sudosubin Date: Sun, 27 Feb 2022 14:19:53 +0900 Subject: [PATCH] launchd: fix multiple agents --- modules/launchd/default.nix | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix index 5d4bbfe75..17b36cdb9 100644 --- a/modules/launchd/default.nix +++ b/modules/launchd/default.nix @@ -42,19 +42,19 @@ let mapAttrs' (n: v: nameValuePair "${v.config.Label}.plist" (toAgent v.config)) (filterAttrs (n: v: v.enable) cfg.agents); - agentsDrv = pkgs.runCommand "home-manager-agents" { - srcs = attrValues agentPlists; - dsts = attrNames agentPlists; - } '' + agentsDrv = pkgs.runCommand "home-manager-agents" { } '' mkdir -p "$out" - if [[ -n "$srcs" ]]; then - for (( i=0; i < "''${#srcs[@]}"; i+=1 )); do - src="''${srcs[i]}" - dst="''${dsts[i]}" - ln -s "$src" "$out/$dst" - done - fi + declare -A plists + plists=(${ + concatStringsSep " " + (mapAttrsToList (name: value: "['${name}']='${value}'") agentPlists) + }) + + for dest in "''${!plists[@]}"; do + src="''${plists[$dest]}" + ln -s "$src" "$out/$dest" + done ''; in { meta.maintainers = with maintainers; [ midchildan ];