From 63a6c6590101ab3f44780ed3987aecd06702a1b1 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Thu, 12 Sep 2024 01:26:38 -0700 Subject: [PATCH] nix: use fenix instead of rust-overlay --- flake.lock | 62 +++++++++++++++++++++++++++++------------------------- flake.nix | 19 ++++++++--------- 2 files changed, 42 insertions(+), 39 deletions(-) diff --git a/flake.lock b/flake.lock index 5c029dc..6584e2e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1726116637, + "narHash": "sha256-tU2GhwU887mPg6C4c2k+CEBAnKY6R0tSeQYtoqjZmLM=", + "owner": "nix-community", + "repo": "fenix", + "rev": "96a04a213838c5001619ad57400c5a176fa040b1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -64,45 +85,28 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1718428119, - "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "root": { "inputs": { + "fenix": "fenix", "flake-utils": "flake-utils", "naersk": "naersk", - "nixpkgs": "nixpkgs_2", - "rust-overlay": "rust-overlay" + "nixpkgs": "nixpkgs_2" } }, - "rust-overlay": { - "inputs": { - "nixpkgs": "nixpkgs_3" - }, + "rust-analyzer-src": { + "flake": false, "locked": { - "lastModified": 1726021481, - "narHash": "sha256-4J4E+Fh+77XIYnq2RVtg+ENWXpu6t74P0jKN/f2RQmI=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "1c2c120246c51a644c20ba2a36a33d3bd4860d70", + "lastModified": 1725985110, + "narHash": "sha256-0HKj+JI6rtxaE6Kzcd6HyFNbEFJRsLy5DoNgVF1pyRM=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "bcc708992104c2059f310fbc3ac00bfc377f9ea8", "type": "github" }, "original": { - "owner": "oxalica", - "repo": "rust-overlay", + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", "type": "github" } }, diff --git a/flake.nix b/flake.nix index f60dfa6..10387db 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,10 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; - rust-overlay.url = "github:oxalica/rust-overlay"; + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; naersk.url = "github:nix-community/naersk"; }; @@ -12,20 +15,18 @@ { nixpkgs, flake-utils, - rust-overlay, + fenix, naersk, ... }: flake-utils.lib.eachDefaultSystem ( system: let - overlays = [ (import rust-overlay) ]; - pkgs = import nixpkgs { inherit system overlays; }; + pkgs = import nixpkgs { inherit system; }; naersk' = pkgs.callPackage naersk { }; defaultBuildOpts = { - cargo = pkgs.rust-bin.stable.latest.default; - rustc = pkgs.rust-bin.stable.latest.default; - + cargo = fenix.packages.${system}.stable.cargo; + rustc = fenix.packages.${system}.stable.rustc; src = ./.; nativeBuildInputs = with pkgs; [ pkg-config ]; @@ -38,10 +39,8 @@ devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ pkg-config - rust-bin.stable.latest.rust-analyzer - rust-bin.stable.latest.default openssl - rust-bin.stable.latest.rustfmt + fenix.packages.${system}.stable.completeToolchain ]; }; packages = {