~sumner/nixos-configuration

7de2c3ba721956a6c8a52bb76ee6bd43142631d3 — Sumner Evans 4 months ago ebc7a6d standupbot
standupbot: init at v0.1.1 and configure
M host-configurations/nevarro.nix => host-configurations/nevarro.nix +4 -0
@@ 43,6 43,10 @@
  services.backup.healthcheckId = "5af26654-5ca7-405a-b8c4-e00a2fc6a5b0";
  services.backup.healthcheckPruneId = "d58fb3c6-532b-4db2-9538-c3a5908f3d2c";

  # Standupbot
  services.standupbot.enable = true;
  services.standupbot.passwordFile = "/etc/nixos/secrets/standupbot-password";

  # Synapse
  services.matrix-synapse.enable = true;
  services.matrix-synapse.registration_shared_secret = lib.removeSuffix "\n"

M modules/services/matrix/default.nix => modules/services/matrix/default.nix +1 -0
@@ 4,6 4,7 @@
    ./coturn.nix
    ./heisenbridge.nix
    ./quotesfilebot.nix
    ./standupbot.nix
    ./synapse.nix
  ];
}

A modules/services/matrix/standupbot.nix => modules/services/matrix/standupbot.nix +60 -0
@@ 0,0 1,60 @@
{ config, lib, pkgs, ... }: with lib; let
  cfg = config.services.standupbot;
  standupbot = pkgs.callPackage ../../../pkgs/standupbot {};

  standupbotConfig = {
    Username = cfg.username;
    Homeserver = cfg.homeserver;
    PasswordFile = cfg.passwordFile;
  };
  format = pkgs.formats.json {};
  standupbotConfigJson = format.generate "standupbot.config.json" standupbotConfig;
in
{
  options = {
    services.standupbot = {
      enable = mkEnableOption "standupbot";
      username = mkOption {
        type = types.str;
        default = "@standupbot:${config.networking.domain}";
      };
      homeserver = mkOption {
        type = types.str;
        default = "http://localhost:8008";
      };
      passwordFile = mkOption {
        type = types.path;
        default = "/var/lib/standupbot/passwordfile";
      };
      dataDir = mkOption {
        type = types.path;
        default = "/var/lib/standupbot";
      };
    };
  };

  config = mkIf cfg.enable {
    systemd.services.standupbot = {
      description = "Standupbot";
      after = [ "matrix-synapse.service" ];
      wantedBy = [ "multi-user.target" ];
      serviceConfig = {
        ExecStart = ''
          ${standupbot}/bin/standupbot --config ${standupbotConfigJson}
        '';
        Restart = "on-failure";
        User = "standupbot";
      };
    };

    users = {
      users.standupbot = {
        group = "standupbot";
        isSystemUser = true;
        home = cfg.dataDir;
        createHome = true;
      };
      groups.standupbot = {};
    };
  };
}

A pkgs/standupbot/default.nix => pkgs/standupbot/default.nix +18 -0
@@ 0,0 1,18 @@
{ lib, fetchFromSourcehut, buildGoPackage, olm }:

buildGoPackage rec {
  pname = "standupbot";
  version = "0.1.1";

  buildInputs = [ olm ];

  goPackagePath = "git.sr.ht/~sumner/standupbot";
  src = fetchFromSourcehut {
    owner = "~sumner";
    repo = "standupbot";
    rev = "v${version}";
    sha256 = "sha256-B8qFNiDxwU+edzUnbmxKA4MuLRbJNC3hbRffBGJu/Nk=";
  };

  goDeps = ./deps.nix;
}

