From 227a1d7db7b7c1d470d31e6c50112f54f353c2f1 Mon Sep 17 00:00:00 2001 From: Sebastian Nagel Date: Wed, 29 Sep 2021 21:33:45 +0200 Subject: [PATCH] Add a shell.nix and instructions how to use it --- README.md | 5 +++++ libsodium.nix | 14 ++++++++++++++ shell.nix | 7 +++++++ 3 files changed, 26 insertions(+) create mode 100644 libsodium.nix create mode 100644 shell.nix diff --git a/README.md b/README.md index 8c142ae..2a08599 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,11 @@ make ./musig2test ``` +## Build in nix-shell + +The provided `shell.nix` provides build tools and the right version of +`libsodium`, so simply using `nix-shell` and `make` is sufficient to build. + # Disclaimer This code is work in progress, and has not been audited. Do not use in production. diff --git a/libsodium.nix b/libsodium.nix new file mode 100644 index 0000000..32513da --- /dev/null +++ b/libsodium.nix @@ -0,0 +1,14 @@ +{ pkgs ? import {} }: + +pkgs.libsodium.overrideAttrs (oldAttrs: { + name = "libsodium-1.0.18-musig2"; + src = pkgs.fetchFromGitHub { + owner = "input-output-hk"; + repo = "libsodium"; + # branch musig2_compat + rev = "7f9f211fcc88d8f0d7a821e5b9041268c392300a"; + sha256 = "0527x23z1h4ny492jjmyxpwb48hrlbgibin83w1qm0jqvg441xgp"; + }; + nativeBuildInputs = [ pkgs.autoreconfHook ]; + configureFlags = "--enable-static"; + }) diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..6f20405 --- /dev/null +++ b/shell.nix @@ -0,0 +1,7 @@ +{ pkgs ? import {} +, libsodium-musig2 ? import ./libsodium.nix { inherit pkgs; } +}: + +pkgs.mkShell { + buildInputs = [pkgs.clang libsodium-musig2]; +}