diff --git a/.gitignore b/.gitignore index 78d8a7cb0..d22df82d5 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 000000000..bd9219208 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1692587767, + "narHash": "sha256-J1ZaJEWgUoT4zfNnhKukYLjel67bQyNHL1FqQ/kqCLo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "57492e92b9829946d866b700c101d9a5cc8d749e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-23.05", + "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 000000000..d5d1400ba --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ +{ + description = "Reference Grin Wallet."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/release-23.05"; + }; + + 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.2.0"; + src = ./.; + + cargoLock = { + lockFile = ./Cargo.lock; + outputHashes = { + "grin_api-5.2.0-beta.3" = "sha256-n3z+n1WAfk+1J0CgdRmO+MRS1dJVxcOS9jiN4+PD4gM="; + }; + }; + + 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; + } + ); + }; +}