summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorElis Hirwing <elis@hirwing.se>2019-04-25 08:30:14 +0200
committerElis Hirwing <elis@hirwing.se>2019-04-25 08:30:14 +0200
commit71450b1c1a2ee2d32fa642316061df6cc53a8d49 (patch)
tree72f4d429eab9c579bebbf50d423032a4f0fdc8d6 /nixos
parent1011fae581e1139ea4c9f3e479d604eb5669c5d9 (diff)
downloadnixpkgs-71450b1c1a2ee2d32fa642316061df6cc53a8d49.tar
nixpkgs-71450b1c1a2ee2d32fa642316061df6cc53a8d49.tar.gz
nixpkgs-71450b1c1a2ee2d32fa642316061df6cc53a8d49.tar.bz2
nixpkgs-71450b1c1a2ee2d32fa642316061df6cc53a8d49.tar.lz
nixpkgs-71450b1c1a2ee2d32fa642316061df6cc53a8d49.tar.xz
nixpkgs-71450b1c1a2ee2d32fa642316061df6cc53a8d49.tar.zst
nixpkgs-71450b1c1a2ee2d32fa642316061df6cc53a8d49.zip
nixos/gitea: Don't include not needed database options depending on type
This was discovered in https://github.com/NixOS/nixpkgs/pull/60014
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/misc/gitea.nix15
1 files changed, 10 insertions, 5 deletions
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index be4d3871978..6fd4183bd6b 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -8,6 +8,7 @@ let
   pg = config.services.postgresql;
   useMysql = cfg.database.type == "mysql";
   usePostgresql = cfg.database.type == "postgres";
+  useSqlite = cfg.database.type == "sqlite3";
   configFile = pkgs.writeText "app.ini" ''
     APP_NAME = ${cfg.appName}
     RUN_USER = ${cfg.user}
@@ -15,11 +16,15 @@ let
 
     [database]
     DB_TYPE = ${cfg.database.type}
-    HOST = ${if cfg.database.socket != null then cfg.database.socket else cfg.database.host + ":" + toString cfg.database.port}
-    NAME = ${cfg.database.name}
-    USER = ${cfg.database.user}
-    PASSWD = #dbpass#
-    PATH = ${cfg.database.path}
+    ${optionalString (usePostgresql || useMysql) ''
+      HOST = ${if cfg.database.socket != null then cfg.database.socket else cfg.database.host + ":" + toString cfg.database.port}
+      NAME = ${cfg.database.name}
+      USER = ${cfg.database.user}
+      PASSWD = #dbpass#
+    ''}
+    ${optionalString useSqlite ''
+      PATH = ${cfg.database.path}
+    ''}
     ${optionalString usePostgresql ''
       SSL_MODE = disable
     ''}