Skip to content

Commit 772cb27

Browse files
committed
nix dev env maintenance
I would like to use the dev env provided by nix to build foundry but it's quite outdated. This PR makes it up to date and automated some of the maintenance. Use solc from nixpkgs instead of custom flake. This will at least update solc when it's updated in nixpkgs versus remaining on the same version until someone manually edits flake.nix and makes a PR. Add a CI job to ensure the nix dev env can be used to build foundry. I would like to make it possible to run all the tests too but this would requires more work to track down reasons for the invididual test failures.
1 parent ac724c2 commit 772cb27

File tree

3 files changed

+66
-58
lines changed

3 files changed

+66
-58
lines changed

.github/workflows/nix-dev-env.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Nix developer enviroment
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
# Opens a PR with an updated flake.lock file
13+
update_flake_lock:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: cachix/install-nix-action@v30
17+
- uses: actions/checkout@v4
18+
- uses: DeterminateSystems/update-flake-lock@main
19+
with:
20+
pr-title: "Update flake.lock"
21+
pr-labels: |
22+
L-ignore
23+
A-dependencies
24+
25+
nix-dev-env-linux:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: cachix/install-nix-action@v30
29+
- uses: actions/checkout@v4
30+
31+
- name: Activate nix env
32+
run: nix develop --accept-flake-config -c echo Ok
33+
34+
- name: Check that we can compile all crates
35+
run: nix develop --accept-flake-config -c cargo check --all-targets
36+
37+
nix-env-macos-arm:
38+
runs-on: macos-latest
39+
steps:
40+
- uses: cachix/install-nix-action@v30
41+
- uses: actions/checkout@v4
42+
43+
- name: Activate nix env
44+
run: nix develop --accept-flake-config -c echo Ok
45+
46+
- name: Check that we can compile all crates
47+
run: nix develop --accept-flake-config -c cargo check --all-targets

flake.lock

+10-47
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+9-11
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,14 @@
88
nixpkgs.follows = "nixpkgs";
99
};
1010
};
11-
solc = {
12-
url = "github:hellwolf/solc.nix";
13-
inputs = {
14-
nixpkgs.follows = "nixpkgs";
15-
flake-utils.follows = "flake-utils";
16-
};
17-
};
1811
};
1912

20-
outputs = { self, nixpkgs, rust-overlay, flake-utils, solc }:
13+
outputs = { self, nixpkgs, rust-overlay, flake-utils }:
2114
flake-utils.lib.eachDefaultSystem (system:
2215
let
2316
pkgs = import nixpkgs {
2417
inherit system;
25-
overlays = [ rust-overlay.overlays.default solc.overlay ];
18+
overlays = [ rust-overlay.overlays.default ];
2619
};
2720
lib = pkgs.lib;
2821
toolchain = pkgs.rust-bin.stable.latest.default.override {
@@ -33,9 +26,14 @@
3326
devShells.default = pkgs.mkShell {
3427
nativeBuildInputs = with pkgs; [
3528
pkg-config
36-
solc_0_8_23
37-
(solc.mkDefault pkgs solc_0_8_23)
3829
toolchain
30+
rust-jemalloc-sys
31+
cargo-nextest
32+
33+
# test dependencies
34+
solc
35+
vyper
36+
nodejs
3937
];
4038
buildInputs = lib.optionals pkgs.stdenv.isDarwin [
4139
pkgs.darwin.apple_sdk.frameworks.AppKit

0 commit comments

Comments
 (0)