stromboli.nix (837B)
1 { config, pkgs, username, ... }: 2 3 { 4 # Systemd service 5 systemd.services.stromboli = { 6 description = "Stromboli Go Application"; 7 wantedBy = [ "multi-user.target" ]; 8 after = [ "network.target" ]; 9 10 serviceConfig = { 11 Type = "simple"; 12 User = "${username}"; 13 WorkingDirectory = "/home/${username}/vault/src/stromboli"; 14 ExecStart = "${pkgs.go}/bin/go run . -d /tank/media/videos/ -p 80"; 15 Restart = "on-failure"; 16 RestartSec = "5s"; 17 AmbientCapabilities = "cap_net_bind_service"; 18 CapabilityBoundingSet = "cap_net_bind_service"; 19 }; 20 21 environment = { 22 HOME = "/home/${username}"; 23 GOPATH = "/home/${username}/go"; 24 }; 25 26 path = with pkgs; [ 27 ffmpeg 28 gcc 29 go 30 ]; 31 32 }; 33 34 # Open firewall port 35 networking.firewall.allowedTCPPorts = [ 80 ]; 36 37 }