From c2f9c8ba430793c8b3a679b3cbdf4b8ac2bef1cc Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Tue, 14 Jul 2026 09:01:27 +0200 Subject: [PATCH] Add flake.nix --- .gitignore | 1 + flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 43b847c..a38ce28 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ results /chantools-v* .idea +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6bea735 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1783915482, + "narHash": "sha256-FmieJB8/OUvNxbkboi7+IGfIuSXY3nF/hZQm8kD0r50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6cdc7fc76e8bf7fde9fa43a849fcaaa70e230dee", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "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 0000000..3f865c4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,52 @@ +{ + description = "Lightning Labs chantools"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + outputs = + { + self, + nixpkgs, + }: + let + systems = [ + "aarch64-darwin" + "aarch64-linux" + "x86_64-darwin" + "x86_64-linux" + ]; + + forAllSystems = nixpkgs.lib.genAttrs systems; + in + { + packages = forAllSystems ( + system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + default = pkgs.buildGo125Module { + pname = "chantools"; + version = "0.14.2"; + + src = ./.; + vendorHash = "sha256-vrmGXMWGj+uy5913xiNiDUaY8plLoycwDLln0RsKv18="; + + subPackages = [ "cmd/chantools" ]; + env.CGO_ENABLED = "0"; + + meta = { + description = "Tools for recovering funds from Lightning channels"; + homepage = "https://github.com/lightninglabs/chantools"; + license = pkgs.lib.licenses.mit; + mainProgram = "chantools"; + }; + }; + + chantools = self.packages.${system}.default; + } + ); + }; +}