Skip to content

Commit

Permalink
Add nix/flake support
Browse files Browse the repository at this point in the history
Example:

nix build github:mimblewimble/grin

./result/bin/grin --help
  • Loading branch information
chives101 committed Apr 13, 2023
1 parent 684f0a3 commit 8c24ddd
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 0 deletions.
23 changes: 23 additions & 0 deletions etc/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ pkgs, nixpkgs, system, makeRustPlatform, rust-overlay }:
let
rustPkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
in {
app = pkgs.rustPlatform.buildRustPackage ({
pname = "grin";
version = "5.2.0-alpha.2";
src = ../.;

cargoLock = {
lockFile = ../Cargo.lock;
};

cargoSha256 = "sha256-iCMFlrcoIrpClQOYQpg07DPePdTFLFEkeap2kE0ijzU=";

nativeBuildInputs = [ pkgs.llvmPackages_latest.clang ];
buildInputs = [ pkgs.ncurses ];
LIBCLANG_PATH = "${pkgs.llvmPackages_latest.libclang.lib}/lib";
});
}
69 changes: 69 additions & 0 deletions flake.lock

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

22 changes: 22 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
description = "THE MIMBLEWIMBLE BLOCKCHAIN.";

inputs = {
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.follows = "rust-overlay/flake-utils";
nixpkgs.follows = "rust-overlay/nixpkgs";
};

outputs = inputs: with inputs;
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
code = pkgs.callPackage etc/. { inherit nixpkgs system rust-overlay; };
in rec {
packages = {
app = code.app;
default = packages.app;
};
}
);
}

0 comments on commit 8c24ddd

Please sign in to comment.