Skip to content

Commit

Permalink
add nix build for mev-rs (and clean up devshell)
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexstokes committed Sep 29, 2023
1 parent c3ce5b4 commit b706f77
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 21 deletions.
134 changes: 128 additions & 6 deletions flake.lock

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

25 changes: 20 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,33 @@
description = "flake for `mev-rs` repo";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
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";
flake-utils.follows = "flake-utils";
};
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, flake-utils, nixpkgs }:
outputs = { self, flake-utils, nixpkgs, rust-overlay, crane }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
mev = pkgs.callPackage ./nix/mev.nix { inherit pkgs; crane = craneLib; };
in
{
devShells.default = import ./shell.nix { inherit pkgs lib; };
packages.mev = mev;
devShells.default = import ./shell.nix { inherit pkgs rustToolchain; };
});
}
5 changes: 1 addition & 4 deletions nix/mev.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ let
pname = "mev-rs";
src = crane.cleanCargoSource (crane.path ../.);
buildInputs = [ ] ++ lib.optionals pkgs.stdenv.isDarwin [
libiconv
];
nativeBuildInputs = [
# pkgs.rustPlatform.bindgenHook
darwin.apple_sdk.frameworks.Network
];
};
cargoArtifacts = crane.buildDepsOnly commonArgs;
Expand Down
10 changes: 4 additions & 6 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
{ pkgs, lib }:
{ pkgs, rustToolchain }:
with pkgs;
mkShell {
buildInputs = lib.lists.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Network
] ++ [
iconv
buildInputs = [
just
mdbook
zlib
rustToolchain
];
}

0 comments on commit b706f77

Please sign in to comment.