@cryptotaxi247 / infra-1 / commits / ef48be95

rfc39: init module

Graham Christensen committed Dec 24, 2019 at 04:26 UTC ef48be95f5d30880f41f481c62148ac302d3604a
2 files changed +71 -1
delft/eris.nix
+19 -1
@@ -5,6 +5,7 @@ let
5 macs = filterAttrs (_: v: (v.macosGuest or {}).enable or false) resources.machines;
6 in {
7 imports = [
8 + ../modules/rfc39.nix
9 ../modules/prometheus
10 ./eris/packet-spot-market-prices.nix
11 ./eris/github-project-monitor.nix
@@ -133,6 +134,13 @@ in {
134 {
135 name = "scheduled-jobs";
136 rules = [
137 + {
138 + alert = "RFC39MaintainerSync";
139 + expr = ''node_systemd_unit_state{name=~"^rfc39-sync.service$", state="failed"} == 1'';
140 + for = "30m";
141 + labels.severity = "page";
142 + annotations.summary = "https://status.nixos.org/grafana/d/fBW4tL1Wz/scheduled-task-state-channels-website?orgId=1&refresh=10s";
143 + }
144 {
145 alert = "ChannelUpdateStuck";
146 expr = ''node_systemd_unit_state{name=~"^update-nix.*.service$", state="failed"} == 1'';
@@ -269,7 +277,17 @@ in {
277 }
278 ];
279 }
272 -
280 + {
281 + job_name = "rfc39";
282 + metrics_path = "/";
283 + static_configs = [
284 + {
285 + targets = [
286 + "127.0.0.1:9190"
287 + ];
288 + }
289 + ];
290 + }
291 {
292 job_name = "hydra-reexport";
293 metrics_path = "/";
modules/rfc39.nix new
+52
@@ -0,0 +1,52 @@
1 +# This module fetches nixpkgs master and syncs the GitHub maintainer team.
2 +{ config, pkgs, ... }:
3 +let
4 + rfc39 = import /home/deploy/src/rfc39 { inherit pkgs; };
5 +in {
6 + deployment.keys."rfc39-credentials.nix" = {
7 + keyFile = /home/deploy/src/nixos-org-configurations/keys/rfc39-credentials.nix;
8 + user = "rfc39";
9 + };
10 +
11 + deployment.keys."rfc39-github.der" = {
12 + keyFile = /home/deploy/src/nixos-org-configurations/keys/rfc39-github.der;
13 + user = "rfc39";
14 + };
15 +
16 +
17 + users.extraUsers.rfc39 = {
18 + description = "RFC39 Maintainer Team Sync";
19 + home = "/var/lib/rfc39-sync";
20 + createHome = true;
21 + };
22 +
23 + systemd.services.rfc39-sync = {
24 + description = "Sync the Maintainer Team ";
25 + path = [ config.nix.package pkgs.git rfc39 ];
26 + startAt = "*:0/30";
27 + serviceConfig.User = "rfc39";
28 + serviceConfig.Group = "keys";
29 + serviceConfig.Type = "oneshot";
30 + serviceConfig.PrivateTmp = true;
31 + script =
32 + ''
33 + set -eux
34 +
35 + dir=$HOME/nixpkgs
36 + if ! [[ -e $dir ]]; then
37 + git clone https://github.com/NixOS/nixpkgs.git $dir
38 + fi
39 + cd $dir
40 + git remote update origin
41 + git checkout origin/master
42 + git gc
43 +
44 + exec rfc39 \
45 + --dump-metrics --metrics-delay=240 --metrics-addr=0.0.0.0:9190 \
46 + --credentials /run/keys/rfc39-credentials.nix \
47 + --maintainers ./maintainers/maintainer-list.nix \
48 + sync-team NixOS 3345117 --limit 10
49 + '';
50 + };
51 +
52 +}