From aba72858242740bf22d6e27735006d47d711de7d Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Wed, 6 Jan 2021 21:29:33 +0000 Subject: [PATCH] totoro: add twitternuke timer --- ops/nixos/lib/twitternuke.nix | 24 ++++++++++++++++++++++++ ops/nixos/totoro/default.nix | 8 ++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 ops/nixos/lib/twitternuke.nix diff --git a/ops/nixos/lib/twitternuke.nix b/ops/nixos/lib/twitternuke.nix new file mode 100644 index 0000000000..92ecd0a52c --- /dev/null +++ b/ops/nixos/lib/twitternuke.nix @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: 2020 Luke Granger-Brown +# +# SPDX-License-Identifier: Apache-2.0 + +{ pkgs, depot, lib, ... }: +{ + config = { + systemd.services.twitternuke = { + serviceConfig = { + Type = "oneshot"; + ExecStart = "${depot.go.twitternuke}/bin/twitternuke --dryrun=false --tweets_from_api"; + EnvironmentFile = "/home/lukegb/twitternuke/environment.txt"; + }; + }; + systemd.timers.twitternuke = { + wantedBy = [ "timers.target" ]; + timerConfig = { + OnCalendar = "daily"; + AccuracySec = "1h"; + Persistent = true; + }; + }; + }; +} diff --git a/ops/nixos/totoro/default.nix b/ops/nixos/totoro/default.nix index 493ff99e4c..de015401bf 100644 --- a/ops/nixos/totoro/default.nix +++ b/ops/nixos/totoro/default.nix @@ -6,8 +6,12 @@ let inherit (depot.ops) secrets; in { - imports = - [ ../../../third_party/nixpkgs/nixos/modules/installer/scan/not-detected.nix ../lib/client.nix ../lib/whitby-distributed.nix ]; + imports = [ + ../../../third_party/nixpkgs/nixos/modules/installer/scan/not-detected.nix + ../lib/client.nix + ../lib/whitby-distributed.nix + ../lib/twitternuke.nix + ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ]; boot.kernelModules = lib.mkAfter [ "kvm-intel" ];