File tree 4 files changed +75
-49
lines changed
4 files changed +75
-49
lines changed Original file line number Diff line number Diff line change
1
+ /nix/store/in1pq3wd1sm6ylnxy2q6aw19gb3h650r-x-none
Original file line number Diff line number Diff line change 1
1
{
2
2
description = "rustc dev shell" ;
3
3
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" ;
8
5
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 { } ;
30
16
}
31
17
) ;
18
+ } ;
32
19
}
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 { } ;
4
3
in
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
+ strictDeps = true ;
6
+ pname = "rustc-shell" ;
7
+ version = "none" ;
8
+
9
+ packages = let
10
+ p = pkgs ;
11
+ in [
12
+ p . git
13
+ p . nix
14
+ p . glibc
15
+ x
16
+ ] ;
17
+
18
+ env = {
19
+ # Avoid creating text files for ICEs.
20
+ RUSTC_ICE = 0 ;
21
+ } ;
22
+ }
Original file line number Diff line number Diff line change 1
1
{
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
3
21
} :
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
+ ] ;
6
31
7
32
src = ./x.rs ;
8
33
dontUnpack = true ;
9
34
10
- nativeBuildInputs = with pkgs ; [ rustc ] ;
35
+ nativeBuildInputs = [ rustc makeBinaryWrapper ] ;
11
36
37
+ env . PYTHON = python3 . interpreter ;
12
38
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
14
40
'' ;
15
41
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 = {
17
51
description = "Helper for rust-lang/rust x.py" ;
18
52
homepage = "https://github.com/rust-lang/rust/blob/master/src/tools/x" ;
19
- license = licenses . mit ;
53
+ license = lib . licenses . mit ;
20
54
mainProgram = "x" ;
21
55
} ;
22
56
}
You can’t perform that action at this time.
0 commit comments