diff --git a/.gitignore b/.gitignore index 78d8a7cb..d22df82d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ grin.log wallet.seed test_output .idea/ +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..bd104b24 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..1d24ab7a --- /dev/null +++ b/flake.nix @@ -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; + }); + }; +}