summaryrefslogtreecommitdiffstats
path: root/makefu/3modules/bump-distrowatch.nix
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2018-12-28 14:48:30 +0100
committerjeschli <jeschli@gmail.com>2018-12-28 14:48:30 +0100
commit06b6454af78e8236a67d69cab94f62c32054be47 (patch)
tree749fd6025d2e799314cf46d51027dc23fb19c7b8 /makefu/3modules/bump-distrowatch.nix
parent8605ac91ae3a3859ab906a5fa2e9b0e3dfcd6e1e (diff)
parentfb254e60949f029cc7cb48764093b49932d0acde (diff)
Merge branch 'master' of prism.r:stockholm
Diffstat (limited to 'makefu/3modules/bump-distrowatch.nix')
-rw-r--r--makefu/3modules/bump-distrowatch.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/makefu/3modules/bump-distrowatch.nix b/makefu/3modules/bump-distrowatch.nix
new file mode 100644
index 000000000..18426cdcc
--- /dev/null
+++ b/makefu/3modules/bump-distrowatch.nix
@@ -0,0 +1,31 @@
+{ config, lib, pkgs, ... }:
+
+let
+ cfg = config.makefu.distrobump;
+
+ imp = {
+ systemd.services.distrobump = {
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ path = [ pkgs.curl ];
+ restartIfChanged = false;
+ startAt = "daily";
+ serviceConfig = {
+ PrivateTmp = true;
+ Type = "oneshot";
+ ExecStart = pkgs.writeDash "bump-distrowatch" ''
+ set -euf
+ UA='Mozilla/5.0 (X11; Linux x86_64; rv:63.0) Gecko/20100101 Firefox/63.0'
+ curl -Lvc /tmp/cookie.jar -A "$UA" 'https://distrowatch.com/' >/dev/null
+ sleep $(shuf -i 3-15 -n1).$(shuf -i 0-9 -n1)
+ curl -Lvc /tmp/cookie.jar -A "$UA" -e 'https://distrowatch.com/' 'https://distrowatch.com/nixos?frphr' >/dev/null
+ '';
+ RandomizedDelaySec = 28800;
+ };
+ };
+ };
+in
+{
+ options.makefu.distrobump.enable = lib.mkEnableOption "distrobump";
+ config = lib.mkIf cfg.enable imp;
+}