From 7b83b7e2851337ca0bcdea7cb15f7eeb87561528 Mon Sep 17 00:00:00 2001
From: zowoq <59103226+zowoq@users.noreply.github.com>
Date: Sat, 16 Mar 2024 11:52:48 +1000
Subject: [PATCH] modules/nixos: add comin

---
 flake.lock                       | 21 +++++++++++++++++++++
 flake.nix                        |  3 +++
 modules/nixos/common/comin.nix   | 19 +++++++++++++++++++
 modules/nixos/common/default.nix |  1 +
 4 files changed, 44 insertions(+)
 create mode 100644 modules/nixos/common/comin.nix

diff --git a/flake.lock b/flake.lock
index d8fb967..f689681 100644
--- a/flake.lock
+++ b/flake.lock
@@ -26,6 +26,26 @@
         "type": "github"
       }
     },
+    "comin": {
+      "inputs": {
+        "nixpkgs": [
+          "nixpkgs"
+        ]
+      },
+      "locked": {
+        "lastModified": 1710799524,
+        "narHash": "sha256-5ZMHWRYsj3ybp2J+tsSpiMIcotI7CHngAx6NdLfSPl8=",
+        "owner": "nlewo",
+        "repo": "comin",
+        "rev": "b4f7dcc7c0f1a6ad6470c762f1ddccfb7ee887e4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nlewo",
+        "repo": "comin",
+        "type": "github"
+      }
+    },
     "disko": {
       "inputs": {
         "nixpkgs": [
@@ -195,6 +215,7 @@
     "root": {
       "inputs": {
         "buildbot-nix": "buildbot-nix",
+        "comin": "comin",
         "disko": "disko",
         "flake-parts": "flake-parts",
         "nix-darwin": "nix-darwin",
diff --git a/flake.nix b/flake.nix
index 48686ec..46882d1 100644
--- a/flake.nix
+++ b/flake.nix
@@ -35,6 +35,9 @@
     nur-update.url = "github:nix-community/nur-update";
     nur-update.inputs.nixpkgs.follows = "nixpkgs";
 
+    comin.url = "github:nlewo/comin";
+    comin.inputs.nixpkgs.follows = "nixpkgs";
+
     disko.url = "github:nix-community/disko";
     disko.inputs.nixpkgs.follows = "nixpkgs";
 
diff --git a/modules/nixos/common/comin.nix b/modules/nixos/common/comin.nix
new file mode 100644
index 0000000..e567528
--- /dev/null
+++ b/modules/nixos/common/comin.nix
@@ -0,0 +1,19 @@
+{ inputs, lib, ... }:
+{
+  imports = [
+    inputs.comin.nixosModules.comin
+  ];
+
+  services.comin = {
+    enable = lib.mkDefault false;
+    remotes = [
+      {
+        url = "https://github.com/nix-community/infra.git";
+        name = "origin";
+        poller.period = 300; # every 5 minutes
+        branches.main.name = "master";
+        branches.testing.name = ""; # disable testing branch
+      }
+    ];
+  };
+}
diff --git a/modules/nixos/common/default.nix b/modules/nixos/common/default.nix
index 453e3c4..ad5ac96 100644
--- a/modules/nixos/common/default.nix
+++ b/modules/nixos/common/default.nix
@@ -2,6 +2,7 @@
 {
   imports = [
     ./auto-upgrade.nix
+    ./comin.nix
     ../../shared/known-hosts.nix
     ../../shared/nix-daemon.nix
     ./reboot.nix