zed: make cli link activation script idempotent
1 file changed, 8 insertions(+), 3 deletions(-)
changed files
M user/settings/zed.nix → user/settings/zed.nix
@@ -218,12 +218,17 @@ let inherit (config.targets.darwin) copyApps; inherit (config.home) homeDirectory; cli = "${homeDirectory}/${copyApps.directory}/Zed.App/Contents/MacOS/cli"; + + source = lib.escapeShellArg cli; + target = "${lib.escapeShellArg config.xdg.binHome}/zed"; + test = ''test ! \( -L ${target} -a "$(readlink "${target}")" = ${source} \)''; in lib.mkIf (copyApps.enable && config.programs.zed-editor.package != null) { zed-link-cli-bin = lib.hm.dag.entryAfter [ "writeBoundary" ] '' - run ln -s $VERBOSE_ARG \ - ${lib.escapeShellArg cli} \ - ${lib.escapeShellArg config.xdg.binHome}/zed + verboseEcho ${test} + if ${test}; then + run ln -s $VERBOSE_ARG ${source} ${target} + fi ''; }; }