From 5eef211c59fccf7995c1dbe4c65a8948794be523 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 17 Dec 2021 01:05:51 +0100 Subject: [PATCH] flake.nix: switch from mozillapkgs to fenix --- flake.lock | 42 ++++++++++++++++++++++++++++++++---------- flake.nix | 27 ++++++++++++++++----------- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index 174fc97..bf1a15a 100644 --- a/flake.lock +++ b/flake.lock @@ -1,18 +1,23 @@ { "nodes": { - "mozillapkgs": { - "flake": false, + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, "locked": { - "lastModified": 1634833229, - "narHash": "sha256-uDbVCkW91/AY87mTwm8XrX2E133LTFqwYsYNNxBcY9M=", - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "rev": "6070a8ee799f629cb1d0004821f77ceed94d3992", + "lastModified": 1639635878, + "narHash": "sha256-5jlR5qTo1hOI8Xsc6yAizflH+Pe7YbBk+GnfccgZu9o=", + "owner": "nix-community", + "repo": "fenix", + "rev": "5766a5d883b884cab3a1215eee197356f41ef9ce", "type": "github" }, "original": { - "owner": "mozilla", - "repo": "nixpkgs-mozilla", + "owner": "nix-community", + "repo": "fenix", "type": "github" } }, @@ -52,12 +57,29 @@ }, "root": { "inputs": { - "mozillapkgs": "mozillapkgs", + "fenix": "fenix", "naersk": "naersk", "nixpkgs": "nixpkgs", "utils": "utils" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1639175515, + "narHash": "sha256-Yj38u9BpKfyGrcSEaoSEnOns885xn/Ask6lR5rsxS8k=", + "owner": "rust-analyzer", + "repo": "rust-analyzer", + "rev": "d03397fe1173eaeb2e04c9e55ac223289e7e08ee", + "type": "github" + }, + "original": { + "owner": "rust-analyzer", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1634851050, diff --git a/flake.nix b/flake.nix index 0e2ed43..7aaefc4 100644 --- a/flake.nix +++ b/flake.nix @@ -2,19 +2,21 @@ inputs = { utils.url = "github:numtide/flake-utils"; naersk.url = "github:nmattia/naersk"; - mozillapkgs.url = "github:mozilla/nixpkgs-mozilla"; - mozillapkgs.flake = false; + naersk.inputs.nixpkgs.follows = "nixpkgs"; + fenix.url = "github:nix-community/fenix"; + fenix.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, utils, naersk, mozillapkgs }: + outputs = { self, nixpkgs, utils, fenix, naersk }: utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages."${system}"; - mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {}; - rust = (mozilla.rustChannelOf { - channel = "stable"; - date = "2021-10-04"; - sha256 = "0swglfa63i14fpgg98agx4b5sz0nckn6phacfy3k6imknsiv8mrg"; - }).rust; + + rust = fenix.packages.${system}.complete.withComponents [ + "cargo" + "rustc" + "rust-src" # just for rust-analyzer + "clippy" + ]; # Override the version used in naersk naersk-lib = naersk.lib."${system}".override { @@ -52,8 +54,11 @@ # `nix develop` devShell = pkgs.mkShell { - nativeBuildInputs = with defaultPackage; - nativeBuildInputs ++ buildInputs; + nativeBuildInputs = [ + fenix.packages.${system}.rust-analyzer + ] ++ (with defaultPackage; + nativeBuildInputs ++ buildInputs + ); }; }) // { overlay = final: prev: {