Created
September 24, 2020 14:39
-
-
Save erikarvstedt/fcd3b8298983298b4ddfc161f585db79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
set -euo pipefail | |
vm=$(nix-build --show-trace --no-out-link - <<'EOF' | |
let | |
# https://github.com/fort-nix/nix-bitcoin/issues/241 | |
nbConfig = { config, pkgs, lib, ... }: | |
let | |
nix-bitcoin = builtins.fetchTarball { | |
# https://github.com/fort-nix/nix-bitcoin/pull/242 | |
url = https://github.com/fort-nix/nix-bitcoin/archive/774da9d4e0071b0d5ed4018bebce9d8d6538695d.tar.gz; | |
sha256 = "0jr7larx4zckfq252f3d40a0c0v2rpl6d1wdwkvk8gn148qkrnhl"; | |
}; | |
containerName = "nix-bitcoin"; # container name length is limited to 11 chars | |
in { | |
imports = [ "${nix-bitcoin}/modules/modules.nix" ]; | |
containers.${containerName} = { | |
autoStart = true; | |
config = { pkgs, config, lib, ... }: { | |
imports = [ | |
"${nix-bitcoin}/modules/presets/secure-node.nix" | |
"${nix-bitcoin}/modules/secrets/generate-secrets.nix" | |
]; | |
documentation.nixos.enable = false; | |
}; | |
}; | |
}; | |
nixpkgs = builtins.fetchTarball { | |
url = https://github.com/NixOS/nixpkgs-channels/archive/1179840f9a88b8a548f4b11d1a03aa25a790c379.tar.gz; | |
sha256 = "00jy37wj04bvh299xgal2iik2my9l0nq6cw50r1b2kdfrji8d563"; | |
}; | |
in | |
(import "${nixpkgs}/nixos" { | |
configuration = { pkgs, lib, ... }: with lib; { | |
imports = [ nbConfig ]; | |
virtualisation.graphics = false; | |
services.mingetty.autologinUser = "root"; | |
}; | |
}).vm | |
EOF | |
) | |
export NIX_DISK_IMAGE=/tmp/vmimg; rm -f $NIX_DISK_IMAGE; QEMU_OPTS='-m 1024 -smp 3' $vm/bin/run-*-vm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment