Skip to content

Commit d9446a8

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

File tree

2 files changed

+53
-40
lines changed

2 files changed

+53
-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: 21 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,22 @@
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 = fenix.packages.${system}.fromToolchainFile {
36+
file = ./rust-toolchain.toml;
37+
sha256 = "sha256-+9FmLhAOezBZCOziO0Qct1NOrfpjNsXxc/8I0c7BdKE=";
38+
};
3439
in {
35-
devShells.default = pkgsWithOverlays.mkShell {
36-
packages = (with pkgsWithOverlays; [
37-
rust-toolchain
40+
devShells.default = pkgs.mkShell {
41+
packages = (with pkgs; [
42+
toolchain
3843
foundry-bin
3944
solc
4045
protobuf
@@ -44,6 +49,10 @@
4449
nodejs
4550
postgresql
4651
]);
52+
53+
shellHook = ''
54+
export RUST_SRC_PATH="${toolchain}/lib/rustlib/src/rust/library"
55+
'';
4756
};
4857

4958
process-compose = let
@@ -63,7 +72,7 @@
6372
initialDatabases = [
6473
{
6574
inherit name;
66-
schemas = [ (pkgsWithOverlays.writeText "init-${name}.sql" ''
75+
schemas = [ (pkgs.writeText "init-${name}.sql" ''
6776
CREATE EXTENSION IF NOT EXISTS pg_trgm;
6877
CREATE EXTENSION IF NOT EXISTS btree_gist;
6978
CREATE EXTENSION IF NOT EXISTS postgres_fdw;
@@ -146,7 +155,7 @@
146155

147156
services.anvil."anvil-integration" = {
148157
enable = true;
149-
package = pkgsWithOverlays.foundry-bin;
158+
package = pkgs.foundry-bin;
150159
port = 3021;
151160
timestamp = 1743944919;
152161
gasLimit = 100000000000;

0 commit comments

Comments
 (0)