mirror of
https://github.com/fort-nix/nix-bitcoin.git
synced 2024-11-26 08:10:41 +03:00
examples: improve Flakes-based VM
- Show login message - Poweroff on shell exit - Move to top of examples/README
This commit is contained in:
parent
1e94e891b2
commit
c8d5cb2405
@ -1,8 +1,22 @@
|
||||
Examples
|
||||
---
|
||||
## Examples
|
||||
|
||||
The easiest way to try out nix-bitcoin is to use one of the provided examples.
|
||||
|
||||
### Flakes-based quick start
|
||||
|
||||
If you use a Flakes-enabled version of Nix, run the following command to start a minimal
|
||||
nix-bitcoin QEMU VM:
|
||||
```bash
|
||||
nix run github:fort-nix/nix-bitcoin/release
|
||||
```
|
||||
The VM (defined in [flake.nix](../flake.nix)) runs in the terminal and has `bitcoind`
|
||||
and `clightning` installed.\
|
||||
It leaves no traces (outside of `/nix/store`) on the host system.
|
||||
|
||||
|
||||
### More examples
|
||||
|
||||
Clone this repo and enter the examples shell:
|
||||
```bash
|
||||
git clone https://github.com/fort-nix/nix-bitcoin
|
||||
cd nix-bitcoin/examples/
|
||||
@ -79,7 +93,3 @@ The commands in `shell.nix` allow you to locally run the node in a VM or contain
|
||||
|
||||
Flakes make it easy to include `nix-bitcoin` in an existing NixOS config.
|
||||
The [flakes example](./flakes/flake.nix) shows how to use `nix-bitcoin` as an input to a system flake.
|
||||
|
||||
Run `nix run` or `nix run .#vm` from the nix-bitcoin root directory to start an example
|
||||
nix-bitcoin node VM.
|
||||
This command is defined by the nix-bitcoin flake (in [flake.nix](../flake.nix)).
|
||||
|
@ -13,7 +13,7 @@ rec {
|
||||
|
||||
vm = (import "${nixpkgs}/nixos" {
|
||||
inherit system;
|
||||
configuration = {
|
||||
configuration = { lib, ... }: {
|
||||
imports = [
|
||||
nix-bitcoin.nixosModules.default
|
||||
"${nix-bitcoin}/modules/presets/secure-node.nix"
|
||||
@ -28,6 +28,20 @@ rec {
|
||||
virtualisation.graphics = false;
|
||||
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
|
||||
'';
|
||||
|
||||
# Power off VM when the user exits the shell
|
||||
systemd.services."serial-getty@".preStop = ''
|
||||
echo o >/proc/sysrq-trigger
|
||||
'';
|
||||
};
|
||||
}).vm;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user