File tree Expand file tree Collapse file tree 3 files changed +112
-50
lines changed Expand file tree Collapse file tree 3 files changed +112
-50
lines changed Original file line number Diff line number Diff line change 11{ 
22  description   =  "rustc dev shell" ; 
33
4-   inputs   =  { 
5-     nixpkgs . url        =  "github:NixOS/nixpkgs/nixos-unstable" ; 
6-     flake-utils . url    =  "github:numtide/flake-utils" ; 
7-   } ; 
4+   inputs . nixpkgs . url   =  "github:NixOS/nixpkgs/nixos-unstable" ; 
85
9-   outputs   =  {  self ,  nixpkgs ,  flake-utils ,  ... } :
10- 	flake-utils . lib . eachDefaultSystem   ( system :
11-       let 
12-         pkgs   =  import   nixpkgs  {  inherit  system ;  } ; 
13-         x   =  import   ./x  {  inherit  pkgs ;  } ; 
14-       in 
15-       { 
16-         devShells . default   =  with  pkgs ;  mkShell   { 
17-           name   =  "rustc-dev-shell" ; 
18-           nativeBuildInputs   =  with  pkgs ;  [ 
19-             binutils  cmake  ninja  pkg-config  python3  git  curl  cacert  patchelf  nix 
20-           ] ; 
21-           buildInputs   =  with  pkgs ;  [ 
22-             openssl  glibc . out   glibc . static   x 
23-           ] ; 
24-           # Avoid creating text files for ICEs. 
25-           RUSTC_ICE   =  "0" ; 
26-           # Provide `libstdc++.so.6` for the self-contained lld. 
27-           # Provide `libz.so.1`. 
28-           LD_LIBRARY_PATH   =  "${ with  pkgs ;  lib . makeLibraryPath   [ stdenv . cc . cc . lib   zlib ] } " ; 
29-         } ; 
30-       } 
31-     ) ; 
6+   outputs   = 
7+     { 
8+       self , 
9+       nixpkgs , 
10+     } :
11+     let 
12+       inherit  ( nixpkgs )  lib ; 
13+       forEachSystem   =  lib . genAttrs   lib . systems . flakeExposed ; 
14+     in 
15+     { 
16+       devShells   =  forEachSystem   ( system : { 
17+         default   =  nixpkgs . legacyPackages . ${ system } . callPackage   ./shell.nix  {  } ; 
18+       } ) ; 
19+ 
20+       packages   =  forEachSystem   ( system : { 
21+         default   =  nixpkgs . legacyPackages . ${ system } . callPackage   ./x  {  } ; 
22+       } ) ; 
23+     } ; 
3224} 
Original file line number Diff line number Diff line change 1- {  pkgs  ? import   <nixpkgs>  { }  } :
2- let  
3-   x   =  import   ./x  {  inherit  pkgs ;  } ; 
1+ { 
2+   pkgs  ? import   <nixpkgs>  {  } , 
3+ } :
4+ let 
5+   inherit  ( pkgs . lib )  lists  attrsets ; 
6+ 
7+   x   =  pkgs . callPackage   ./x  {  } ; 
8+   inherit  ( x . passthru )  cacert  env ; 
49in 
510pkgs . mkShell   { 
6-   name   =  "rustc" ; 
7-   nativeBuildInputs   =  with  pkgs ;  [ 
8-     binutils  cmake  ninja  pkg-config  python3  git  curl  cacert  patchelf  nix 
9-   ] ; 
10-   buildInputs   =  with  pkgs ;  [ 
11-     openssl  glibc . out   glibc . static   x 
12-   ] ; 
13-   # Avoid creating text files for ICEs. 
14-   RUSTC_ICE   =  "0" ; 
15-   # Provide `libstdc++.so.6` for the self-contained lld. 
16-   # Provide `libz.so.1` 
17-   LD_LIBRARY_PATH   =  "${ with  pkgs ;  lib . makeLibraryPath   [ stdenv . cc . cc . lib   zlib ] } " ; 
11+   name   =  "rustc-shell" ; 
12+ 
13+   inputsFrom   =  [  x  ] ; 
14+   packages   =  [ 
15+     pkgs . git 
16+     pkgs . nix 
17+     pkgs . glibc 
18+     x 
19+     # Get the runtime deps of the x wrapper 
20+   ]  ++  lists . flatten   ( attrsets . attrValues   env ) ; 
21+ 
22+   env   =  { 
23+     # Avoid creating text files for ICEs. 
24+     RUSTC_ICE   =  0 ; 
25+     SSL_CERT_FILE   =  cacert ; 
26+   } ; 
1827} 
Original file line number Diff line number Diff line change 11{ 
2-   pkgs  ? import   <nixpkgs>  {  } , 
2+   pkgs , 
3+   lib , 
4+   stdenv , 
5+   rustc , 
6+   python3 , 
7+   makeBinaryWrapper , 
8+   # Bootstrap 
9+   curl , 
10+   pkg-config , 
11+   libiconv , 
12+   openssl , 
13+   patchelf , 
14+   cacert , 
15+   zlib , 
16+   # LLVM Deps 
17+   ninja , 
18+   cmake , 
19+   glibc , 
320} :
4- pkgs . stdenv . mkDerivation   { 
5-   name   =  "x" ; 
21+ stdenv . mkDerivation   ( self : { 
22+   strictDeps   =  true ; 
23+   name   =  "x-none" ; 
24+ 
25+   outputs   =  [ 
26+     "out" 
27+     "unwrapped" 
28+   ] ; 
629
730  src   =  ./x.rs ; 
831  dontUnpack   =  true ; 
932
10-   nativeBuildInputs   =  with  pkgs ;  [  rustc  ] ; 
33+   nativeBuildInputs   =  [ 
34+     rustc 
35+     makeBinaryWrapper 
36+   ] ; 
1137
38+   env . PYTHON   =  python3 . interpreter ; 
1239  buildPhase   =  '' 
13-     PYTHON= ${ pkgs . lib . getExe   pkgs . python3 }   rustc -Copt-level=3 --crate-name x $src --out-dir $out /bin 
40+     rustc -Copt-level=3 --crate-name x $src --out-dir $unwrapped /bin 
1441  '' ; 
1542
16-   meta   =  with  pkgs . lib ;  { 
43+   installPhase   = 
44+     let 
45+       inherit  ( self . passthru )  cacert  env ; 
46+     in 
47+     '' 
48+       makeWrapper $unwrapped/bin/x $out/bin/x \ 
49+         --set-default SSL_CERT_FILE ${ cacert }  \ 
50+         --prefix CPATH ";" "${ lib . makeSearchPath   "include"  env . cpath } " \ 
51+         --prefix PATH : ${ lib . makeBinPath   env . path }  \ 
52+         --prefix LD_LIBRARY_PATH : ${ lib . makeLibraryPath   env . ldLib }  
53+     '' ; 
54+ 
55+   # For accessing them in the devshell 
56+   passthru   =  { 
57+     env   =  { 
58+       cpath   =  [  libiconv  ] ; 
59+       path   =  [ 
60+         python3 
61+         patchelf 
62+         curl 
63+         pkg-config 
64+         cmake 
65+         ninja 
66+       ] ; 
67+       ldLib   =  [ 
68+         openssl 
69+         glibc . static 
70+         zlib 
71+         stdenv . cc . cc . lib 
72+       ] ; 
73+     } ; 
74+     cacert   =  "${ cacert } /etc/ssl/certs/ca-bundle.crt" ; 
75+   } ; 
76+ 
77+   meta   =  { 
1778    description   =  "Helper for rust-lang/rust x.py" ; 
1879    homepage   =  "https://github.com/rust-lang/rust/blob/master/src/tools/x" ; 
19-     license   =  licenses . mit ; 
80+     license   =  lib . licenses . mit ; 
2081    mainProgram   =  "x" ; 
2182  } ; 
22- } 
83+ } ) 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments