From 69aba17ba46f5ab7883f4e27c9492d3787c25d56 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Wed, 31 Mar 2021 23:33:44 +0000 Subject: [PATCH] bvm-twitterchiver: add twitterchiver-viewer --- go/twitterchiver/default.nix | 10 ++++++++-- ops/nixos/bvm-twitterchiver/default.nix | 12 ++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/go/twitterchiver/default.nix b/go/twitterchiver/default.nix index cbc25f85e7..9d62474da8 100644 --- a/go/twitterchiver/default.nix +++ b/go/twitterchiver/default.nix @@ -12,7 +12,7 @@ ]; }; - viewer = depot.third_party.buildGo.program { + viewer = (depot.third_party.buildGo.program { name = "viewer"; srcs = [ ./viewer/viewer.go ]; deps = [ @@ -32,7 +32,13 @@ cp -R ${builtins.filterSource (path: type: (type == "directory" && depot.lib.hasSuffix "/templates" path) || (depot.lib.hasInfix "/templates/" path)) ./viewer} $out '' ) ]; - }; + }).overrideAttrs (oldAttrs: { + buildCommand = '' + ${oldAttrs.buildCommand} + mkdir $out/share + cp -R ${builtins.filterSource (path: type: (type == "directory" && depot.lib.hasSuffix "/templates" path) || (depot.lib.hasInfix "/templates/" path)) ./viewer}/* $out/share + ''; + }); relatedfetcher = depot.third_party.buildGo.program { name = "relatedfetcher"; diff --git a/ops/nixos/bvm-twitterchiver/default.nix b/ops/nixos/bvm-twitterchiver/default.nix index d21c3d9b0b..d926399298 100644 --- a/ops/nixos/bvm-twitterchiver/default.nix +++ b/ops/nixos/bvm-twitterchiver/default.nix @@ -39,5 +39,17 @@ group = "twitterchiver"; }; + systemd.services.twitterchiver-viewer = { + description = "Twitterchiver Viewer"; + wants = ["network-online.target"]; + wantedBy = ["multi-user.target"]; + serviceConfig = { + ExecStart = "${depot.go.viewer}/bin/minotarproxy --user_to_twitter=lukegb@lukegb.com:lukegb,bgekul"; + WorkingDirectory = "${depot.go.viewer}/share"; + User = "twitterchiver"; + Restart = "always"; + }; + }; + system.stateVersion = "21.05"; }