File tree Expand file tree Collapse file tree 3 files changed +70
-49
lines changed Expand file tree Collapse file tree 3 files changed +70
-49
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- } ;
6+ outputs = {
7+ self ,
8+ nixpkgs ,
9+ } : let
10+ inherit ( nixpkgs ) lib ;
11+ forEachSystem = lib . genAttrs lib . systems . flakeExposed ;
12+ in {
13+ devShells = forEachSystem (
14+ system : {
15+ default = nixpkgs . legacyPackages . ${ system } . callPackage ./shell.nix { } ;
3016 }
3117 ) ;
18+ } ;
3219}
Original file line number Diff line number Diff line change 1- { pkgs ? import <nixpkgs> { } } :
2- let
3- x = import ./x { inherit pkgs ; } ;
1+ { pkgs ? import <nixpkgs> { } } : let
2+ x = pkgs . callPackage ./x { } ;
43in
5- pkgs . 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 ] } " ;
18- }
4+ pkgs . mkShell {
5+ name = "rustc-shell" ;
6+
7+ packages = [
8+ pkgs . git
9+ pkgs . nix
10+ pkgs . glibc
11+ x
12+ ] ;
13+
14+ env = {
15+ # Avoid creating text files for ICEs.
16+ RUSTC_ICE = 0 ;
17+ } ;
18+ }
Original file line number Diff line number Diff line change 11{
2- pkgs ? import <nixpkgs> { } ,
2+ self ,
3+ pkgs ,
4+ lib ,
5+ stdenv ,
6+ rustc ,
7+ python3 ,
8+ makeBinaryWrapper ,
9+ # Bootstrap
10+ curl ,
11+ pkg-config ,
12+ libiconv ,
13+ openssl ,
14+ patchelf ,
15+ cacert ,
16+ zlib ,
17+ # LLVM Deps
18+ ninja ,
19+ cmake ,
20+ glibc
321} :
4- pkgs . stdenv . mkDerivation {
5- name = "x" ;
22+ stdenv . mkDerivation {
23+ strictDeps = true ;
24+ pname = "x" ;
25+ version = "none" ;
26+
27+ outputs = [
28+ "out"
29+ "unwrapped"
30+ ] ;
631
732 src = ./x.rs ;
833 dontUnpack = true ;
934
10- nativeBuildInputs = with pkgs ; [ rustc ] ;
35+ nativeBuildInputs = [ rustc makeBinaryWrapper ] ;
1136
37+ env . PYTHON = python3 . interpreter ;
1238 buildPhase = ''
13- PYTHON= ${ pkgs . lib . getExe pkgs . python3 } rustc -Copt-level=3 --crate-name x $src --out-dir $out /bin
39+ rustc -Copt-level=3 --crate-name x $src --out-dir $unwrapped /bin
1440 '' ;
1541
16- meta = with pkgs . lib ; {
42+ installPhase = ''
43+ makeWrapper $unwrapped/bin/x $out/bin/x \
44+ --set-default SSL_CERT_FILE "${ cacert } /etc/ssl/certs/ca-bundle.crt" \
45+ --prefix CPATH ";" "${ lib . makeSearchPath "include" [ libiconv ] } " \
46+ --prefix PATH : ${ lib . makeBinPath [ python3 patchelf curl pkg-config cmake ninja ] } \
47+ --prefix LD_LIBRARY_PATH : ${ lib . makeLibraryPath [ openssl glibc . static zlib stdenv . cc . cc . lib ] }
48+ '' ;
49+
50+ meta = {
1751 description = "Helper for rust-lang/rust x.py" ;
1852 homepage = "https://github.com/rust-lang/rust/blob/master/src/tools/x" ;
19- license = licenses . mit ;
53+ license = lib . licenses . mit ;
2054 mainProgram = "x" ;
2155 } ;
2256}
You can’t perform that action at this time.
0 commit comments