photoncloud-monorepo/nix/modules/plasmavmc.nix
centra 54e3a16091 fix(nix): Align service ExecStart with actual binary CLI interfaces
- chainfire: Fix binary name (chainfire-server → chainfire)
- fiberlb: Use --grpc-addr instead of --port
- flaredb: Use --addr instead of --api-addr/--raft-addr
- flashdns: Add --grpc-addr and --dns-addr flags
- iam: Use --addr instead of --port/--data-dir
- k8shost: Add --iam-server-addr for dynamic IAM port connection
- lightningstor: Add --in-memory-metadata for ChainFire fallback
- plasmavmc: Add ChainFire service dependency and endpoint env var
- prismnet: Use --grpc-addr instead of --port

These fixes are required for T039 production deployment. The
plasmavmc change specifically fixes the ChainFire port mismatch
(was hardcoded 50051, now uses chainfire.port = 2379).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 22:58:40 +09:00

81 lines
2.1 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.services.plasmavmc;
chainfireCfg = config.services.chainfire;
in
{
options.services.plasmavmc = {
enable = lib.mkEnableOption "plasmavmc service";
port = lib.mkOption {
type = lib.types.port;
default = 4000;
description = "Port for plasmavmc API";
};
dataDir = lib.mkOption {
type = lib.types.path;
default = "/var/lib/plasmavmc";
description = "Data directory for plasmavmc";
};
settings = lib.mkOption {
type = lib.types.attrs;
default = {};
description = "Additional configuration settings";
};
package = lib.mkOption {
type = lib.types.package;
default = pkgs.plasmavmc-server or (throw "plasmavmc-server package not found");
description = "Package to use for plasmavmc";
};
};
config = lib.mkIf cfg.enable {
# Create system user
users.users.plasmavmc = {
isSystemUser = true;
group = "plasmavmc";
description = "PlasmaVMC service user";
home = cfg.dataDir;
};
users.groups.plasmavmc = {};
# Create systemd service
systemd.services.plasmavmc = {
description = "PlasmaVMC Virtual Machine Compute Service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" "iam.service" "flaredb.service" "chainfire.service" ];
requires = [ "iam.service" "flaredb.service" "chainfire.service" ];
environment = {
PLASMAVMC_CHAINFIRE_ENDPOINT = "http://127.0.0.1:${toString chainfireCfg.port}";
};
serviceConfig = {
Type = "simple";
User = "plasmavmc";
Group = "plasmavmc";
Restart = "on-failure";
RestartSec = "10s";
# State directory management
StateDirectory = "plasmavmc";
StateDirectoryMode = "0750";
# Security hardening
NoNewPrivileges = true;
PrivateTmp = true;
ProtectSystem = "strict";
ProtectHome = true;
ReadWritePaths = [ cfg.dataDir ];
# Start command
ExecStart = "${cfg.package}/bin/plasmavmc-server --addr 0.0.0.0:${toString cfg.port}";
};
};
};
}