# SPDX-FileCopyrightText: 2020 Luke Granger-Brown # # SPDX-License-Identifier: Apache-2.0 { depot, pkgs, ... }: let inherit (depot.ops) secrets; in { imports = [ ../lib/bvm.nix ]; # Networking! networking = { hostName = "bvm-twitterchiver"; hostId = "c7ff157c"; interfaces.enp1s0 = { ipv4.addresses = [{ address = "10.100.0.201"; prefixLength = 23; }]; }; }; my.ip.tailscale = "100.119.86.55"; services.postgresql = { enable = true; package = pkgs.postgresql_14; ensureDatabases = [ "twitterchiver" ]; ensureUsers = [{ name = "twitterchiver"; ensurePermissions = { "DATABASE twitterchiver" = "ALL PRIVILEGES"; }; }]; }; services.postgresqlBackup.enable = true; users.groups.twitterchiver = {}; users.users.twitterchiver = { home = "/srv/twitterchiver"; isSystemUser = true; createHome = true; group = "twitterchiver"; }; systemd.services.twitterchiver-viewer = { description = "Twitterchiver Viewer"; wants = ["network-online.target"]; wantedBy = ["multi-user.target"]; serviceConfig = { ExecStart = "${depot.go.twitterchiver.viewer}/bin/viewer --user_to_twitter=lukegb@lukegb.com:lukegb,bgekul"; EnvironmentFile = secrets.twitterchiver.environment; WorkingDirectory = "${depot.go.twitterchiver.viewer}/share"; User = "twitterchiver"; Restart = "always"; }; }; systemd.services.twitterchiver-relatedfetcher = { description = "Twitterchiver Related-Fetcher"; wants = ["network-online.target"]; wantedBy = ["multi-user.target"]; serviceConfig = { ExecStart = "${depot.go.twitterchiver.relatedfetcher}/bin/relatedfetcher --media_work_at_once 100 --media_tick_interval 10s"; EnvironmentFile = secrets.twitterchiver.environment; User = "twitterchiver"; Restart = "always"; }; }; systemd.services.twitterchiver-archiver = { description = "Twitterchiver Archiver"; wants = ["network-online.target"]; wantedBy = ["multi-user.target"]; serviceConfig = { ExecStart = "${depot.go.twitterchiver.archiver}/bin/archiver"; EnvironmentFile = secrets.twitterchiver.environment; User = "twitterchiver"; Restart = "always"; }; }; system.stateVersion = "21.05"; }