Skip to content

Commit

Permalink
setup build env with nix
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Dec 23, 2024
1 parent bfb0c6d commit 8b19307
Show file tree
Hide file tree
Showing 2 changed files with 170 additions and 0 deletions.
95 changes: 95 additions & 0 deletions flake.lock

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

75 changes: 75 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
description = "sp1";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/release-24.11";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
};

outputs =
inputs@{
flake-parts,
rust-overlay,
crane,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [

];
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem =
{
config,
self',
inputs',
pkgs,
system,
...
}:
let
craneLib = (crane.mkLib pkgs).overrideToolchain rust-toolchain;
rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain;
in
{
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = with inputs; [
rust-overlay.overlays.default
];
};
devShells.default = pkgs.mkShell {
buildInputs = [
rust-toolchain
];
};
packages =
let
cargoArtifacts = craneLib.buildDepsOnly {
src = craneLib.cleanCargoSource ./.;
doCheck = false;
};
in
{
default = craneLib.buildPackage {
inherit cargoArtifacts;
src = craneLib.cleanCargoSource ./.;
pname = "sp1-cli";
name = craneLib.crateNameFromCargoToml { cargoToml = ./path/to/Cargo.toml; };
doCheck = false;
};
};

formatter = pkgs.nixfmt-rfc-style;
};
};
}

0 comments on commit 8b19307

Please sign in to comment.