Skip to content

Commit ddfddf0

Browse files
committed
all: set up rust-src path in nix shell
1 parent 9506b6a commit ddfddf0

File tree

2 files changed

+52
-40
lines changed

2 files changed

+52
-40
lines changed

flake.lock

Lines changed: 32 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
{
22
inputs = {
33
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
4-
rust.url = "github:oxalica/rust-overlay";
54
foundry.url = "github:shazow/foundry.nix/5af12b6f2b708858ef3120041546ed6b038474a5";
5+
fenix = {
6+
url = "github:nix-community/fenix";
7+
inputs.nixpkgs.follows = "nixpkgs";
8+
};
69
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
710
services-flake.url = "github:juspay/services-flake";
811
flake-parts.url = "github:hercules-ci/flake-parts";
912
};
1013

11-
outputs = inputs@{ flake-parts, process-compose-flake, services-flake, nixpkgs, rust, foundry, ... }:
14+
outputs = inputs@{ flake-parts, process-compose-flake, services-flake, nixpkgs, fenix, foundry, ... }:
1215
flake-parts.lib.mkFlake { inherit inputs; } {
1316
imports = [ process-compose-flake.flakeModule ];
1417
systems = [
@@ -21,20 +24,25 @@
2124
perSystem = { config, self', inputs', pkgs, system, ... }:
2225
let
2326
overlays = [
24-
(import rust)
25-
(self: super: {
26-
rust-toolchain = super.rust-bin.stable.latest.default;
27-
})
27+
fenix.overlays.default
2828
foundry.overlay
2929
];
3030

31-
pkgsWithOverlays = import nixpkgs {
31+
pkgs = import nixpkgs {
3232
inherit overlays system;
3333
};
34+
35+
toolchain = with fenix.packages.${system}; combine [
36+
(fromToolchainFile {
37+
file = ./rust-toolchain.toml;
38+
sha256 = "sha256-+9FmLhAOezBZCOziO0Qct1NOrfpjNsXxc/8I0c7BdKE=";
39+
})
40+
stable.rust-src # This is needed for rust-analyzer to find stdlib symbols. Should use the same channel as the toolchain.
41+
];
3442
in {
35-
devShells.default = pkgsWithOverlays.mkShell {
36-
packages = (with pkgsWithOverlays; [
37-
rust-toolchain
43+
devShells.default = pkgs.mkShell {
44+
packages = (with pkgs; [
45+
toolchain
3846
foundry-bin
3947
solc
4048
protobuf
@@ -63,7 +71,7 @@
6371
initialDatabases = [
6472
{
6573
inherit name;
66-
schemas = [ (pkgsWithOverlays.writeText "init-${name}.sql" ''
74+
schemas = [ (pkgs.writeText "init-${name}.sql" ''
6775
CREATE EXTENSION IF NOT EXISTS pg_trgm;
6876
CREATE EXTENSION IF NOT EXISTS btree_gist;
6977
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
@@ -146,7 +154,7 @@
146154

147155
services.anvil."anvil-integration" = {
148156
enable = true;
149-
package = pkgsWithOverlays.foundry-bin;
157+
package = pkgs.foundry-bin;
150158
port = 3021;
151159
timestamp = 1743944919;
152160
gasLimit = 100000000000;

0 commit comments

Comments
 (0)