mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-11-29 18:41:29 +03:00
b26cea03b3
bitcoin: 27.0 -> 27.1 bitcoind: 27.0 -> 27.1 clightning: 24.02.2 -> 24.05 fulcrum: 1.10.0 -> 1.11.0 lnd: 0.17.5-beta -> 0.18.0-beta Co-authored-by: Erik Arvstedt <erik.arvstedt@gmail.com>
67 lines
1.9 KiB
Nix
67 lines
1.9 KiB
Nix
nix-bitcoin: pkgs: system:
|
|
|
|
rec {
|
|
inherit (nix-bitcoin.inputs) nixpkgs;
|
|
|
|
mkVMScript = vm: pkgs.writers.writeBash "run-vm" ''
|
|
set -euo pipefail
|
|
export TMPDIR=$(mktemp -d /tmp/nix-bitcoin-vm.XXX)
|
|
trap 'rm -rf $TMPDIR' EXIT
|
|
export NIX_DISK_IMAGE=$TMPDIR/nixos.qcow2
|
|
|
|
# shellcheck disable=SC2211
|
|
QEMU_OPTS="-smp $(nproc) -m 1500" ${vm}/bin/run-*-vm
|
|
'';
|
|
|
|
vm = (import (nixpkgs + "/nixos") {
|
|
inherit system;
|
|
configuration = { config, lib, modulesPath, ... }: {
|
|
imports = [
|
|
nix-bitcoin.nixosModules.default
|
|
(nix-bitcoin + "/modules/presets/secure-node.nix")
|
|
(modulesPath + "/virtualisation/qemu-vm.nix")
|
|
];
|
|
|
|
virtualisation.graphics = false;
|
|
|
|
nix-bitcoin.generateSecrets = true;
|
|
services.clightning.enable = true;
|
|
# disable-dns leads to faster startup in offline VMs
|
|
# TODO-EXTERNAL:
|
|
# When bitcoind is not fully synced, the offers plugin in clightning 24.05
|
|
# crashes (see https://github.com/ElementsProject/lightning/issues/7378).
|
|
services.clightning.extraConfig = ''
|
|
disable-dns
|
|
disable-plugin=offers
|
|
'';
|
|
|
|
# Avoid lengthy build of the nixos manual
|
|
documentation.nixos.enable = false;
|
|
|
|
nixpkgs.pkgs = pkgs;
|
|
services.getty.autologinUser = "root";
|
|
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
|
|
|
|
services.getty.helpLine = lib.mkAfter ''
|
|
|
|
Welcome to nix-bitcoin!
|
|
To explore running services, try the following commands:
|
|
nodeinfo
|
|
systemctl status bitcoind
|
|
systemctl status clightning
|
|
bitcoin-cli -getinfo
|
|
lightning-cli getinfo
|
|
'';
|
|
|
|
# Power off VM when the user exits the shell
|
|
systemd.services."serial-getty@".preStop = ''
|
|
echo o >/proc/sysrq-trigger
|
|
'';
|
|
|
|
system.stateVersion = lib.mkDefault config.system.nixos.release;
|
|
};
|
|
}).config.system.build.vm;
|
|
|
|
runVM = mkVMScript vm;
|
|
}
|