From 81be08ae7aec4bc8299ca5e82280a939424a2e3d Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Mon, 13 May 2024 17:12:32 -0400 Subject: [PATCH] working on the overlay --- justfile | 12 ++++++++++++ src/system/modules/bitcoin/default.nix | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/justfile b/justfile index 5f150e7..5dd2ab3 100644 --- a/justfile +++ b/justfile @@ -86,3 +86,15 @@ gh MESSAGE: git add -A git commit -m "{{MESSAGE}}" git push + +#Fetch resources and compute sha256 hash +hash URL: + #!/usr/bin/env bash + set -euo pipefail + if echo "{{URL}}" | grep -E '\.(tar\.gz|tgz|zip)$'; then + CONTENTS=$(nix-prefetch-url --unpack "{{URL}}") + else + CONTENTS=$(nix-prefetch-url "{{URL}}") + fi + HASH=$(echo -n "$CONTENTS" | nix hash to-sri --type sha256) + echo "$HASH" diff --git a/src/system/modules/bitcoin/default.nix b/src/system/modules/bitcoin/default.nix index d2078e4..184bdc4 100644 --- a/src/system/modules/bitcoin/default.nix +++ b/src/system/modules/bitcoin/default.nix @@ -3,7 +3,6 @@ with lib; let cfg = config.modules.system.bitcoin; - version = "27.0"; home = "/var/lib/bitcoind"; conf = pkgs.writeText "bitcoin.conf" (import ./config); @@ -14,13 +13,22 @@ in config = mkIf cfg.enable { nixpkgs.overlays = [ (final: prev: { - bitcoind = prev.bitcoind.overrideAttrs (old: { + bitcoind = prev.stdenv.mkDerivation rec { + pname = "bitcoind"; + version = "27.0"; + src = fetchTarball { url = "https://bitcoincore.org/bin/bitcoin-core-${version}/bitcoin-${version}-x86_64-linux-gnu.tar.gz"; sha256 = "sha256-T45mgVrGXEZIz9mPbVd4feca6qKzOuJqXDaLzFv+JBY="; }; - nativeBuildInputs = [ autoreconfHook ]; - }); + + phase = [ "unpackPhase" "installPhase" ]; + + installPhase = '' + mkdir -p $out/bin + cp bin/* $out/bin + ''; + }; }) ];