hub update

This commit is contained in:
2026-03-31 15:46:21 -05:00
parent 435a2ed5b2
commit b1bb53e562
3 changed files with 215 additions and 6 deletions

View File

@@ -1,3 +1,8 @@
{ config, lib, pkgs, ... }:
let
cfg = config.sovran_systemsOS;
monitoredServices =
# ── Always-on infrastructure ───────────────────────────────
[
@@ -21,7 +26,101 @@
]
# ── Optional features ──────────────────────────────────────
++ [
{ name = "Haven Relay"; unit = "haven-relay.service"; type = "system"; icon = "haven"; enabled = cfg.features.haven; }
{ name = "Mempool"; unit = "mempool.service"; type = "system"; icon = "mempool"; enabled = cfg.features.mempool; }
{ name = "Element-Call"; unit = "livekit.service"; type = "system"; icon = "livekit"; enabled = cfg.features.element-calling; }
];
{ name = "Haven Relay"; unit = "haven-relay.service"; type = "system"; icon = "haven"; enabled = cfg.features.haven; }
{ name = "Mempool"; unit = "mempool.service"; type = "system"; icon = "mempool"; enabled = cfg.features.mempool; }
{ name = "Element-Call"; unit = "livekit.service"; type = "system"; icon = "livekit"; enabled = cfg.features.element-calling; }
];
generatedConfig = pkgs.writeText "sovran-hub-config.json"
(builtins.toJSON {
refresh_interval = 5;
command_method = "systemctl";
services = monitoredServices;
});
sovran-hub = pkgs.python3Packages.buildPythonApplication {
pname = "sovran-systemsos-hub";
version = "1.0.0";
format = "other";
src = ../../app;
nativeBuildInputs = with pkgs; [
wrapGAppsHook4
gobject-introspection
];
buildInputs = with pkgs; [
gtk4
libadwaita
gdk-pixbuf
librsvg
];
propagatedBuildInputs = with pkgs.python3Packages; [
pygobject3
];
dontBuild = true;
installPhase = ''
runHook preInstall
# Python source <EFBFBD><EFBFBD><EFBFBD>
install -d $out/lib/sovran-hub
cp -r sovran_systemsos_hub $out/lib/sovran-hub/
# CSS
cp style.css $out/lib/sovran-hub/style.css
# Generated config
cp ${generatedConfig} $out/lib/sovran-hub/config.json
# Icons (SVG + PNG)
install -d $out/share/sovran-hub/icons
cp icons/* $out/share/sovran-hub/icons/ 2>/dev/null || true
# Launcher script
install -d $out/bin
cat > $out/bin/sovran-hub <<LAUNCHER
#!${pkgs.python3}/bin/python3
import os, sys
base = os.path.join("$out", "lib", "sovran-hub")
sys.path.insert(0, base)
os.environ["SOVRAN_HUB_CONFIG"] = os.path.join(base, "config.json")
os.environ["SOVRAN_HUB_ICONS"] = os.path.join("$out", "share", "sovran-hub", "icons")
os.environ["SOVRAN_HUB_CSS"] = os.path.join(base, "style.css")
from sovran_systemsos_hub.application import SovranHubApp
sys.exit(SovranHubApp().run(sys.argv))
LAUNCHER
chmod +x $out/bin/sovran-hub
# Desktop file
install -d $out/share/applications
cat > $out/share/applications/Sovran_SystemsOS_Hub.desktop <<DESKTOP
[Desktop Entry]
Type=Application
Name=Sovran_SystemsOS Hub
Comment=Manage Sovran_SystemsOS systemd services
Exec=$out/bin/sovran-hub
Icon=system-run-symbolic
Terminal=false
Categories=System;Monitor;
StartupWMClass=com.sovransystems.hub
DESKTOP
runHook postInstall
'';
meta = {
description = "Sovran_SystemsOS Hub GTK4 systemd service manager";
mainProgram = "sovran-hub";
};
};
in
{
config = {
environment.systemPackages = [ sovran-hub ];
};
}