about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLuke Granger-Brown <git@lukegb.com>2021-04-02T12·18+0000
committerlukegb <lukegb@tvl.fyi>2021-04-02T18·00+0000
commitb35e358eb5841b62caa8408ce2dbee105bf8d9c8 (patch)
treeb8d00a42560ee0567bb663c8fd65b5dd7d796e83
parent999f98436cf854d360269368f61a498e506167a4 (diff)
refactor(ops/nixos): migrate to depot module arg r/2407
Previously the depot argument was provided as config.depot, but the "new
way" of doing things (which is more like the args list provided in the
rest of the depot) is to provide this as the "depot" NixOS module
argument instead.

Change-Id: Ib48b1c7c1bdff9c1eb0618c6cbacc22b651f5f98
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2763
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: glittershark <grfn@gws.fyi>
-rw-r--r--ops/nixos/clbot.nix4
-rw-r--r--ops/nixos/irccat.nix4
-rw-r--r--ops/nixos/monorepo-gerrit.nix8
-rw-r--r--ops/nixos/panettone.nix3
-rw-r--r--ops/nixos/paroxysm.nix4
-rw-r--r--ops/nixos/smtprelay.nix4
-rw-r--r--ops/nixos/sourcegraph.nix3
-rw-r--r--ops/nixos/tvl-slapd/default.nix8
-rw-r--r--ops/nixos/tvl-sso/default.nix4
-rw-r--r--ops/nixos/whitby/default.nix2
-rw-r--r--ops/nixos/www/code.tvl.fyi.nix4
-rw-r--r--ops/nixos/www/tazj.in.nix5
-rw-r--r--ops/nixos/www/todo.tvl.fyi.nix4
-rw-r--r--ops/nixos/www/tvl.fyi.nix4
-rw-r--r--ops/nixos/www/wigglydonke.rs.nix4
15 files changed, 30 insertions, 35 deletions
diff --git a/ops/nixos/clbot.nix b/ops/nixos/clbot.nix
index 0c45badd2b3e..ad33e25a4d54 100644
--- a/ops/nixos/clbot.nix
+++ b/ops/nixos/clbot.nix
@@ -1,5 +1,5 @@
 # Module that configures CLBot, our Gerrit->IRC info bridge.
-{ config, lib, pkgs, ... }:
+{ depot, config, lib, pkgs, ... }:
 
 let
   inherit (builtins) attrValues concatStringsSep mapAttrs readFile;
@@ -31,7 +31,7 @@ let
       description = "${description} to ${channel}";
       wantedBy = [ "multi-user.target" ];
 
-      script = "${config.depot.fun.clbot}/bin/clbot ${mkFlags (cfg.flags // {
+      script = "${depot.fun.clbot}/bin/clbot ${mkFlags (cfg.flags // {
         irc_channel = channel;
       })} -alsologtostderr";
 
diff --git a/ops/nixos/irccat.nix b/ops/nixos/irccat.nix
index 68735e4ce54f..e4b30b73553e 100644
--- a/ops/nixos/irccat.nix
+++ b/ops/nixos/irccat.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ depot, config, lib, pkgs, ... }:
 
 let
   cfg = config.services.depot.irccat;
