1
0
Fork 0
dotfiles/system/nixos/bdfr-browser.nix

52 lines
1.5 KiB
Nix
Raw Normal View History

2023-05-18 11:02:06 +00:00
{ pkgs, ... }:
let
baseDirectory = "/mnt/media-scraper/Reddit";
2023-08-15 14:35:09 +00:00
chatDirectory = "/mnt/media-scraper/RedditChat";
workingDirectory = "/var/lib/bdfr-browser";
2023-05-18 11:02:06 +00:00
in
{
systemd.services.bdfr-browser = {
description = "A crude BDFR browser UI";
wantedBy = [ "multi-user.target" ];
2023-08-15 14:35:09 +00:00
after = [ "network.target" "postgresql.service" ];
path = with pkgs; [ busybox inotify-tools ];
2023-05-18 11:02:06 +00:00
serviceConfig = {
DynamicUser = true;
StateDirectory = "bdfr-browser";
2023-08-15 14:35:09 +00:00
WorkingDirectory = workingDirectory;
2023-05-18 11:02:06 +00:00
Environment = [
"BDFR_BROWSER_BASE_DIRECTORY=${baseDirectory}"
2023-08-15 14:35:09 +00:00
"BDFR_BROWSER_CHAT_DIRECTORY=${chatDirectory}"
"BDFR_BROWSER_WATCH_DIRECTORIES=false"
2023-08-14 13:37:36 +00:00
"BDFR_BROWSER_REPO_DATABASE=bdfr-browser"
"BDFR_BROWSER_REPO_SOCKET_DIR=/run/postgresql"
2023-08-17 20:31:34 +00:00
"BDFR_BROWSER_CONFIG_FILE=${workingDirectory}/config.yml"
2023-08-15 14:35:09 +00:00
"RELEASE_TMP=${workingDirectory}"
2023-05-18 11:02:06 +00:00
"RELEASE_DISTRIBUTION=none"
"RELEASE_COOKIE=no_dist_anyway"
];
ExecStart = "${pkgs.bdfr-browser}/bin/bdfr_browser start";
2023-08-15 14:35:09 +00:00
Type = "exec";
2023-05-18 11:02:06 +00:00
Restart = "on-failure";
};
};
services.nginx.virtualHosts."bdfr.internal.kempkens.network" = {
quic = true;
http3 = true;
onlySSL = true;
useACMEHost = "internal.kempkens.network";
locations."/" = {
recommendedProxySettings = true;
proxyPass = "http://127.0.0.1:4040";
};
locations."/media/".alias = "${baseDirectory}/";
2023-08-15 14:35:09 +00:00
locations."/chat_media/".alias = "${chatDirectory}/images/";
2023-05-18 11:02:06 +00:00
};
}