working on the overlay

This commit is contained in:
Bryan Ramos 2024-05-13 17:12:32 -04:00 committed by Bryan Ramos
parent a62b9da1e3
commit 81be08ae7a
Signed by: bryan
GPG key ID: 6ABDCD144D6643C8
2 changed files with 24 additions and 4 deletions

View file

@ -86,3 +86,15 @@ gh MESSAGE:
git add -A git add -A
git commit -m "{{MESSAGE}}" git commit -m "{{MESSAGE}}"
git push 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"

View file

@ -3,7 +3,6 @@
with lib; with lib;
let let
cfg = config.modules.system.bitcoin; cfg = config.modules.system.bitcoin;
version = "27.0";
home = "/var/lib/bitcoind"; home = "/var/lib/bitcoind";
conf = pkgs.writeText "bitcoin.conf" (import ./config); conf = pkgs.writeText "bitcoin.conf" (import ./config);
@ -14,13 +13,22 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {
bitcoind = prev.bitcoind.overrideAttrs (old: { bitcoind = prev.stdenv.mkDerivation rec {
pname = "bitcoind";
version = "27.0";
src = fetchTarball { src = fetchTarball {
url = "https://bitcoincore.org/bin/bitcoin-core-${version}/bitcoin-${version}-x86_64-linux-gnu.tar.gz"; url = "https://bitcoincore.org/bin/bitcoin-core-${version}/bitcoin-${version}-x86_64-linux-gnu.tar.gz";
sha256 = "sha256-T45mgVrGXEZIz9mPbVd4feca6qKzOuJqXDaLzFv+JBY="; sha256 = "sha256-T45mgVrGXEZIz9mPbVd4feca6qKzOuJqXDaLzFv+JBY=";
}; };
nativeBuildInputs = [ autoreconfHook ];
}); phase = [ "unpackPhase" "installPhase" ];
installPhase = ''
mkdir -p $out/bin
cp bin/* $out/bin
'';
};
}) })
]; ];