@@ -35,7 +35,7 @@ in {
     systemd.services.irccat = {
       inherit description;
       preStart = "${configMerge}";
-      script = "${config.depot.third_party.irccat}/bin/irccat";
+      script = "${depot.third_party.irccat}/bin/irccat";
       wantedBy = [ "multi-user.target" ];
 
       serviceConfig = {
diff --git a/ops/nixos/monorepo-gerrit.nix b/ops/nixos/monorepo-gerrit.nix
index 327ff633cbb6..e9635879435e 100644
--- a/ops/nixos/monorepo-gerrit.nix
+++ b/ops/nixos/monorepo-gerrit.nix
@@ -1,11 +1,11 @@
 # Gerrit configuration for the TVL monorepo
-{ pkgs, config, lib, ... }:
+{ depot, pkgs, config, lib, ... }:
 
 let
   cfg = config.services.gerrit;
   gerritHooks = pkgs.runCommandNoCC "gerrit-hooks" {} ''
     mkdir -p $out
-    ln -s ${config.depot.ops.besadii}/bin/besadii $out/ref-updated
+    ln -s ${depot.ops.besadii}/bin/besadii $out/ref-updated
   '';
 in {
   services.gerrit = {
@@ -17,12 +17,12 @@ in {
       "hooks"
     ];
 
-    plugins = with config.depot.third_party.gerrit_plugins; [
+    plugins = with depot.third_party.gerrit_plugins; [
       checks
       owners
     ];
 
-    package = config.depot.third_party.gerrit;
+    package = depot.third_party.gerrit;
 
     jvmHeapLimit = "4g";
 
diff --git a/ops/nixos/panettone.nix b/ops/nixos/panettone.nix
index 50826743577d..51a7468578f4 100644
--- a/ops/nixos/panettone.nix
+++ b/ops/nixos/panettone.nix
@@ -1,8 +1,7 @@
-{ config, lib, pkgs, ... }:
+{ depot, config, lib, pkgs, ... }:
 
 let
   cfg = config.services.depot.panettone;
-  depot = config.depot;
 in {
   options.services.depot.panettone = with lib; {
     enable = mkEnableOption "Panettone issue tracker";
diff --git a/ops/nixos/paroxysm.nix b/ops/nixos/paroxysm.nix
index 24c5377a577a..cd9cd3866e47 100644
--- a/ops/nixos/paroxysm.nix
+++ b/ops/nixos/paroxysm.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ depot, config, lib, pkgs, ... }:
 
 let
   cfg = config.services.depot.paroxysm;
@@ -9,7 +9,7 @@ in {
   config = lib.mkIf cfg.enable {
     systemd.services.paroxysm = {
       inherit description;
-      script = "${config.depot.fun.paroxysm}/bin/paroxysm";
+      script = "${depot.fun.paroxysm}/bin/paroxysm";
       wantedBy = [ "multi-user.target" ];
 
       environment = {
diff --git a/ops/nixos/smtprelay.nix b/ops/nixos/smtprelay.nix
index 044902b15a9a..d8e03b5794b0 100644
--- a/ops/nixos/smtprelay.nix
+++ b/ops/nixos/smtprelay.nix
@@ -1,5 +1,5 @@
 # NixOS module for configuring the simple SMTP relay.
-{ pkgs, config, lib, ... }:
+{ depot, pkgs, config, lib, ... }:
 
 let
   inherit (builtins) attrValues mapAttrs;
@@ -40,7 +40,7 @@ in {
   config = mkIf cfg.enable {
     systemd.services.smtprelay = {
       inherit description;
-      script = "${config.depot.third_party.smtprelay}/bin/smtprelay ${prepareArgs cfg.args}";
+      script = "${depot.third_party.smtprelay}/bin/smtprelay ${prepareArgs cfg.args}";
       wantedBy = [ "multi-user.target" ];
 
       serviceConfig = {
diff --git a/ops/nixos/sourcegraph.nix b/ops/nixos/sourcegraph.nix
index f9b2b5e19d33..a24328f3e366 100644
--- a/ops/nixos/sourcegraph.nix
+++ b/ops/nixos/sourcegraph.nix
@@ -1,10 +1,9 @@
 # Run sourcegraph, including its entire machinery, in a container.
 # Running it outside of a container is a futile endeavour for now.
-{ config, pkgs, lib, ... }:
+{ depot, config, pkgs, lib, ... }:
 
 let
   cfg = config.services.depot.sourcegraph;
-  depot = config.depot;
 in {
   options.services.depot.sourcegraph = with lib; {
     enable = mkEnableOption "SourceGraph code search engine";
diff --git a/ops/nixos/tvl-slapd/default.nix b/ops/nixos/tvl-slapd/default.nix
index d32bc96b832d..ae99fced7499 100644
--- a/ops/nixos/tvl-slapd/default.nix
+++ b/ops/nixos/tvl-slapd/default.nix
@@ -1,9 +1,9 @@
 # Configures an OpenLDAP instance for TVL
 #
 # TODO(tazjin): Configure ldaps://
-{ config, lib, pkgs, ... }:
+{ depot, lib, pkgs, ... }:
 
-with config.depot.nix.yants;
+with depot.nix.yants;
 
 let
   user = struct {
@@ -24,7 +24,7 @@ let
     userPassword: ${u.password}
   '');
 
-  inherit (config.depot.ops) users;
+  inherit (depot.ops) users;
 
 in {
   # Use our patched OpenLDAP derivation which enables stronger password hashing.
@@ -34,7 +34,7 @@ in {
   # *large* number of rebuilds of packages such as GPG and Python.
   nixpkgs.overlays = [
     (_: _: {
-      inherit (config.depot.third_party) openldap;
+      inherit (depot.third_party) openldap;
     })
   ];
 
diff --git a/ops/nixos/tvl-sso/default.nix b/ops/nixos/tvl-sso/default.nix
index 8590918e575a..8e33c708b7f3 100644
--- a/ops/nixos/tvl-sso/default.nix
+++ b/ops/nixos/tvl-sso/default.nix
@@ -1,8 +1,8 @@
 # Configures an Apereo CAS instance for TVL SSO
-{ config, ... }:
+{ depot, ... }:
 
 let
-  inherit (config.depot.third_party) apereo-cas;
+  inherit (depot.third_party) apereo-cas;
 in {
   config = {
     environment.systemPackages = [ apereo-cas ];
diff --git a/ops/nixos/whitby/default.nix b/ops/nixos/whitby/default.nix
index 577a4e23bf41..dd8807cf7222 100644
--- a/ops/nixos/whitby/default.nix
+++ b/ops/nixos/whitby/default.nix
@@ -13,10 +13,8 @@ let
     ln -s ${depot.ops.besadii}/bin/besadii $out/bin/post-command
   '';
 in lib.fix(self: {
-  inherit depot;
   imports = [
     "${depot.depotPath}/ops/nixos/clbot.nix"
-    "${depot.depotPath}/ops/nixos/depot.nix"
     "${depot.depotPath}/ops/nixos/irccat.nix"
     "${depot.depotPath}/ops/nixos/monorepo-gerrit.nix"
     "${depot.depotPath}/ops/nixos/panettone.nix"
diff --git a/ops/nixos/www/code.tvl.fyi.nix b/ops/nixos/www/code.tvl.fyi.nix
index 18962be6bb59..c8a4b27b1b52 100644
--- a/ops/nixos/www/code.tvl.fyi.nix
+++ b/ops/nixos/www/code.tvl.fyi.nix
@@ -1,4 +1,4 @@
-{ config, ... }:
+{ depot, ... }:
 
 {
   imports = [
@@ -17,7 +17,7 @@
         #
         # TODO(tazjin): Implement a way of serving this dynamically
         location = /about/tvix/docs/component-flow.svg {
-            alias ${config.depot.tvix.docs.svg}/component-flow.svg;
+            alias ${depot.tvix.docs.svg}/component-flow.svg;
         }
 
         # Static assets must always hit the root.
diff --git a/ops/nixos/www/tazj.in.nix b/ops/nixos/www/tazj.in.nix
index c33c9560deac..8ed3585cdb52 100644
--- a/ops/nixos/www/tazj.in.nix
+++ b/ops/nixos/www/tazj.in.nix
@@ -1,8 +1,7 @@
 # serve tazjin's website & blog
-{ config, lib, pkgs, ... }:
+{ depot, config, lib, pkgs, ... }:
 
-let depot = config.depot;
-in {
+{
   imports = [
     ./base.nix
   ];
diff --git a/ops/nixos/www/todo.tvl.fyi.nix b/ops/nixos/www/todo.tvl.fyi.nix
index 5e1f158e6bba..b53f5437e7ab 100644
--- a/ops/nixos/www/todo.tvl.fyi.nix
+++ b/ops/nixos/www/todo.tvl.fyi.nix
@@ -1,4 +1,4 @@
-{ config, ... }:
+{ depot, ... }:
 
 {
   imports = [
@@ -9,7 +9,7 @@
     services.nginx.virtualHosts."todo.tvl.fyi" = {
       serverName = "todo.tvl.fyi";
       serverAliases = [ "todo.tvl.su" ];
-      root = config.depot.web.todolist;
+      root = depot.web.todolist;
       enableACME = true;
       forceSSL = true;
 
diff --git a/ops/nixos/www/tvl.fyi.nix b/ops/nixos/www/tvl.fyi.nix
index 9c2bf0274f23..45fd35803de7 100644
--- a/ops/nixos/www/tvl.fyi.nix
+++ b/ops/nixos/www/tvl.fyi.nix
@@ -1,4 +1,4 @@
-{ config, ... }:
+{ depot, ... }:
 
 {
   imports = [
@@ -8,7 +8,7 @@
   config = {
     services.nginx.virtualHosts."tvl.fyi" = {
       serverName = "tvl.fyi";
-      root = config.depot.web.tvl;
+      root = depot.web.tvl;
       enableACME = true;
       forceSSL = true;
 
diff --git a/ops/nixos/www/wigglydonke.rs.nix b/ops/nixos/www/wigglydonke.rs.nix
index 0774eaea7c70..0bc67898c633 100644
--- a/ops/nixos/www/wigglydonke.rs.nix
+++ b/ops/nixos/www/wigglydonke.rs.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ depot, lib, pkgs, ... }:
 
 {
   imports = [
@@ -9,7 +9,7 @@
     services.nginx.virtualHosts."wigglydonke.rs" = {
       enableACME = true;
       forceSSL = true;
-      root = "${config.depot.depotPath}/users/glittershark/wigglydonke.rs";
+      root = "${depot.depotPath}/users/glittershark/wigglydonke.rs";
     };
   };
 }