nix: use fenix instead of rust-overlay

This commit is contained in:
Youwen Wu 2024-09-12 01:26:38 -07:00
parent 435d7a0407
commit 63a6c65901
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
2 changed files with 42 additions and 39 deletions

View file

@ -1,5 +1,26 @@
{ {
"nodes": { "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": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems"
@ -64,45 +85,28 @@
"type": "github" "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": { "root": {
"inputs": { "inputs": {
"fenix": "fenix",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"naersk": "naersk", "naersk": "naersk",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs_2"
"rust-overlay": "rust-overlay"
} }
}, },
"rust-overlay": { "rust-analyzer-src": {
"inputs": { "flake": false,
"nixpkgs": "nixpkgs_3"
},
"locked": { "locked": {
"lastModified": 1726021481, "lastModified": 1725985110,
"narHash": "sha256-4J4E+Fh+77XIYnq2RVtg+ENWXpu6t74P0jKN/f2RQmI=", "narHash": "sha256-0HKj+JI6rtxaE6Kzcd6HyFNbEFJRsLy5DoNgVF1pyRM=",
"owner": "oxalica", "owner": "rust-lang",
"repo": "rust-overlay", "repo": "rust-analyzer",
"rev": "1c2c120246c51a644c20ba2a36a33d3bd4860d70", "rev": "bcc708992104c2059f310fbc3ac00bfc377f9ea8",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "oxalica", "owner": "rust-lang",
"repo": "rust-overlay", "ref": "nightly",
"repo": "rust-analyzer",
"type": "github" "type": "github"
} }
}, },

View file

@ -4,7 +4,10 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils"; 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"; naersk.url = "github:nix-community/naersk";
}; };
@ -12,20 +15,18 @@
{ {
nixpkgs, nixpkgs,
flake-utils, flake-utils,
rust-overlay, fenix,
naersk, naersk,
... ...
}: }:
flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachDefaultSystem (
system: system:
let let
overlays = [ (import rust-overlay) ]; pkgs = import nixpkgs { inherit system; };
pkgs = import nixpkgs { inherit system overlays; };
naersk' = pkgs.callPackage naersk { }; naersk' = pkgs.callPackage naersk { };
defaultBuildOpts = { defaultBuildOpts = {
cargo = pkgs.rust-bin.stable.latest.default; cargo = fenix.packages.${system}.stable.cargo;
rustc = pkgs.rust-bin.stable.latest.default; rustc = fenix.packages.${system}.stable.rustc;
src = ./.; src = ./.;
nativeBuildInputs = with pkgs; [ pkg-config ]; nativeBuildInputs = with pkgs; [ pkg-config ];
@ -38,10 +39,8 @@
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [
pkg-config pkg-config
rust-bin.stable.latest.rust-analyzer
rust-bin.stable.latest.default
openssl openssl
rust-bin.stable.latest.rustfmt fenix.packages.${system}.stable.completeToolchain
]; ];
}; };
packages = { packages = {