A pkgs/standupbot/deps.nix => pkgs/standupbot/deps.nix +483 -0
@@ 0,0 1,483 @@
# file generated from go.mod using vgo2nix (https://github.com/nix-community/vgo2nix)
[
  {
    goPackagePath = "github.com/aead/siphash";
    fetch = {
      type = "git";
      url = "https://github.com/aead/siphash";
      rev = "v1.0.1";
      sha256 = "01kd1z82sc4nh3nj9c25aryyp396s7jrqc2kz9d7qq1vy2hdbznc";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/btcsuite/btcd";
    fetch = {
      type = "git";
      url = "https://github.com/btcsuite/btcd";
      rev = "v0.20.1-beta";
      sha256 = "1xxk8k8pqzy1is7afh0q9lfsrdb4yqzg3x6zvclh1nsv894mjw5f";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/btcsuite/btclog";
    fetch = {
      type = "git";
      url = "https://github.com/btcsuite/btclog";
      rev = "84c8d2346e9f";
      sha256 = "02dl46wcnfpg9sqvg0ipipkpnd7lrf4fnvb9zy56jqa7mfcwc7wk";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/btcsuite/btcutil";
    fetch = {
      type = "git";
      url = "https://github.com/btcsuite/btcutil";
      rev = "v1.0.2";
      sha256 = "0wwykb4cbq8xj2mls2mxma5vaahdgdy3vqw1r2fi4wyj0yr4kyw9";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/btcsuite/go-socks";
    fetch = {
      type = "git";
      url = "https://github.com/btcsuite/go-socks";
      rev = "4720035b7bfd";
      sha256 = "18cv2icj059lq4s99p6yh91hlas5f2gi3f1p4c10sjgwrs933d7b";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/btcsuite/goleveldb";
    fetch = {
      type = "git";
      url = "https://github.com/btcsuite/goleveldb";
      rev = "7834afc9e8cd";
      sha256 = "0gy156sn2cy2maii3p058f7q60gjdbmba34i9qvk8msxlg7hlfjv";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/btcsuite/snappy-go";
    fetch = {
      type = "git";
      url = "https://github.com/btcsuite/snappy-go";
      rev = "0bdef8d06723";
      sha256 = "00i5fsb1wf2dwal1jfwbpk9a7cbzjyg7rnz2xib3qfz9h82kd4jw";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/btcsuite/websocket";
    fetch = {
      type = "git";
      url = "https://github.com/btcsuite/websocket";
      rev = "31079b680792";
      sha256 = "0xpkf257ml6fpfdgv7hxxc41n0d5yxxm3njm50qpzp7j71l9cjwa";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/btcsuite/winsvc";
    fetch = {
      type = "git";
      url = "https://github.com/btcsuite/winsvc";
      rev = "v1.0.0";
      sha256 = "0nsw8y86a5hzr2a3j6ch9myrpccj5bnsgaxpgajhzfk5d31xlw1z";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/davecgh/go-spew";
    fetch = {
      type = "git";
      url = "https://github.com/davecgh/go-spew";
      rev = "v1.1.1";
      sha256 = "0hka6hmyvp701adzag2g26cxdj47g21x6jz4sc6jjz1mn59d474y";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/fsnotify/fsnotify";
    fetch = {
      type = "git";
      url = "https://github.com/fsnotify/fsnotify";
      rev = "v1.4.7";
      sha256 = "07va9crci0ijlivbb7q57d2rz9h27zgn2fsm60spjsqpdbvyrx4g";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/golang/protobuf";
    fetch = {
      type = "git";
      url = "https://github.com/golang/protobuf";
      rev = "v1.2.0";
      sha256 = "0kf4b59rcbb1cchfny2dm9jyznp8ri2hsb14n8iak1q8986xa0ab";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/gorilla/mux";
    fetch = {
      type = "git";
      url = "https://github.com/gorilla/mux";
      rev = "v1.8.0";
      sha256 = "18f0q9qxgq1yh4ji07mqhiydfcwvi56z9d775v7dc7yckj33kpdk";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/gorilla/websocket";
    fetch = {
      type = "git";
      url = "https://github.com/gorilla/websocket";
      rev = "v1.4.2";
      sha256 = "0mkm9w6kjkrlzab5wh8p4qxkc0icqawjbvr01d2nk6ykylrln40s";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/hpcloud/tail";
    fetch = {
      type = "git";
      url = "https://github.com/hpcloud/tail";
      rev = "v1.0.0";
      sha256 = "1njpzc0pi1acg5zx9y6vj9xi6ksbsc5d387rd6904hy6rh2m6kn0";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/jessevdk/go-flags";
    fetch = {
      type = "git";
      url = "https://github.com/jessevdk/go-flags";
      rev = "1679536dcc89";
      sha256 = "15jgsymwg0wjslxrw391sw7qzwwjcnjxiiksq84z7ng9sqy96c1c";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/jrick/logrotate";
    fetch = {
      type = "git";
      url = "https://github.com/jrick/logrotate";
      rev = "v1.0.0";
      sha256 = "0srl6figwjqpi3nbp7br8sxpmvh4v8lzbny1b4lar4ny0156p5nl";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/kkdai/bstream";
    fetch = {
      type = "git";
      url = "https://github.com/kkdai/bstream";
      rev = "f391b8402d23";
      sha256 = "1hd9caz0yf3r8kciw2pqwrsr8z4w0rhbqv1z7iq08d0542s05j3z";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/kyoh86/xdg";
    fetch = {
      type = "git";
      url = "https://github.com/kyoh86/xdg";
      rev = "v1.2.0";
      sha256 = "0a5nz53fdz1c2qvwlf2dpjdd72nxri95i6q4b07c37kiipgaxncn";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/lib/pq";
    fetch = {
      type = "git";
      url = "https://github.com/lib/pq";
      rev = "v1.9.0";
      sha256 = "09r1m5vw78b59v54gfzjwjvwfzzhbcjbakqkhraklkflspgarccz";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/mattn/go-sqlite3";
    fetch = {
      type = "git";
      url = "https://github.com/mattn/go-sqlite3";
      rev = "v1.14.6";
      sha256 = "04anvqkc37mmc3z1dy4xfa6cas67zlxnnab0ywii7sylk864mhxz";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/onsi/ginkgo";
    fetch = {
      type = "git";
      url = "https://github.com/onsi/ginkgo";
      rev = "v1.7.0";
      sha256 = "14wgpdrvpc35rdz3859bz53sc1g4vpr1fysy15wy3ff9gmqs14yg";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/onsi/gomega";
    fetch = {
      type = "git";
      url = "https://github.com/onsi/gomega";
      rev = "v1.4.3";
      sha256 = "1c8rqg5i2hz3snmq7s41yar1zjnzilb0fyiyhkg83v97afcfx79v";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/pmezard/go-difflib";
    fetch = {
      type = "git";
      url = "https://github.com/pmezard/go-difflib";
      rev = "v1.0.0";
      sha256 = "0c1cn55m4rypmscgf0rrb88pn58j3ysvc2d0432dp3c6fqg6cnzw";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/russross/blackfriday/v2";
    fetch = {
      type = "git";
      url = "https://github.com/russross/blackfriday";
      rev = "v2.1.0";
      sha256 = "0d1rg1drrfmabilqjjayklsz5d0n3hkf979sr3wsrw92bfbkivs7";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/sethvargo/go-retry";
    fetch = {
      type = "git";
      url = "https://github.com/sethvargo/go-retry";
      rev = "v0.1.0";
      sha256 = "1fdnw8zhz76c10s3v9lzvm3bczxnlvqmcf5b45m2j0cffd9s094c";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/siddontang/go";
    fetch = {
      type = "git";
      url = "https://github.com/siddontang/go";
      rev = "bdc77568d726";
      sha256 = "0qx28xwqby3pl2r62y700x7j7aplmfm4hrq0y49p4ar8927mpxl6";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/sirupsen/logrus";
    fetch = {
      type = "git";
      url = "https://github.com/sirupsen/logrus";
      rev = "v1.8.1";
      sha256 = "0rvqzic2zz7fpxyizmqxwmhv1m52ii9bgxnqa6km8wsa0l08wh42";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/stretchr/objx";
    fetch = {
      type = "git";
      url = "https://github.com/stretchr/objx";
      rev = "v0.1.0";
      sha256 = "19ynspzjdynbi85xw06mh8ad5j0qa1vryvxjgvbnyrr8rbm4vd8w";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/stretchr/testify";
    fetch = {
      type = "git";
      url = "https://github.com/stretchr/testify";
      rev = "v1.6.1";
      sha256 = "1yhiqqzjvi63pf01rgzx68gqkkvjx03fvl5wk30br5l6s81s090l";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/tidwall/gjson";
    fetch = {
      type = "git";
      url = "https://github.com/tidwall/gjson";
      rev = "v1.6.8";
      sha256 = "06cf34x7kdp6ngpsf0rp9xy36v7pchb5v98xfrp50ccmgniqg715";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/tidwall/match";
    fetch = {
      type = "git";
      url = "https://github.com/tidwall/match";
      rev = "v1.0.3";
      sha256 = "1haa5p7hsjqx0ijxbypgc9c31v128mykm1g0lyymvkk3qdajvcyr";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/tidwall/pretty";
    fetch = {
      type = "git";
      url = "https://github.com/tidwall/pretty";
      rev = "v1.0.2";
      sha256 = "0bfp2nqwd7w3709lsyw2iw71hgbrnhcs1nr9n4vbari408qk2rv0";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "github.com/tidwall/sjson";
    fetch = {
      type = "git";
      url = "https://github.com/tidwall/sjson";
      rev = "v1.1.5";
      sha256 = "0b0hh3890wyaafk5b3f1hs95c46f1wdh2j8vzkngzlzkqhl53ccq";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "golang.org/x/crypto";
    fetch = {
      type = "git";
      url = "https://go.googlesource.com/crypto";
      rev = "5ea612d1eb83";
      sha256 = "0mbhp35qad92a9fpcpc783jfrhhbgv9zsl0h98k10522blqhd9v5";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "golang.org/x/net";
    fetch = {
      type = "git";
      url = "https://go.googlesource.com/net";
      rev = "5f55cee0dc0d";
      sha256 = "1mdsn4n2l97k3g45fgjr54mvr66zjgbpcgc5m2f0w8yimpp1dck0";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "golang.org/x/sync";
    fetch = {
      type = "git";
      url = "https://go.googlesource.com/sync";
      rev = "1d60e4601c6f";
      sha256 = "046jlanz2lkxq1r57x9bl6s4cvfqaic6p2xybsj8mq1120jv4rs6";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "golang.org/x/sys";
    fetch = {
      type = "git";
      url = "https://go.googlesource.com/sys";
      rev = "f84b799fce68";
      sha256 = "1dvhqian5byzkcg1bnqzygqa6ccc6krc2q7j12pp1vhl3y7znnsg";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "golang.org/x/term";
    fetch = {
      type = "git";
      url = "https://go.googlesource.com/term";
      rev = "7de9c90e9dd1";
      sha256 = "1ba252xmv6qsvf1w1gcy98mngrj0vd4inbjw0lsklqvva65nljna";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "golang.org/x/text";
    fetch = {
      type = "git";
      url = "https://go.googlesource.com/text";
      rev = "v0.3.3";
      sha256 = "19pihqm3phyndmiw6i42pdv6z1rbvlqlsnhsyqf9gsnn0qnmqqlh";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "golang.org/x/tools";
    fetch = {
      type = "git";
      url = "https://go.googlesource.com/tools";
      rev = "90fa682c2a6e";
      sha256 = "03ic2xsy51jw9749wl7gszdbz99iijbd2bckgygl6cm9w5m364ak";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "gopkg.in/check.v1";
    fetch = {
      type = "git";
      url = "https://gopkg.in/check.v1";
      rev = "20d25e280405";
      sha256 = "0k1m83ji9l1a7ng8a7v40psbymxasmssbrrhpdv2wl4rhs0nc3np";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "gopkg.in/fsnotify.v1";
    fetch = {
      type = "git";
      url = "https://gopkg.in/fsnotify.v1";
      rev = "v1.4.7";
      sha256 = "07va9crci0ijlivbb7q57d2rz9h27zgn2fsm60spjsqpdbvyrx4g";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "gopkg.in/tomb.v1";
    fetch = {
      type = "git";
      url = "https://gopkg.in/tomb.v1";
      rev = "dd632973f1e7";
      sha256 = "1lqmq1ag7s4b3gc3ddvr792c5xb5k6sfn0cchr3i2s7f1c231zjv";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "gopkg.in/yaml.v2";
    fetch = {
      type = "git";
      url = "https://gopkg.in/yaml.v2";
      rev = "v2.3.0";
      sha256 = "1md0hlyd9s6myv3663i9l59y74n4xjazifmmyxn43g86fgkc5lzj";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "gopkg.in/yaml.v3";
    fetch = {
      type = "git";
      url = "https://gopkg.in/yaml.v3";
      rev = "9f266ea9e77c";
      sha256 = "1bbai3lzb50m0x2vwsdbagrbhvfylj9k1m32hgbqwldqx4p9ay35";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "maunium.net/go/maulogger/v2";
    fetch = {
      type = "git";
      url = "https://github.com/tulir/maulogger.git";
      rev = "v2.2.4";
      sha256 = "0r8czld6bxn94ma36ybfpg26y90j2mvgq7wk3r5gy0nmwrp1sxki";
      moduleDir = "";
    };
  }
  {
    goPackagePath = "maunium.net/go/mautrix";
    fetch = {
      type = "git";
      url = "https://github.com/tulir/mautrix-go.git";
      rev = "v0.9.14";
      sha256 = "0jdhwqflx4nz2jy4n4m3bav3vs6cj4s06z9jf93c8159y3g4qjz6";
      moduleDir = "";
    };
  }
]

A secrets/standupbot-password => secrets/standupbot-password +0 -0