From 4439a56af696a48d018acc0fad7c1a34976d8fae Mon Sep 17 00:00:00 2001 From: chives101 Date: Thu, 13 Apr 2023 12:37:10 +0800 Subject: [PATCH] Add nix/flake support Example: nix build github:mimblewimble/grin ./result/bin/grin --help --- etc/default.nix | 18 +++++++++++++++ flake.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 21 +++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 etc/default.nix create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/etc/default.nix b/etc/default.nix new file mode 100644 index 0000000000..af1e2c85c6 --- /dev/null +++ b/etc/default.nix @@ -0,0 +1,18 @@ +{ pkgs }: +{ + 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"; + }); +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000000..6419f84efb --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1681269223, + "narHash": "sha256-i6OeI2f7qGvmLfD07l1Az5iBL+bFeP0RHixisWtpUGo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "87edbd74246ccdfa64503f334ed86fa04010bab9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000..624a246578 --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "THE MIMBLEWIMBLE BLOCKCHAIN."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = inputs: with inputs; + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + code = pkgs.callPackage etc/. {}; + in rec { + packages = { + app = code.app; + default = packages.app; + }; + } + ); +}