sourcehut: type-check migrate-on-upgrade
authorJulien Moutinho <julm@sourcephile.fr>
Sat, 17 Jul 2021 22:13:42 +0000 (00:13 +0200)
committerJulien Moutinho <julm@sourcephile.fr>
Wed, 21 Jul 2021 23:59:11 +0000 (01:59 +0200)
nixos/modules/services/misc/sourcehut/builds.nix
nixos/modules/services/misc/sourcehut/default.nix
nixos/modules/services/misc/sourcehut/dispatch.nix
nixos/modules/services/misc/sourcehut/git.nix
nixos/modules/services/misc/sourcehut/hub.nix
nixos/modules/services/misc/sourcehut/lists.nix
nixos/modules/services/misc/sourcehut/man.nix
nixos/modules/services/misc/sourcehut/meta.nix
nixos/modules/services/misc/sourcehut/paste.nix
nixos/modules/services/misc/sourcehut/service.nix
nixos/modules/services/misc/sourcehut/todo.nix

index bdf40f4e384d69b97d4f57e3e20b612e61b3f632..df688c7fce75b20f5302f1cfaed45cc97f3af936 100644 (file)
@@ -196,8 +196,6 @@ in
       "builds.sr.ht".debug-port = mkDefault port;
       # Configures the SQLAlchemy connection string for the database.
       "builds.sr.ht".connection-string = mkDefault "postgresql:///${database}?user=${user}&host=/var/run/postgresql";
-      # Set to "yes" to automatically run migrations on package upgrade.
-      "builds.sr.ht".migrate-on-upgrade = mkDefault "yes";
       # builds.sr.ht's OAuth client ID and secret for meta.sr.ht
       # Register your client at meta.example.org/oauth
       "builds.sr.ht".oauth-client-id = mkDefault null;
