File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -196,9 +196,7 @@ async function patchelf(dest: PathLike): Promise<void> {
196196 title : "Patching rust-analysis for NixOS"
197197 } ,
198198 async ( progress , _ ) => {
199- const patchPath = path . join ( os . tmpdir ( ) , "patch-ra.nix" ) ;
200- progress . report ( { message : "Writing nix file" , increment : 5 } ) ;
201- await fs . writeFile ( patchPath , `
199+ const expression = `
202200 {src, pkgs ? import <nixpkgs> {}}:
203201 pkgs.stdenv.mkDerivation {
204202 name = "rust-analyzer";
@@ -210,19 +208,21 @@ async function patchelf(dest: PathLike): Promise<void> {
210208 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out
211209 '';
212210 }
213- ` ) ;
211+ ` ;
214212 const origFile = dest + "-orig" ;
215213 await fs . rename ( dest , origFile ) ;
216214 progress . report ( { message : "Patching executable" , increment : 20 } ) ;
217215 await new Promise ( ( resolve , reject ) => {
218- exec ( `nix-build ${ patchPath } --arg src '${ origFile } ' -o ${ dest } ` ,
216+ const handle = exec ( `nix-build -E - --arg src '${ origFile } ' -o ${ dest } ` ,
219217 ( err , stdout , stderr ) => {
220218 if ( err != null ) {
221219 reject ( Error ( stderr ) ) ;
222220 } else {
223221 resolve ( stdout ) ;
224222 }
225223 } ) ;
224+ handle . stdin ?. write ( expression ) ;
225+ handle . stdin ?. end ( ) ;
226226 } ) ;
227227 await fs . unlink ( origFile ) ;
228228 }
You can’t perform that action at this time.
0 commit comments