{ 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" ]; }; }; }