index 00b031aae73cc86bf0eae991f709a342dd6d67ba..f729c7d114a18dc5c9b8073f6b7f2219ca38bc40 100644 (file)
@@ -105,6 +105,36 @@ in
     settings = mkOption {
       type = lib.types.submodule {
         freeformType = settingsFormat.type;
+        options."builds.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
+        options."dispatch.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
+        options."git.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
+        options."hg.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
+        options."hub.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
+        options."lists.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
+        options."man.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
+        options."meta.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
+        options."paste.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
+        options."todo.sr.ht" = {
+          migrate-on-upgrade = mkEnableOption "automatically run migrations on package upgrade";
+        };
       };
       default = { };
       description = ''
index a9db17bebe8e5d1da80b9a081a36527168c42eae..098c6d12da700991957d045d6ca6ad81befabca7 100644 (file)
@@ -97,8 +97,6 @@ in
       "dispatch.sr.ht".debug-port = mkDefault port;
       # Configures the SQLAlchemy connection string for the database.
       "dispatch.sr.ht".connection-string = mkDefault "postgresql:///${database}?user=${user}&host=/var/run/postgresql";
-      # Set to "yes" to automatically run migrations on package upgrade.
-      "dispatch.sr.ht".migrate-on-upgrade = mkDefault "yes";
       # dispatch.sr.ht's OAuth client ID and secret for meta.sr.ht
       # Register your client at meta.example.org/oauth
       "dispatch.sr.ht".oauth-client-id = mkDefault null;
index f545ada5ae80b683ad028a37d25ed4ba14aa5c58..9d0b02bbc83825343a763ca3dd6236386dfeaed2 100644 (file)
@@ -157,8 +157,6 @@ in
       "git.sr.ht".debug-port = mkDefault port;
       # Configures the SQLAlchemy connection string for the database.
       "git.sr.ht".connection-string = mkDefault "postgresql:///${database}?user=${user}&host=/var/run/postgresql";
-      # Set to "yes" to automatically run migrations on package upgrade.
-      "git.sr.ht".migrate-on-upgrade = mkDefault "yes";
       # The redis connection used for the webhooks worker
       "git.sr.ht".webhooks = mkDefault "redis://${rcfg.bind}:${toString rcfg.port}/1";
 
index be3ea21011c7de22a78ad4e3c807b721c8bfa73b..3c4ebca331664a1d540b060ef048bd7405f10599 100644 (file)
@@ -96,8 +96,6 @@ in
       "hub.sr.ht".debug-port = mkDefault port;
       # Configures the SQLAlchemy connection string for the database.
       "hub.sr.ht".connection-string = mkDefault "postgresql:///${database}?user=${user}&host=/var/run/postgresql";
-      # Set to "yes" to automatically run migrations on package upgrade.
-      "hub.sr.ht".migrate-on-upgrade = mkDefault "yes";
       # hub.sr.ht's OAuth client ID and secret for meta.sr.ht
       # Register your client at meta.example.org/oauth
       "hub.sr.ht".oauth-client-id = mkDefault null;
index cc151c95ee6d7cad8f7e14c26ed87e10f7f9271f..502196bced5c0154e67891bdb281c759828c456b 100644 (file)
@@ -145,8 +145,6 @@ in
       "lists.sr.ht".debug-port = mkDefault port;
       # Configures the SQLAlchemy connection string for the database.
       "lists.sr.ht".connection-string = mkDefault "postgresql:///${database}?user=${user}&host=/var/run/postgresql";
-      # Set to "yes" to automatically run migrations on package upgrade.
-      "lists.sr.ht".migrate-on-upgrade = mkDefault "yes";
       # lists.sr.ht's OAuth client ID and secret for meta.sr.ht
       # Register your client at meta.example.org/oauth
       "lists.sr.ht".oauth-client-id = mkDefault null;
index 7693396d187c37efc93af2585fe53d62d01c076d..088eb47d7c0b3445f128b7ef6f26988ba1f7c6cd 100644 (file)
@@ -104,8 +104,6 @@ in
       "man.sr.ht".debug-port = mkDefault port;
       # Configures the SQLAlchemy connection string for the database.
       "man.sr.ht".connection-string = mkDefault "postgresql:///${database}?user=${user}&host=/var/run/postgresql";
-      # Set to "yes" to automatically run migrations on package upgrade.
-      "man.sr.ht".migrate-on-upgrade = mkDefault "yes";
       # man.sr.ht's OAuth client ID and secret for meta.sr.ht
       # Register your client at meta.example.org/oauth
       "man.sr.ht".oauth-client-id = mkDefault null;
index 7b57fcf7d09c2b4bd8f0b5b569e0286ed6f0034c..a7f6538829d9cebb500ce557212f2068fc340d19 100644 (file)
@@ -167,8 +167,6 @@ in
       "meta.sr.ht".debug-port = mkDefault port;
       # Configures the SQLAlchemy connection string for the database.
       "meta.sr.ht".connection-string = mkDefault "postgresql:///${database}?user=${user}&host=/var/run/postgresql";
-      # Set to "yes" to automatically run migrations on package upgrade.
-      "meta.sr.ht".migrate-on-upgrade = mkDefault "yes";
       # If "yes", the user will be sent the stock sourcehut welcome emails after
       # signup (requires cron to be configured properly). These are specific to the
       # sr.ht instance so you probably want to patch these before enabling this.
index 28280e677b077b9c6f63fd14f4694607c541f3fb..b8b817b358928659bcc0d49e7a0e7459ba3002d7 100644 (file)
@@ -114,8 +114,6 @@ in
       "paste.sr.ht".debug-port = mkDefault port;
       # Configures the SQLAlchemy connection string for the database.
       "paste.sr.ht".connection-string = mkDefault "postgresql:///${database}?user=${user}&host=/var/run/postgresql";
-      # Set to "yes" to automatically run migrations on package upgrade.
-      "paste.sr.ht".migrate-on-upgrade = mkDefault "yes";
       # paste.sr.ht's OAuth client ID and secret for meta.sr.ht
       # Register your client at meta.example.org/oauth
       "paste.sr.ht".oauth-client-id = mkDefault null;
index 65b4ad020f9a66d5055158d62a5b44ac6a2f5d6a..d1467f31865802f6cb3c59a6848369f0cc6703c6 100644 (file)
@@ -50,7 +50,7 @@ with serviceCfg; with lib; recursiveUpdate
       touch ${statePath}/webhook
     fi
 
-    ${optionalString (builtins.hasAttr "migrate-on-upgrade" cfgIni && cfgIni.migrate-on-upgrade == "yes") ''
+    ${optionalString (builtins.trace iniKey cfgIni).migrate-on-upgrade ''
       if [ "$(cat ${statePath}/db)" != "${serviceDrv.version}" ]; then
         # Manage schema migrations using alembic
         ${cfg.python}/bin/${serviceDrv.pname}-migrate -a upgrade head
index 56f7d8628d8a41ab7b06e3f4c957cf5e6f896f25..55788554203af234176cb3b3ccee45d50c5ca5f6 100644 (file)
@@ -128,8 +128,6 @@ in
       "todo.sr.ht".debug-port = mkDefault port;
       # Configures the SQLAlchemy connection string for the database.
       "todo.sr.ht".connection-string = mkDefault "postgresql:///${database}?user=${user}&host=/var/run/postgresql";
-      # Set to "yes" to automatically run migrations on package upgrade.
-      "todo.sr.ht".migrate-on-upgrade = mkDefault "yes";
       # todo.sr.ht's OAuth client ID and secret for meta.sr.ht
       # Register your client at meta.example.org/oauth
       "todo.sr.ht".oauth-client-id = mkDefault null;