Skip to content

chore: update nix flake #10485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: nix

on:
schedule:
# Run weekly
- cron: "0 0 * * SUN"
workflow_dispatch:
# Needed so we can run it manually

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
# Opens a PR with an updated flake.lock file
update:
runs-on: ubuntu-latest
steps:
- uses: cachix/install-nix-action@v30
- uses: actions/checkout@v4
- uses: DeterminateSystems/update-flake-lock@main
with:
pr-title: "Update flake.lock"
pr-labels: |
L-ignore
A-dependencies

build:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: cachix/install-nix-action@v30
- uses: actions/checkout@v4

- name: Activate nix env
run: nix develop -c echo Ok

- name: Check that we can compile all crates
run: nix develop -c cargo check --all-targets
105 changes: 26 additions & 79 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 37 additions & 44 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,52 +1,45 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
solc = {
url = "github:hellwolf/solc.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-utils.follows = "flake-utils";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, rust-overlay, flake-utils, solc }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default solc.overlay ];
};
lib = pkgs.lib;
toolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rustfmt" "clippy" "rust-src" ];
};
in
{
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
pkg-config
solc_0_8_23
(solc.mkDefault pkgs solc_0_8_23)
toolchain
];
buildInputs = lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.AppKit
];
packages = with pkgs; [
rust-analyzer-unwrapped
];
outputs = { self, nixpkgs, fenix }:
let eachSystem = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
in {
devShells = eachSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ fenix.overlays.default ];
};

lib = pkgs.lib;
toolchain = fenix.packages.${system}.stable.toolchain;
in {
default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
pkg-config
toolchain

# test dependencies
solc
vyper
nodejs
];
buildInputs = lib.optionals pkgs.stdenv.isDarwin
[ pkgs.darwin.apple_sdk.frameworks.AppKit ];

# Environment variables
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.libusb1 ];
};
});
packages = with pkgs; [ rust-analyzer-unwrapped ];

# Environment variables
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.libusb1 ];
CFLAGS = "-DJEMALLOC_STRERROR_R_RETURNS_CHAR_WITH_GNU_SOURCE";
Copy link
Member

@zerosnacks zerosnacks May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ref for reviewers: https://github.com/foundry-rs/foundry/pull/9848/files, it is a fix for building tikv-jemalloc-sys

};
});
};
}