Skip to content

Commit 5363d45

Browse files
authored
Merge pull request #5 from blaggacao/main
fix: devshell cargo version
2 parents 870af56 + 0838e5a commit 5363d45

File tree

2 files changed

+62
-12
lines changed

2 files changed

+62
-12
lines changed

flake.lock

+45-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+17-7
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
flakeCompat.url = github:edolstra/flake-compat;
44
flakeCompat.flake = false;
55
flakeUtils.url = "github:numtide/flake-utils";
6-
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
6+
nixpkgs.follows = "fenix/nixpkgs";
7+
# add https://app.cachix.org/cache/nix-community to your `nix.conf`
8+
fenix.url = "github:nix-community/fenix";
79
};
810
outputs =
911
inputs:
1012
inputs.flakeUtils.lib.eachDefaultSystem
1113
(
1214
system:
1315
let
16+
toolchain = "stable";
1417
nixpkgs = import inputs.nixpkgs { inherit system; };
1518
cargoToml = builtins.fromTOML ( builtins.readFile ./Cargo.toml );
1619
in
@@ -21,7 +24,9 @@
2124
};
2225
defaultApp = { type = "app"; program = "${ inputs.self.defaultPackage.${ system } }/bin/alejandra"; };
2326
defaultPackage =
24-
nixpkgs.rustPlatform.buildRustPackage
27+
(nixpkgs.makeRustPlatform {
28+
inherit (inputs.fenix.packages.${ system }.${ toolchain }) cargo rustc;
29+
}).buildRustPackage
2530
{
2631
pname = cargoToml.package.name;
2732
version =
@@ -43,11 +48,16 @@
4348
devShell =
4449
nixpkgs.mkShell
4550
{
46-
packages = [ nixpkgs.cargo-tarpaulin nixpkgs.rustup ];
47-
shellHook =
48-
''
49-
rustup toolchain install nightly
50-
'';
51+
packages = [
52+
inputs.fenix.packages.${ system }.rust-analyzer
53+
(inputs.fenix.packages.${ system }.${ toolchain }.withComponents [
54+
"cargo"
55+
"clippy"
56+
"rust-src"
57+
"rustc"
58+
"rustfmt"
59+
])
60+
];
5161
};
5262
packages = {
5363
nixpkgsFormatted =

0 commit comments

Comments
 (0)