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> {
196
196
title : "Patching rust-analysis for NixOS"
197
197
} ,
198
198
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 = `
202
200
{src, pkgs ? import <nixpkgs> {}}:
203
201
pkgs.stdenv.mkDerivation {
204
202
name = "rust-analyzer";
@@ -210,19 +208,21 @@ async function patchelf(dest: PathLike): Promise<void> {
210
208
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out
211
209
'';
212
210
}
213
- ` ) ;
211
+ ` ;
214
212
const origFile = dest + "-orig" ;
215
213
await fs . rename ( dest , origFile ) ;
216
214
progress . report ( { message : "Patching executable" , increment : 20 } ) ;
217
215
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 } ` ,
219
217
( err , stdout , stderr ) => {
220
218
if ( err != null ) {
221
219
reject ( Error ( stderr ) ) ;
222
220
} else {
223
221
resolve ( stdout ) ;
224
222
}
225
223
} ) ;
224
+ handle . stdin ?. write ( expression ) ;
225
+ handle . stdin ?. end ( ) ;
226
226
} ) ;
227
227
await fs . unlink ( origFile ) ;
228
228
}
You can’t perform that action at this time.
0 commit comments