This repository has been archived on 2026-06-22. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
lnbits-sensei/modules/core.nix
Padreug 94a7c5f97c refactor: collapse fakewallet/regtest wrappers into single dev CLI
Replaces the two parallel scripts (fakewallet.sh, regtest.sh) with one
modules/dev-env/scripts/dev.sh — `dev up [--fakewallet|--regtest]`,
plus `down|logs|shell`. Default mode is fakewallet (no docker, no
chains, instant), matching what the prior scaffold did with two scripts
but giving consumers one command and one verb-set to learn.

Drops the now-redundant `lnbits.backend` enum and `features.fakewallet`
option from core.nix. Backend selection is the dev CLI's runtime
concern; a NixOS-level option would be a second knob that can disagree
with the CLI flag at runtime. `lnbits.{host,port}` stay (bind addr,
useful to docs and any later service path). `features.regtest` stays
(gates docker engine installation — consumers who'll never use the
regtest mode shouldn't pay for the container engine).

Strips modules/lnbits.nix entirely. The dev CLI runs lnbits ad-hoc; if
a NixOS-managed lnbits service becomes a real ask later, re-add a
focused module then.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 12:56:05 +02:00

86 lines
2.6 KiB
Nix

# lnbits-sensei — option schema.
#
# All host configuration is expressed through `config.lnbits-sensei.*`
# options defined here. Modules consume these via `lib.mkIf` / option
# reads; they never read raw `settings` outside the configuration.nix
# wire-up. This indirection lets multiple hosts share modules and lets
# the dev-env / lnbits modules toggle behaviour on feature flags
# without coupling to file layout.
{
config,
lib,
...
}:
let
inherit (lib) mkEnableOption mkOption types;
in
{
options.lnbits-sensei = {
enable = mkEnableOption "lnbits-sensei NixOS scaffold";
# --- Identity ---
user = mkOption {
type = types.str;
default = "user";
description = "Primary user on this host. Sourced from settings.nix.";
example = "alice";
};
hostName = mkOption {
type = types.str;
default = "lnbits-sensei";
description = "NixOS hostname. Sourced from settings.nix.";
};
# --- Feature flags ---
#
# Mirror the omnixy pattern: simple on/off switches gating both
# system packages and home-manager packages. Default off so a
# fresh checkout builds a minimal host until the consumer opts in.
features = {
coding = mkEnableOption ''
Development tooling for working on LNbits itself (python, poetry,
nodejs, pre-commit). Off by default flip on if this host is
your LNbits dev box rather than a runner
'';
regtest = mkEnableOption ''
Full Bitcoin/Lightning regtest docker stack (LND + CLN + Eclair
+ bitcoind + electrs). Implies a container engine install
docker only if you actually plan to invoke `dev up --regtest`.
The default `dev up` (FakeWallet) needs none of this
'';
};
# --- LNbits bind addr ---
#
# Backend selection lives in the `dev` CLI (--fakewallet | --regtest),
# not as a NixOS option: the dev-env scaffold doesn't manage a
# systemd lnbits service, and we don't want two knobs (build-time
# vs runtime) that can disagree.
lnbits = {
port = mkOption {
type = types.port;
default = 5000;
description = "TCP port LNbits binds to.";
};
host = mkOption {
type = types.str;
default = "127.0.0.1";
description = ''
Bind address. Defaults to loopback; put a reverse proxy in
front for any host reachable from outside localhost.
'';
};
};
};
# No config body here — configuration.nix and the per-feature modules
# consume these options. This file is options-only on purpose so the
# schema is greppable in one place.
}