From c847a43b6747f88fc6e5a8b1d925b3fcc2b7cdda Mon Sep 17 00:00:00 2001 From: Austin Seipp Date: Fri, 9 Dec 2022 09:22:19 -0600 Subject: [PATCH] sapling: fix nodejs path, add enableMinimal option This change fixes the path to 'nodejs' in the Sapling scripts, so that the 'sl web' command works OOTB even if the user has a fresh `$PATH` without node itself. However, this is really a developer-only tool, and isn't needed just to e.g. clone repositories. In particular, a 'fetchSapling' codepath would not need it; therefore we make it optional, but turned on by default. The intention is to have a 'saplingMinimal' expression which can be used for that path. NOTE: this does NOT add a 'saplingMinimal' expression to all-packages.nix; that would just result in more Hydra churn, so we avoid it for now. Signed-off-by: Austin Seipp --- pkgs/applications/version-management/sapling/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/applications/version-management/sapling/default.nix b/pkgs/applications/version-management/sapling/default.nix index 5827ad915afa..172c262005fb 100644 --- a/pkgs/applications/version-management/sapling/default.nix +++ b/pkgs/applications/version-management/sapling/default.nix @@ -17,6 +17,8 @@ , CoreFoundation , CoreServices , Security + +, enableMinimal ? false }: let @@ -129,10 +131,17 @@ let # 1) This applies on all systems (so no conditional a la postFixup) # 2) This doesn't require any kind of fixup itself, so we leave it out # of postFixup for that reason, too + # 3) If asked, we optionally patch in a hardcoded path to the 'nodejs' package, + # so that 'sl web' always works + # 4) 'sl web' will still work if 'nodejs' is in $PATH, just not OOTB preFixup = '' sitepackages=$out/lib/${python38Packages.python.libPrefix}/site-packages chmod +w $sitepackages cp -r ${isl} $sitepackages/edenscm-isl + '' + lib.optionalString (!enableMinimal) '' + chmod +w $sitepackages/edenscm-isl/run-isl + substituteInPlace $sitepackages/edenscm-isl/run-isl \ + --replace 'NODE=node' 'NODE=${nodejs}/bin/node' ''; postFixup = lib.optionalString stdenv.isLinux ''