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;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.lamassu-atm;
|
cfg = config.services.bitspire;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.services.lamassu-atm = {
|
options.services.bitspire = {
|
||||||
enable = mkEnableOption "Lamassu ATM service";
|
enable = mkEnableOption "Lamassu ATM service";
|
||||||
|
|
||||||
relayUrl = mkOption {
|
relayUrl = mkOption {
|
||||||
|
|
@ -26,13 +26,13 @@ in
|
||||||
|
|
||||||
appDir = mkOption {
|
appDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = "/opt/lamassu-atm";
|
default = "/opt/bitspire";
|
||||||
description = "Directory containing the ATM application";
|
description = "Directory containing the ATM application";
|
||||||
};
|
};
|
||||||
|
|
||||||
dataDir = mkOption {
|
dataDir = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = "/var/lib/lamassu-atm";
|
default = "/var/lib/bitspire";
|
||||||
description = "Directory for ATM data and configuration";
|
description = "Directory for ATM data and configuration";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -106,7 +106,7 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
# Environment file for ATM configuration
|
# Environment file for ATM configuration
|
||||||
environment.etc."lamassu-atm/config.env".text = ''
|
environment.etc."bitspire/config.env".text = ''
|
||||||
# Lamassu ATM Configuration
|
# Lamassu ATM Configuration
|
||||||
RELAY_URL=${cfg.relayUrl}
|
RELAY_URL=${cfg.relayUrl}
|
||||||
LIGHTNING_PUB_URL=${cfg.lightningPubUrl}
|
LIGHTNING_PUB_URL=${cfg.lightningPubUrl}
|
||||||
|
|
@ -131,7 +131,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Main ATM service
|
# Main ATM service
|
||||||
systemd.services.lamassu-atm = {
|
systemd.services.bitspire = {
|
||||||
description = "Lamassu ATM Application";
|
description = "Lamassu ATM Application";
|
||||||
wantedBy = [ "graphical.target" ];
|
wantedBy = [ "graphical.target" ];
|
||||||
after = [ "graphical.target" "network-online.target" ];
|
after = [ "graphical.target" "network-online.target" ];
|
||||||
|
|
@ -144,7 +144,7 @@ in
|
||||||
WorkingDirectory = cfg.appDir;
|
WorkingDirectory = cfg.appDir;
|
||||||
|
|
||||||
# Environment
|
# Environment
|
||||||
EnvironmentFile = "/etc/lamassu-atm/config.env";
|
EnvironmentFile = "/etc/bitspire/config.env";
|
||||||
|
|
||||||
# Start the Electron app
|
# Start the Electron app
|
||||||
ExecStart = "${pkgs-unstable.electron}/bin/electron ${cfg.appDir}";
|
ExecStart = "${pkgs-unstable.electron}/bin/electron ${cfg.appDir}";
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
# Networking
|
# Networking
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "lamassu-atm";
|
hostName = "bitspire";
|
||||||
|
|
||||||
# Use NetworkManager for easy WiFi configuration
|
# Use NetworkManager for easy WiFi configuration
|
||||||
networkmanager.enable = true;
|
networkmanager.enable = true;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ let
|
||||||
|
|
||||||
# .env template — runtime secrets are provisioned later via provision-atm.sh.
|
# .env template — runtime secrets are provisioned later via provision-atm.sh.
|
||||||
# Only non-secret defaults and display vars go here.
|
# Only non-secret defaults and display vars go here.
|
||||||
envTemplate = pkgs.writeText "lamassu-atm-env" ''
|
envTemplate = pkgs.writeText "bitspire-env" ''
|
||||||
VITE_RELAY_URL=
|
VITE_RELAY_URL=
|
||||||
VITE_LIGHTNING_PUB_PUBKEY=
|
VITE_LIGHTNING_PUB_PUBKEY=
|
||||||
VITE_LIGHTNING_PUB_API_URL=
|
VITE_LIGHTNING_PUB_API_URL=
|
||||||
|
|
@ -48,12 +48,12 @@ in
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
|
|
||||||
# Reuse ATM systemd service module
|
# Reuse ATM systemd service module
|
||||||
./lamassu-atm.nix
|
./bitspire-atm.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# ISO image settings
|
# ISO image settings
|
||||||
isoImage = {
|
isoImage = {
|
||||||
isoName = "lamassu-atm-${machineModel}-live.iso";
|
isoName = "bitspire-${machineModel}-live.iso";
|
||||||
makeEfiBootable = true;
|
makeEfiBootable = true;
|
||||||
makeBiosBootable = true;
|
makeBiosBootable = true;
|
||||||
squashfsCompression = "zstd -Xcompression-level 6";
|
squashfsCompression = "zstd -Xcompression-level 6";
|
||||||
|
|
@ -139,7 +139,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable the ATM service with live USB paths
|
# Enable the ATM service with live USB paths
|
||||||
services.lamassu-atm = {
|
services.bitspire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
appDir = "${atm-app}";
|
appDir = "${atm-app}";
|
||||||
};
|
};
|
||||||
|
|
@ -148,9 +148,9 @@ in
|
||||||
boot.kernel.sysctl."kernel.unprivileged_userns_clone" = 1;
|
boot.kernel.sysctl."kernel.unprivileged_userns_clone" = 1;
|
||||||
|
|
||||||
# Override the systemd service for live USB environment
|
# Override the systemd service for live USB environment
|
||||||
systemd.services.lamassu-atm = {
|
systemd.services.bitspire = {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
EnvironmentFile = lib.mkForce "/var/lib/lamassu-atm/.env";
|
EnvironmentFile = lib.mkForce "/var/lib/bitspire/.env";
|
||||||
# Native modules need libstdc++ on NixOS
|
# Native modules need libstdc++ on NixOS
|
||||||
Environment = "LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib";
|
Environment = "LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib";
|
||||||
# Electron needs --no-sandbox in the live/testing environment
|
# Electron needs --no-sandbox in the live/testing environment
|
||||||
|
|
@ -170,12 +170,12 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
# Install the .env on first boot
|
# Install the .env on first boot
|
||||||
system.activationScripts.lamassu-env = ''
|
system.activationScripts.bitspire-env = ''
|
||||||
mkdir -p /var/lib/lamassu-atm
|
mkdir -p /var/lib/bitspire
|
||||||
if [ ! -f /var/lib/lamassu-atm/.env ]; then
|
if [ ! -f /var/lib/bitspire/.env ]; then
|
||||||
cp ${envTemplate} /var/lib/lamassu-atm/.env
|
cp ${envTemplate} /var/lib/bitspire/.env
|
||||||
chmod 600 /var/lib/lamassu-atm/.env
|
chmod 600 /var/lib/bitspire/.env
|
||||||
chown lamassu:lamassu /var/lib/lamassu-atm/.env
|
chown lamassu:lamassu /var/lib/bitspire/.env
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
@ -186,7 +186,7 @@ in
|
||||||
after = [ "display-manager.service" ];
|
after = [ "display-manager.service" ];
|
||||||
requires = [ "display-manager.service" ];
|
requires = [ "display-manager.service" ];
|
||||||
wantedBy = [ "graphical.target" ];
|
wantedBy = [ "graphical.target" ];
|
||||||
before = [ "lamassu-atm.service" ];
|
before = [ "bitspire.service" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = "lamassu";
|
User = "lamassu";
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ echo "--- Step 2: Creating ATM app ---"
|
||||||
RESPONSE=$(curl -s -X POST "$LP_API/api/admin/app/add" \
|
RESPONSE=$(curl -s -X POST "$LP_API/api/admin/app/add" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: Bearer $ADMIN_TOKEN" \
|
-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
|
if echo "$RESPONSE" | grep -q '"status":"OK"'; then
|
||||||
APP_ID=$(echo "$RESPONSE" | grep -oP '"id":"\K[^"]+')
|
APP_ID=$(echo "$RESPONSE" | grep -oP '"id":"\K[^"]+')
|
||||||
|
|
@ -86,12 +86,12 @@ ELECTRON_FORCE_PROD=1
|
||||||
DISPLAY=:0"
|
DISPLAY=:0"
|
||||||
|
|
||||||
ssh -o StrictHostKeyChecking=no -p "$ATM_SSH_PORT" "$ATM_USER@$ATM_HOST" \
|
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 ""
|
||||||
echo "=== ATM provisioned successfully ==="
|
echo "=== ATM provisioned successfully ==="
|
||||||
echo ""
|
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 "ATM service restarted. It should connect to Lightning.Pub at $HOST_IP."
|
||||||
echo ""
|
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'"
|
||||||
|
|
|
||||||
28
flake.nix
28
flake.nix
|
|
@ -116,10 +116,10 @@
|
||||||
modules = [
|
modules = [
|
||||||
hardwareModule
|
hardwareModule
|
||||||
./deploy/nixos/configuration.nix
|
./deploy/nixos/configuration.nix
|
||||||
./deploy/nixos/lamassu-atm.nix
|
./deploy/nixos/bitspire-atm.nix
|
||||||
determinate.nixosModules.default
|
determinate.nixosModules.default
|
||||||
({ config, lib, pkgs, ... }: {
|
({ config, lib, pkgs, ... }: {
|
||||||
services.lamassu-atm = {
|
services.bitspire = {
|
||||||
enable = true;
|
enable = true;
|
||||||
appDir = "${atm-app}";
|
appDir = "${atm-app}";
|
||||||
};
|
};
|
||||||
|
|
@ -186,10 +186,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Env template — runtime secrets provisioned via provision-atm.sh
|
# Env template — runtime secrets provisioned via provision-atm.sh
|
||||||
system.activationScripts.lamassu-env = ''
|
system.activationScripts.bitspire-env = ''
|
||||||
mkdir -p /var/lib/lamassu-atm
|
mkdir -p /var/lib/bitspire
|
||||||
if [ ! -f /var/lib/lamassu-atm/.env ]; then
|
if [ ! -f /var/lib/bitspire/.env ]; then
|
||||||
cp ${pkgs.writeText "lamassu-atm-env-default" ''
|
cp ${pkgs.writeText "bitspire-env-default" ''
|
||||||
VITE_RELAY_URL=
|
VITE_RELAY_URL=
|
||||||
VITE_LIGHTNING_PUB_PUBKEY=
|
VITE_LIGHTNING_PUB_PUBKEY=
|
||||||
VITE_LIGHTNING_PUB_API_URL=
|
VITE_LIGHTNING_PUB_API_URL=
|
||||||
|
|
@ -202,16 +202,16 @@
|
||||||
VITE_LAMASSU_FIAT_CODE=${fiatCode}
|
VITE_LAMASSU_FIAT_CODE=${fiatCode}
|
||||||
ELECTRON_FORCE_PROD=1
|
ELECTRON_FORCE_PROD=1
|
||||||
DISPLAY=:0
|
DISPLAY=:0
|
||||||
''} /var/lib/lamassu-atm/.env
|
''} /var/lib/bitspire/.env
|
||||||
chmod 600 /var/lib/lamassu-atm/.env
|
chmod 600 /var/lib/bitspire/.env
|
||||||
chown lamassu:lamassu /var/lib/lamassu-atm/.env
|
chown lamassu:lamassu /var/lib/bitspire/.env
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Override systemd service for Electron runtime
|
# Override systemd service for Electron runtime
|
||||||
systemd.services.lamassu-atm = {
|
systemd.services.bitspire = {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
EnvironmentFile = lib.mkForce "/var/lib/lamassu-atm/.env";
|
EnvironmentFile = lib.mkForce "/var/lib/bitspire/.env";
|
||||||
Environment = "LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib";
|
Environment = "LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib";
|
||||||
ExecStart = lib.mkForce "${pkgs-unstable.electron}/bin/electron --no-sandbox --disable-gpu-sandbox --disable-gpu --disable-software-rasterizer --enable-logging ${atm-app}";
|
ExecStart = lib.mkForce "${pkgs-unstable.electron}/bin/electron --no-sandbox --disable-gpu-sandbox --disable-gpu --disable-software-rasterizer --enable-logging ${atm-app}";
|
||||||
MemoryMax = lib.mkForce "1G";
|
MemoryMax = lib.mkForce "1G";
|
||||||
|
|
@ -230,7 +230,7 @@
|
||||||
after = [ "display-manager.service" ];
|
after = [ "display-manager.service" ];
|
||||||
requires = [ "display-manager.service" ];
|
requires = [ "display-manager.service" ];
|
||||||
wantedBy = [ "graphical.target" ];
|
wantedBy = [ "graphical.target" ];
|
||||||
before = [ "lamassu-atm.service" ];
|
before = [ "bitspire.service" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = "lamassu";
|
User = "lamassu";
|
||||||
|
|
@ -282,8 +282,8 @@
|
||||||
|
|
||||||
# ── Standalone NixOS module ───────────────────────────────────
|
# ── Standalone NixOS module ───────────────────────────────────
|
||||||
|
|
||||||
nixosModules.default = import ./deploy/nixos/lamassu-atm.nix;
|
nixosModules.default = import ./deploy/nixos/bitspire-atm.nix;
|
||||||
nixosModules.lamassu-atm = import ./deploy/nixos/lamassu-atm.nix;
|
nixosModules.bitspire = import ./deploy/nixos/bitspire-atm.nix;
|
||||||
|
|
||||||
# ── Packages (x86_64-linux only for ATM hardware) ─────────────
|
# ── Packages (x86_64-linux only for ATM hardware) ─────────────
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue