File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- use nix # --arg isIdea true --arg nixpkgs '<nixpkgs>'
1+ # isIdea: whether to write the current rust toolchain into `.idea/workspace.xml`, defaults to false
2+ # nixpkgs: the path to a nixpkgs checkout, defaults to a pinned version
3+ # mkToolchain: a function taking a fenix instance and returning a toolchain, defaults to `fenix: fenix.complete`
4+ use nix # \
5+ # --arg isIdea true \
6+ # --arg nixpkgs '<nixpkgs>' \
7+ # --arg mkToolchain 'fenix: fenix.beta'
Original file line number Diff line number Diff line change 11{
22 nixpkgs ? fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-25.05.tar.gz" ,
3- pkgs ? import nixpkgs { } ,
4- fenix ?
5- ( import ( fetchTarball "https://github.com/nix-community/fenix/archive/monthly.tar.gz" ) {
6- inherit pkgs ;
7- } ) . complete ,
3+ fenix-src ? fetchTarball "https://github.com/nix-community/fenix/archive/monthly.tar.gz" ,
4+
5+ mkToolchain ? fenix : fenix . complete ,
86 isIdea ? false ,
97} :
8+ let
9+ pkgs = import nixpkgs { } ;
10+ fenix = import fenix-src { inherit pkgs ; } ;
11+ toolchain = mkToolchain fenix ;
12+ in
1013pkgs . mkShell rec {
1114 buildInputs = with pkgs ; [
1215 nixfmt-rfc-style
@@ -17,11 +20,11 @@ pkgs.mkShell rec {
1720
1821 openssl
1922 pkg-config
20- fenix . toolchain
23+ toolchain . toolchain
2124 ] ;
2225
2326 RUST_BACKTRACE = 1 ;
24- RUST_SRC_PATH = "${ fenix . rust-src } /lib/rustlib/src/rust/library" ;
27+ RUST_SRC_PATH = "${ toolchain . rust-src } /lib/rustlib/src/rust/library" ;
2528
2629 shellHook =
2730 let
@@ -31,7 +34,7 @@ pkgs.mkShell rec {
3134 pkgs . lib . optionalString isIdea ''
3235 sed -i \
3336 -e "s|$(${ xidel } .idea/workspace.xml -e '${ pathFor "explicitPathToStdlib" } ')|${ RUST_SRC_PATH } |" \
34- -e "s|$(${ xidel } .idea/workspace.xml -e '${ pathFor "toolchainHomeDirectory" } ')|${ fenix . toolchain } /bin|" \
37+ -e "s|$(${ xidel } .idea/workspace.xml -e '${ pathFor "toolchainHomeDirectory" } ')|${ toolchain . toolchain } /bin|" \
3538 .idea/workspace.xml
3639 '' ;
3740}
You can’t perform that action at this time.
0 commit comments