all repos — nixfiles @ 0ca708a8e576f7c95802bb0ce61d4758d9950084

System and user configuration, managed by nix and home-manager

zed: make cli link activation script idempotent

Alin
commit

0ca708a8e576f7c95802bb0ce61d4758d9950084

parent

2d631f19d1c67d277e416b86812b7dc0f3919b43

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 ''; }; }