File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1313 darwin ,
1414 nodePackages ,
1515 buildNpmPackage ,
16+ installShellFiles ,
17+ makeWrapper ,
1618} :
1719version : source :
1820let
2931 # build issues with Node 22+. Spago 0.93.45+ works with the standard nodejs.
3032 # See: https://github.com/purescript/registry-dev/blob/87c5900ff6fb7090cf2b085b7eb3f75371560522/nix/overlay.nix#L152
3133 isLegacySpago = isSpago && builtins . compareVersions version "0.93.45" < 0 ;
34+
3235in
3336# Simple tarball without dependencies - just extract and link
3437if isSimpleTarball then
7477 spagoNativeBuildInputs = [
7578 nodePackages . node-gyp
7679 python3
80+ makeWrapper
81+ installShellFiles
7782 ]
7883 ++ lib . optionals stdenv . isDarwin [ darwin . cctools ] ;
7984 in
@@ -101,5 +106,21 @@ else
101106 "--omit=optional"
102107 ] ;
103108
109+ # For spago: Replace the symlink with a wrapper that invokes node directly
110+ # with the script renamed via a symlink. This fixes spago displaying
111+ # "Usage: bundle.js" instead of "Usage: spago" (Node.js uses the script
112+ # path for the program name). Also generate shell completions.
113+ postInstall = lib . optionalString isSpago ''
114+ rm $out/bin/${ name }
115+ ln -s $out/lib/node_modules/${ name } /${ js } $out/lib/node_modules/${ name } /bin/${ name }
116+ makeWrapper ${ selectedNodejs } /bin/node $out/bin/${ name } \
117+ --add-flags $out/lib/node_modules/${ name } /bin/${ name }
118+
119+ installShellCompletion --cmd ${ name } \
120+ --bash <($out/bin/${ name } --bash-completion-script $out/bin/${ name } ) \
121+ --zsh <($out/bin/${ name } --zsh-completion-script $out/bin/${ name } ) \
122+ --fish <($out/bin/${ name } --fish-completion-script $out/bin/${ name } )
123+ '' ;
124+
104125 meta = commonMeta ;
105126 }
You can’t perform that action at this time.
0 commit comments