From 0a961f691c4da1e7edc0c23afd6e8d6765499ce0 Mon Sep 17 00:00:00 2001 From: Marien Zwart Date: Thu, 26 Dec 2024 13:58:44 +1100 Subject: [PATCH] Omit symlinks to avoid a file collision This should support parallel installs of comma with the small db and nix-locate with the full db. --- comma-wrapper.nix | 8 +++----- nix-index-wrapper.nix | 7 +++---- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/comma-wrapper.nix b/comma-wrapper.nix index 9c9a8bc9..095eafb0 100644 --- a/comma-wrapper.nix +++ b/comma-wrapper.nix @@ -1,5 +1,5 @@ { - lib, + linkFarm, symlinkJoin, makeBinaryWrapper, comma, @@ -13,13 +13,11 @@ symlinkJoin { name = "comma-with-db-${comma.version}"; paths = [ commaOverridden ]; nativeBuildInputs = [ makeBinaryWrapper ]; + databaseDirectory = linkFarm "nix-index-database" { files = nix-index-database; }; postBuild = '' - mkdir -p $out/share/cache/nix-index - ln -s ${nix-index-database} $out/share/cache/nix-index/files - for cmd in "," "comma"; do wrapProgram "$out/bin/$cmd" \ - --set NIX_INDEX_DATABASE $out/share/cache/nix-index + --set NIX_INDEX_DATABASE $databaseDirectory done ''; diff --git a/nix-index-wrapper.nix b/nix-index-wrapper.nix index aa27759e..9fc823a0 100644 --- a/nix-index-wrapper.nix +++ b/nix-index-wrapper.nix @@ -1,4 +1,5 @@ { + linkFarm, symlinkJoin, makeBinaryWrapper, nix-index-unwrapped, @@ -9,12 +10,10 @@ symlinkJoin { name = "nix-index-with-${db-type}-db-${nix-index-unwrapped.version}"; paths = [ nix-index-unwrapped ]; nativeBuildInputs = [ makeBinaryWrapper ]; + databaseDirectory = linkFarm "nix-index-database" { files = nix-index-database; }; postBuild = '' - mkdir -p $out/share/cache/nix-index - ln -s ${nix-index-database} $out/share/cache/nix-index/files - wrapProgram $out/bin/nix-locate \ - --set NIX_INDEX_DATABASE $out/share/cache/nix-index + --set NIX_INDEX_DATABASE $databaseDirectory mkdir -p $out/etc/profile.d rm -f "$out/etc/profile.d/command-not-found.sh"