42 lines
831 B
Nix
42 lines
831 B
Nix
{ config, pkgs, ... }:
|
|
|
|
let
|
|
infinsweeper = "${config.users.users."me".home}/main/infinsweeper";
|
|
ruby = pkgs.ruby.withPackages (
|
|
p: with p; [
|
|
sqlite3
|
|
sequel
|
|
rackup
|
|
puma
|
|
sinatra
|
|
]
|
|
);
|
|
in
|
|
{
|
|
systemd.services.infinsweeper = {
|
|
description = "InfinSweeper";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
serviceConfig = {
|
|
StateDirectory = "infinsweeper";
|
|
WorkingDirectory = infinsweeper;
|
|
|
|
ExecStart = "${ruby}/bin/ruby ${infinsweeper}/main.rb";
|
|
|
|
User = "me";
|
|
Restart = "always";
|
|
RestartSec = 3;
|
|
|
|
Environment = [
|
|
"ENV=prod"
|
|
#"RACK_ENV=production"
|
|
"PORT=5161"
|
|
"INFINSWEEPER_DB=/var/lib/infinsweeper/infinsweeper.db"
|
|
];
|
|
|
|
EnvironmentFile = "/run/secrets.env";
|
|
};
|
|
};
|
|
}
|