From a9e9f789dc9251c845629dfe50c6cc8886dfc4c3 Mon Sep 17 00:00:00 2001 From: Syed Daanish Date: Mon, 19 Oct 2026 11:54:19 +0100 Subject: [PATCH] Add newtab service to server. --- hosts/syedm/default.nix | 3 +++ modules/newtab/default.nix | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 modules/newtab/default.nix diff --git a/hosts/syedm/default.nix b/hosts/syedm/default.nix index 032d406..fde2df8 100644 --- a/hosts/syedm/default.nix +++ b/hosts/syedm/default.nix @@ -53,6 +53,9 @@ virtualHosts."infinsweeper.syedm.dev".extraConfig = '' reverse_proxy localhost:5161 ''; + virtualHosts."newtab.syedm.dev".extraConfig = '' + reverse_proxy localhost:5162 + ''; virtualHosts."acs.syedm.dev".extraConfig = '' reverse_proxy localhost:3709 ''; diff --git a/modules/newtab/default.nix b/modules/newtab/default.nix new file mode 100644 index 0000000..d4f1ddf --- /dev/null +++ b/modules/newtab/default.nix @@ -0,0 +1,36 @@ +{ config, pkgs, ... }: + +let + newtab = "${config.users.users."me".home}/main/newtab"; + ruby = pkgs.ruby.withPackages ( + p: with p; [ + rackup + puma + sinatra + ] + ); +in +{ + systemd.services.newtab = { + description = "Newtab"; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + StateDirectory = "newtab"; + WorkingDirectory = newtab; + + ExecStart = "${ruby}/bin/ruby ${newtab}/main.rb"; + + User = "me"; + Restart = "always"; + RestartSec = 3; + + Environment = [ + "ENV=prod" + "RACK_ENV=production" + "PORT=5162" + ]; + }; + }; +}