Skip to content

Commit

Permalink
feat: Add nix/flake support (#3743)
Browse files Browse the repository at this point in the history
* CI update - Ubuntu Image

* Add nix/flake support

Example:

nix build github:mimblewimble/grin

./result/bin/grin --help

* Ignore ./result in git repo

result is the default symlink output for nix build

---------

Co-authored-by: chives101 <[email protected]>
  • Loading branch information
chives101 and chives101 authored May 2, 2023
1 parent 684f0a3 commit de94f95
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ wallet/db
.idea/
.vscode/
/node*
result
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ variables:
jobs:
- job: linux
pool:
vmImage: ubuntu-18.04
vmImage: ubuntu-22.04
strategy:
matrix:
servers:
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

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

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

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.11";
};

outputs = { self, nixpkgs, }:
let
forAllSystems = with nixpkgs;
lib.genAttrs lib.systems.flakeExposed;

nixpkgsFor = forAllSystems (system: import nixpkgs
{ inherit system; overlays = [ self.overlay ]; }
);
in
{
overlay = final: prev:
with final;
{
grin = pkgs.rustPlatform.buildRustPackage {
pname = "grin";
version = "5.2.0-alpha.2";
src = ./.;

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

nativeBuildInputs = [ pkgs.llvmPackages_latest.clang ];
buildInputs = [ pkgs.ncurses ];
LIBCLANG_PATH =
"${pkgs.llvmPackages_latest.libclang.lib}/lib";

# do not let test results block the build process
doCheck = false;
};
};

packages = forAllSystems (
system: {
default = nixpkgsFor.${system}.grin;
}
);
};
}

0 comments on commit de94f95

Please sign in to comment.