diff --git a/flake.lock b/flake.lock index ab7c889aa22..1e58519c668 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,26 @@ { "nodes": { + "fenix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1755585599, + "narHash": "sha256-tl/0cnsqB/Yt7DbaGMel2RLa7QG5elA8lkaOXli6VdY=", + "owner": "nix-community", + "repo": "fenix", + "rev": "6ed03ef4c8ec36d193c18e06b9ecddde78fb7e42", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": "nixpkgs-lib" @@ -98,22 +119,6 @@ "type": "github" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1744536153, - "narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "process-compose-flake": { "locked": { "lastModified": 1749418557, @@ -131,29 +136,28 @@ }, "root": { "inputs": { + "fenix": "fenix", "flake-parts": "flake-parts", "foundry": "foundry", "nixpkgs": "nixpkgs_2", "process-compose-flake": "process-compose-flake", - "rust": "rust", "services-flake": "services-flake" } }, - "rust": { - "inputs": { - "nixpkgs": "nixpkgs_3" - }, + "rust-analyzer-src": { + "flake": false, "locked": { - "lastModified": 1755743804, - "narHash": "sha256-M6qT02voARH5e9eTXQBzpYIE/hAp6jPgBCyxLmw5uBM=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "80322e975e27d834451d6b66e63f8abae9d74bf2", + "lastModified": 1755504847, + "narHash": "sha256-VX0B9hwhJypCGqncVVLC+SmeMVd/GAYbJZ0MiiUn2Pk=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "a905e3b21b144d77e1b304e49f3264f6f8d4db75", "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 56dc427737a..265b378caac 100644 --- a/flake.nix +++ b/flake.nix @@ -1,14 +1,17 @@ { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - rust.url = "github:oxalica/rust-overlay"; foundry.url = "github:shazow/foundry.nix/5af12b6f2b708858ef3120041546ed6b038474a5"; + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; process-compose-flake.url = "github:Platonic-Systems/process-compose-flake"; services-flake.url = "github:juspay/services-flake"; flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = inputs@{ flake-parts, process-compose-flake, services-flake, nixpkgs, rust, foundry, ... }: + outputs = inputs@{ flake-parts, process-compose-flake, services-flake, nixpkgs, fenix, foundry, ... }: flake-parts.lib.mkFlake { inherit inputs; } { imports = [ process-compose-flake.flakeModule ]; systems = [ @@ -21,20 +24,25 @@ perSystem = { config, self', inputs', pkgs, system, ... }: let overlays = [ - (import rust) - (self: super: { - rust-toolchain = super.rust-bin.stable.latest.default; - }) + fenix.overlays.default foundry.overlay ]; - pkgsWithOverlays = import nixpkgs { + pkgs = import nixpkgs { inherit overlays system; }; + + toolchain = with fenix.packages.${system}; combine [ + (fromToolchainFile { + file = ./rust-toolchain.toml; + sha256 = "sha256-+9FmLhAOezBZCOziO0Qct1NOrfpjNsXxc/8I0c7BdKE="; + }) + stable.rust-src # This is needed for rust-analyzer to find stdlib symbols. Should use the same channel as the toolchain. + ]; in { - devShells.default = pkgsWithOverlays.mkShell { - packages = (with pkgsWithOverlays; [ - rust-toolchain + devShells.default = pkgs.mkShell { + packages = (with pkgs; [ + toolchain foundry-bin solc protobuf @@ -63,7 +71,7 @@ initialDatabases = [ { inherit name; - schemas = [ (pkgsWithOverlays.writeText "init-${name}.sql" '' + schemas = [ (pkgs.writeText "init-${name}.sql" '' CREATE EXTENSION IF NOT EXISTS pg_trgm; CREATE EXTENSION IF NOT EXISTS btree_gist; CREATE EXTENSION IF NOT EXISTS postgres_fdw; @@ -146,7 +154,7 @@ services.anvil."anvil-integration" = { enable = true; - package = pkgsWithOverlays.foundry-bin; + package = pkgs.foundry-bin; port = 3021; timestamp = 1743944919; gasLimit = 100000000000;