From 27f7ed6749d6a6663af599ac546a7f3bc48e5efa Mon Sep 17 00:00:00 2001 From: tobinio Date: Thu, 30 Jul 2026 13:25:57 +0200 Subject: [PATCH] run newt as service --- hosts/homeserver/services/newt.compose.yml | 8 ------- hosts/homeserver/services/newt.nix | 27 ++++++++++++++++++---- 2 files changed, 22 insertions(+), 13 deletions(-) delete mode 100644 hosts/homeserver/services/newt.compose.yml diff --git a/hosts/homeserver/services/newt.compose.yml b/hosts/homeserver/services/newt.compose.yml deleted file mode 100644 index 7784e23..0000000 --- a/hosts/homeserver/services/newt.compose.yml +++ /dev/null @@ -1,8 +0,0 @@ -services: - newt: - image: fosrl/newt:1.15 - container_name: newt - restart: unless-stopped - env_file: - - /run/secrets/rendered/newt.env - network_mode: host diff --git a/hosts/homeserver/services/newt.nix b/hosts/homeserver/services/newt.nix index 2495b13..acbf478 100644 --- a/hosts/homeserver/services/newt.nix +++ b/hosts/homeserver/services/newt.nix @@ -1,15 +1,32 @@ -{ config, ... }: +{ config, pkgs, ... }: { sops.secrets = { - panglin_endpoint = { }; - newt_id = { }; - newt_secret = { }; + panglin_endpoint = {}; + newt_id = {}; + newt_secret = {}; }; sops.templates."newt.env".content = '' PANGOLIN_ENDPOINT=${config.sops.placeholder.panglin_endpoint} - NEWT_ID=${config.sops.placeholder.newt_id} NEWT_SECRET=${config.sops.placeholder.newt_secret} ''; + + systemd.services.fosrl-newt = { + description = "FOSRL Newt"; + + wantedBy = [ "multi-user.target" ]; + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; + + serviceConfig = { + ExecStart = "${pkgs.fosrl-newt}/bin/newt"; + EnvironmentFile = config.sops.templates."newt.env".path; + + Restart = "always"; + RestartSec = 5; + + DynamicUser = true; + }; + }; } -- 2.51.2