refactor(rename): NixOS module + service + paths → bitspire
Five-file coordinated rename to give the dev-branch deploy a clean
`bitspire` namespace at the NixOS level:
deploy/nixos/lamassu-atm.nix → deploy/nixos/bitspire-atm.nix
- `services.lamassu-atm` → `services.bitspire`
- `systemd.services.lamassu-atm` → `systemd.services.bitspire`
- `/var/lib/lamassu-atm` → `/var/lib/bitspire`
- `/opt/lamassu-atm` → `/opt/bitspire`
- `/etc/lamassu-atm/config.env` → `/etc/bitspire/config.env`
flake.nix
- module import path updated
- `nixosModules.lamassu-atm` → `nixosModules.bitspire`
- `system.activationScripts.lamassu-env` → `bitspire-env`
- all activation-script paths point at /var/lib/bitspire
deploy/nixos/configuration.nix
- `networking.hostName = "lamassu-atm"` → `"bitspire"`
deploy/nixos/live.nix
- module import path updated
- ISO name template: `lamassu-atm-<model>-live.iso` → `bitspire-<model>-live.iso`
- activation-script name updated
deploy/nixos/provision-atm.sh
- data-dir paths: /var/lib/lamassu-atm → /var/lib/bitspire
- systemctl + journalctl unit names updated
DELIBERATELY kept as `lamassu` (for now):
- The `lamassu` UNIX user and group account. Renaming would
require file-ownership migration scripts; the Sintra is a
fresh flash so no existing data, but the internal user
namespace inconsistency is acceptable.
- LP-specific bits in provision-atm.sh (admin token, the
`docker logs lamassu-lightning-pub` extractor) — those
get ripped out in 3c when the script switches to LNbits.
NO migration activation script added — the Sintra flash is fresh,
production batm3/douro stay on `main` and never see this branch.
A future dev→main cutover will need a separate migration story
(rename UNIX user, move /var/lib/lamassu-atm → /var/lib/bitspire,
SSH key relocation, etc.).
Verified:
nix eval .#nixosConfigurations.batm3-installed.config.systemd.services.bitspire.enable
→ true
nix eval .#nixosConfigurations.bitSpire-live-sintra.config.networking.hostName
→ "bitspire"
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
56f93a5347
commit
28a35ca479
5 changed files with 39 additions and 39 deletions
|
|
@ -6,10 +6,10 @@
|
|||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.lamassu-atm;
|
||||
cfg = config.services.bitspire;
|
||||
in
|
||||
{
|
||||
options.services.lamassu-atm = {
|
||||
options.services.bitspire = {
|
||||
enable = mkEnableOption "Lamassu ATM service";
|
||||
|
||||
relayUrl = mkOption {
|
||||
|
|
@ -26,13 +26,13 @@ in
|
|||
|
||||
appDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/opt/lamassu-atm";
|
||||
default = "/opt/bitspire";
|
||||
description = "Directory containing the ATM application";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/lamassu-atm";
|
||||
default = "/var/lib/bitspire";
|
||||
description = "Directory for ATM data and configuration";
|
||||
};
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ in
|
|||
];
|
||||
|
||||
# Environment file for ATM configuration
|
||||
environment.etc."lamassu-atm/config.env".text = ''
|
||||
environment.etc."bitspire/config.env".text = ''
|
||||
# Lamassu ATM Configuration
|
||||
RELAY_URL=${cfg.relayUrl}
|
||||
LIGHTNING_PUB_URL=${cfg.lightningPubUrl}
|
||||
|
|
@ -131,7 +131,7 @@ in
|
|||
'';
|
||||
|
||||
# Main ATM service
|
||||
systemd.services.lamassu-atm = {
|
||||
systemd.services.bitspire = {
|
||||
description = "Lamassu ATM Application";
|
||||
wantedBy = [ "graphical.target" ];
|
||||
after = [ "graphical.target" "network-online.target" ];
|
||||
|
|
@ -144,7 +144,7 @@ in
|
|||
WorkingDirectory = cfg.appDir;
|
||||
|
||||
# Environment
|
||||
EnvironmentFile = "/etc/lamassu-atm/config.env";
|
||||
EnvironmentFile = "/etc/bitspire/config.env";
|
||||
|
||||
# Start the Electron app
|
||||
ExecStart = "${pkgs-unstable.electron}/bin/electron ${cfg.appDir}";
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
# Networking
|
||||
networking = {
|
||||
hostName = "lamassu-atm";
|
||||
hostName = "bitspire";
|
||||
|
||||
# Use NetworkManager for easy WiFi configuration
|
||||
networkmanager.enable = true;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ let
|
|||
|
||||
# .env template — runtime secrets are provisioned later via provision-atm.sh.
|
||||
# Only non-secret defaults and display vars go here.
|
||||
envTemplate = pkgs.writeText "lamassu-atm-env" ''
|
||||
envTemplate = pkgs.writeText "bitspire-env" ''
|
||||
VITE_RELAY_URL=
|
||||
VITE_LIGHTNING_PUB_PUBKEY=
|
||||
VITE_LIGHTNING_PUB_API_URL=
|
||||
|
|
@ -48,12 +48,12 @@ in
|
|||
./configuration.nix
|
||||
|
||||
# Reuse ATM systemd service module
|
||||
./lamassu-atm.nix
|
||||
./bitspire-atm.nix
|
||||
];
|
||||
|
||||
# ISO image settings
|
||||
isoImage = {
|
||||
isoName = "lamassu-atm-${machineModel}-live.iso";
|
||||
isoName = "bitspire-${machineModel}-live.iso";
|
||||
makeEfiBootable = true;
|
||||
makeBiosBootable = true;
|
||||
squashfsCompression = "zstd -Xcompression-level 6";
|
||||
|
|
@ -139,7 +139,7 @@ in
|
|||
};
|
||||
|
||||
# Enable the ATM service with live USB paths
|
||||
services.lamassu-atm = {
|
||||
services.bitspire = {
|
||||
enable = true;
|
||||
appDir = "${atm-app}";
|
||||
};
|
||||
|
|
@ -148,9 +148,9 @@ in
|
|||
boot.kernel.sysctl."kernel.unprivileged_userns_clone" = 1;
|
||||
|
||||
# Override the systemd service for live USB environment
|
||||
systemd.services.lamassu-atm = {
|
||||
systemd.services.bitspire = {
|
||||
serviceConfig = {
|
||||
EnvironmentFile = lib.mkForce "/var/lib/lamassu-atm/.env";
|
||||
EnvironmentFile = lib.mkForce "/var/lib/bitspire/.env";
|
||||
# Native modules need libstdc++ on NixOS
|
||||
Environment = "LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib";
|
||||
# Electron needs --no-sandbox in the live/testing environment
|
||||
|
|
@ -170,12 +170,12 @@ in
|
|||
};
|
||||
|
||||
# Install the .env on first boot
|
||||
system.activationScripts.lamassu-env = ''
|
||||
mkdir -p /var/lib/lamassu-atm
|
||||
if [ ! -f /var/lib/lamassu-atm/.env ]; then
|
||||
cp ${envTemplate} /var/lib/lamassu-atm/.env
|
||||
chmod 600 /var/lib/lamassu-atm/.env
|
||||
chown lamassu:lamassu /var/lib/lamassu-atm/.env
|
||||
system.activationScripts.bitspire-env = ''
|
||||
mkdir -p /var/lib/bitspire
|
||||
if [ ! -f /var/lib/bitspire/.env ]; then
|
||||
cp ${envTemplate} /var/lib/bitspire/.env
|
||||
chmod 600 /var/lib/bitspire/.env
|
||||
chown lamassu:lamassu /var/lib/bitspire/.env
|
||||
fi
|
||||
'';
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ in
|
|||
after = [ "display-manager.service" ];
|
||||
requires = [ "display-manager.service" ];
|
||||
wantedBy = [ "graphical.target" ];
|
||||
before = [ "lamassu-atm.service" ];
|
||||
before = [ "bitspire.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = "lamassu";
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ echo "--- Step 2: Creating ATM app ---"
|
|||
RESPONSE=$(curl -s -X POST "$LP_API/api/admin/app/add" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $ADMIN_TOKEN" \
|
||||
-d '{"name":"lamassu-atm-live","allow_user_creation":true}' 2>/dev/null)
|
||||
-d '{"name":"bitspire-atm-live","allow_user_creation":true}' 2>/dev/null)
|
||||
|
||||
if echo "$RESPONSE" | grep -q '"status":"OK"'; then
|
||||
APP_ID=$(echo "$RESPONSE" | grep -oP '"id":"\K[^"]+')
|
||||
|
|
@ -86,12 +86,12 @@ ELECTRON_FORCE_PROD=1
|
|||
DISPLAY=:0"
|
||||
|
||||
ssh -o StrictHostKeyChecking=no -p "$ATM_SSH_PORT" "$ATM_USER@$ATM_HOST" \
|
||||
"echo '$ENV_CONTENT' | sudo tee /var/lib/lamassu-atm/.env > /dev/null && sudo systemctl restart lamassu-atm"
|
||||
"echo '$ENV_CONTENT' | sudo tee /var/lib/bitspire/.env > /dev/null && sudo systemctl restart bitspire"
|
||||
|
||||
echo ""
|
||||
echo "=== ATM provisioned successfully ==="
|
||||
echo ""
|
||||
echo "Credentials written to /var/lib/lamassu-atm/.env"
|
||||
echo "Credentials written to /var/lib/bitspire/.env"
|
||||
echo "ATM service restarted. It should connect to Lightning.Pub at $HOST_IP."
|
||||
echo ""
|
||||
echo "To check status: ssh -p $ATM_SSH_PORT $ATM_USER@$ATM_HOST 'sudo journalctl -u lamassu-atm -f'"
|
||||
echo "To check status: ssh -p $ATM_SSH_PORT $ATM_USER@$ATM_HOST 'sudo journalctl -u bitspire -f'"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue