summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/flake.nix b/flake.nix
index b8230de..56146ab 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,6 +2,10 @@
   inputs = {
     nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
     flake-parts = { url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; };
+    fenix = {
+      url = "github:nix-community/fenix";
+      inputs.nixpkgs.follows = "nixpkgs";
+    };
     treefmt-nix.url = "github:numtide/treefmt-nix";
   };
 
@@ -10,14 +14,18 @@
       systems = [ "x86_64-linux" ];
       imports = [ inputs.treefmt-nix.flakeModule ];
 
-      perSystem = { pkgs, lib, config, ... }:
+      perSystem = { pkgs, lib, config, system, ... }:
         let
+          toolchain = inputs.fenix.packages.${system}.minimal.toolchain;
           src = lib.sourceFilesBySuffices inputs.self [ ".rs" ".toml" "Cargo.lock" ];
           inherit (lib.importTOML (src + "/Cargo.toml")) package;
         in
         {
           packages = {
-            ${package.name} = pkgs.rustPlatform.buildRustPackage {
+            ${package.name} = (pkgs.makeRustPlatform {
+              cargo = toolchain;
+              rustc = toolchain;
+            }).buildRustPackage {
               pname = package.name;
               inherit (package) version;
               inherit src;