@cryptotaxi247 / infra / commits / bb79b3f0

Fetch and push rfc39 records for the team sync

Graham Christensen committed Dec 28, 2020 at 19:36 UTC bb79b3f085c759b07500da3c0208aefbf45f4c66
1 file changed +35 -8
modules/rfc39.nix
+35 -8
@@ -13,6 +13,10 @@ in {
13 user = "rfc39";
14 };
15
16 + deployment.keys."rfc39-record-push.key" = {
17 + keyFile = /home/deploy/src/nixos-org-configurations/keys/rfc39-record-push.key;
18 + user = "rfc39";
19 + };
20
21 users.extraUsers.rfc39 = {
22 description = "RFC39 Maintainer Team Sync";
@@ -20,10 +24,11 @@ in {
24 createHome = true;
25 };
26
27 + programs.ssh.knownHosts."github.com".publicKey = "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==";
28 +
29 systemd.services.rfc39-sync = {
24 - enable = false;
30 description = "Sync the Maintainer Team ";
26 - path = [ config.nix.package pkgs.git rfc39 ];
31 + path = [ config.nix.package pkgs.git pkgs.openssh rfc39 ];
32 startAt = "*:0/30";
33 serviceConfig.User = "rfc39";
34 serviceConfig.Group = "keys";
@@ -33,20 +38,42 @@ in {
38 ''
39 set -eux
40
36 - dir=$HOME/nixpkgs
37 - if ! [[ -e $dir ]]; then
38 - git clone https://github.com/NixOS/nixpkgs.git $dir
41 + export GIT_SSH_COMMAND='ssh -i /run/keys/rfc39-record-push.key'
42 + export GIT_AUTHOR_NAME="rfc39"
43 + export GIT_AUTHOR_EMAIL="rfc39@eris"
44 + export GIT_COMMITTER_NAME="rfc39"
45 + export GIT_COMMITTER_EMAIL="rfc39@eris"
46 +
47 + recordsdir=$HOME/rfc39-record
48 + if ! [[ -e "$recordsdir" ]]; then
49 + git clone git@github.com:NixOS/rfc39-record.git "$recordsdir"
50 fi
40 - cd $dir
51 + cd "$recordsdir"
52 + git remote update origin
53 + git checkout main
54 + git reset --hard origin/main
55 + git gc
56 +
57 + nixpkgsdir=$HOME/nixpkgs
58 + if ! [[ -e $nixpkgsdir ]]; then
59 + git clone https://github.com/NixOS/nixpkgs.git $nixpkgsdir
60 + fi
61 + cd $nixpkgsdir
62 git remote update origin
63 git checkout origin/master
64 git gc
65
45 - exec rfc39 \
66 + rfc39 \
67 --dump-metrics --metrics-delay=240 --metrics-addr=0.0.0.0:9190 \
68 --credentials /run/keys/rfc39-credentials.nix \
69 --maintainers ./maintainers/maintainer-list.nix \
49 - sync-team NixOS 3345117 --limit 10
70 + sync-team NixOS 3345117 --limit 10 \
71 + --invited-list "$recordsdir/invitations"
72 +
73 + cd "$recordsdir"
74 + git add .
75 + git commit -m "Automated team sync results."
76 + git push origin main
77 '';
78 };
79