about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoispha <soispha@vhack.eu>2024-01-14 13:30:17 +0100
committerSoispha <soispha@vhack.eu>2024-01-14 13:30:17 +0100
commitcdf4ddeda521a4c3d02d459c25180964c1808953 (patch)
tree4f33d39bf2905253bb8d8e6b830cee4e29e3e33f
parentfix(sys/nixpkgs/ytc): Check if symlink path exists (diff)
downloadnixos-config-cdf4ddeda521a4c3d02d459c25180964c1808953.tar.gz
nixos-config-cdf4ddeda521a4c3d02d459c25180964c1808953.zip
fix(hm/files/manifest_json): Make the ln idempotent
Diffstat (limited to '')
-rw-r--r--hm/soispha/files/manifest_json/default.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/hm/soispha/files/manifest_json/default.nix b/hm/soispha/files/manifest_json/default.nix
index abc2e065..af8d85d2 100644
--- a/hm/soispha/files/manifest_json/default.nix
+++ b/hm/soispha/files/manifest_json/default.nix
@@ -7,7 +7,10 @@
     activation = {
       addManifestJson =
         lib.hm.dag.entryAfter ["writeBoundary"]
-        ''$DRY_RUN_CMD ln -s $VERBOSE_ARG "${./profile}" "${config.xdg.stateHome}/nix/profiles/"'';
+        ''
+          [ -L "${config.xdg.stateHome}/nix/profiles/profile" ] && $DRY_RUN_CMD rm $VERBOSE_ARG "${config.xdg.stateHome}/nix/profiles/profile"
+          $DRY_RUN_CMD ln -s $DRY_RUN_CMD "${./profile}" "${config.xdg.stateHome}/nix/profiles/profile"
+        '';
     };
   };
 }