about summary refs log tree commit diff
path: root/modules/server/spectrum/git/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/server/spectrum/git/default.nix')
-rw-r--r--modules/server/spectrum/git/default.nix110
1 files changed, 110 insertions, 0 deletions
diff --git a/modules/server/spectrum/git/default.nix b/modules/server/spectrum/git/default.nix
new file mode 100644
index 000000000000..beb61b78dd89
--- /dev/null
+++ b/modules/server/spectrum/git/default.nix
@@ -0,0 +1,110 @@
+{ pkgs, ... }:
+
+{
+  imports = [ ../../git ];
+
+  declarative-git.repositories."/home/spectrum/git/crosvm.git" = {
+    branch = "master";
+    description = "Downstream crosvm tree for Spectrum";
+    group = "spectrum";
+    config.cgit.section = "obsolete";
+  };
+
+  declarative-git.repositories."/home/spectrum/git/doc.git" = {
+    branch = "master";
+    description = "Old manuals for Spectrum";
+    hooks.post-update = [
+      (pkgs.writeShellScript "post-update.sh" ''
+        nix-build --tarball-ttl 0 --out-link built --cores 1 -j1 -E "
+          let src = builtins.fetchGit ./.;
+          in (import src).overrideAttrs ({ ... }: { inherit src; })
+        "
+      '')
+    ];
+    group = "spectrum";
+    config.cgit.section = "obsolete";
+  };
+
+  declarative-git.repositories."/home/spectrum/git/nixpkgs.git" = {
+    branch = "rootfs";
+    description = "Downstream nixpkgs tree for Spectrum";
+    group = "spectrum";
+    config.cgit.defBranch = "rootfs";
+    config.cgit.section = "obsolete";
+    config.core.sharedrepository = "0644";
+  };
+
+  declarative-git.repositories."/home/spectrum/git/mktuntap.git" = {
+    branch = "master";
+    description = "Utility program for creating TUN and TAP devices on file descriptors";
+    group = "spectrum";
+    config.cgit.readme = ":README";
+    config.core.sharedrepository = "0644";
+    config.receive.denyNonFastforwards = true;
+  };
+
+  declarative-git.repositories."/home/spectrum/git/spectrum.git" = {
+    description = "A compartmentalized operating system";
+    group = "spectrum";
+    config.cgit.defBranch = "main";
+    hooks.post-receive = with pkgs; [
+      (writeShellScript "send-email.sh" ''
+        set -ueo pipefail
+        export PATH=${lib.makeBinPath [ coreutils curl gitMinimal gnused mailutils ]}
+
+        repo_url=https://spectrum-os.org/git/spectrum
+        inbox_url=https://spectrum-os.org/lists/archives/spectrum-devel
+
+        while read oldrev newrev refname; do
+            [ "$refname" = "refs/heads/main" ] || continue
+
+            git log --reverse --format=%H "$oldrev..$newrev" | while read commit; do
+                message_id="$(git log -1 --format=%B "$commit" |
+                    git interpret-trailers --parse |
+                    sed -n 's/^Message-Id: <\(.*\)>$/\1/Ip' | head -n 1)"
+
+                [ -n "$message_id" ] || continue
+
+                url="$inbox_url/$message_id/raw"
+                path="$(mktemp)"
+                curl -LSfso "$path" "$url"
+                mail -E "file $path" -E "reply" -E "quit" <<EOF
+        This patch has been committed as $commit,
+        which can be viewed online at
+        $repo_url/commit/?id=$commit.
+
+        This is an automated message.  Send comments/questions/requests to:
+        Alyssa Ross <hi@alyssa.is>
+        EOF
+                rm "$path"
+            done
+        done
+      '')
+      (writeShellScript "build-documentation.sh" ''
+        nix-build --tarball-ttl 0 --out-link /home/spectrum/Documentation -E '
+          import "''${builtins.fetchGit { url = ./.; ref = "main"; }}/Documentation" {}
+        '
+      '')
+    ];
+  };
+
+  declarative-git.repositories."/home/spectrum/git/ucspi-vsock.git" = {
+    branch = "master";
+    description = "UCSPI-1996 implementation for Linux AF_VSOCK sockets";
+    group = "spectrum";
+    config.cgit.section = "obsolete";
+  };
+
+  declarative-git.repositories."/home/spectrum/git/www.git" = {
+    branch = "master";
+    description = "Static source files for the Spectrum website";
+    group = "spectrum";
+    config.cgit.readme = ":README";
+    config.core.bare = false;
+    config.core.logallrefupdates = true;
+    config.core.sharedrepository = 1;
+    config.core.worktree = "../../www";
+    config.receive.denyCurrentBranch = "updateInstead";
+    config.receive.denyNonFastforwards = true;
+  };
+}