{ pkgs-unstable, config, lib, ... }: let domain = "libreddit.vhack.eu"; cfg = config.services.libreddit; # Taken from nixpkgs module args = lib.concatStringsSep " " [ "--port ${toString cfg.port}" "--address ${cfg.address}" ]; in { services.libreddit = { enable = true; package = pkgs-unstable.redlib; port = 8080; address = "127.0.0.1"; openFirewall = false; }; # Force systemd service to use correct binary systemd.services.libreddit.serviceConfig.ExecStart = lib.mkForce "${lib.getExe cfg.package} ${args}"; services.nginx = { enable = true; virtualHosts.${domain} = { locations."/".proxyPass = "http://127.0.0.1:${toString config.services.libreddit.port}"; enableACME = lib.mkDefault true; forceSSL = lib.mkDefault true; }; }; }