Add nix/flake support

Example:

nix build github:mimblewimble/grin-wallet

./result/bin/grin-wallet --help
This commit is contained in:
chives101 2023-04-14 21:20:34 +08:00
parent 7741812599
commit 1871ad0a56
3 changed files with 77 additions and 0 deletions

1
.gitignore vendored
View file

@ -11,3 +11,4 @@ grin.log
wallet.seed
test_output
.idea/
result

27
flake.lock Normal file
View file

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1714024283,
"narHash": "sha256-5tiVotLS0l3U8PyGMzI6tRdepcep2DlBDKTV7zYR/vE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "6abeba70778c0e40f64910956d957025deac2f34",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "release-23.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

49
flake.nix Normal file
View file

@ -0,0 +1,49 @@
{
description = "Reference Grin Wallet.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-23.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-wallet = pkgs.rustPlatform.buildRustPackage {
pname = "grin-wallet";
version = "5.3.0";
src = ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = with pkgs; [
pkg-config
clang
];
buildInputs = [ pkgs.openssl ];
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
# do not let test results block the build process
doCheck = false;
};
};
packages = forAllSystems (system: {
default = nixpkgsFor.${system}.grin-wallet;
});
};
}