summary refs log tree commit diff
path: root/nixos/modules/services/misc
diff options
context:
space:
mode:
authorRenaud <c0bw3b@users.noreply.github.com>2018-11-08 23:45:46 +0100
committerGitHub <noreply@github.com>2018-11-08 23:45:46 +0100
commit6399b103d84b1362cc0f69976d44c22f48de3419 (patch)
treecaee6c683ac97fa9e2dbe12cb46c792d05ed56f2 /nixos/modules/services/misc
parent66b8fe5a0bfb5723e2e708747edb0eef597daa97 (diff)
parent0dde47a58acdd3cff855796bbd899c90c7fb25b5 (diff)
downloadnixpkgs-6399b103d84b1362cc0f69976d44c22f48de3419.tar
nixpkgs-6399b103d84b1362cc0f69976d44c22f48de3419.tar.gz
nixpkgs-6399b103d84b1362cc0f69976d44c22f48de3419.tar.bz2
nixpkgs-6399b103d84b1362cc0f69976d44c22f48de3419.tar.lz
nixpkgs-6399b103d84b1362cc0f69976d44c22f48de3419.tar.xz
nixpkgs-6399b103d84b1362cc0f69976d44c22f48de3419.tar.zst
nixpkgs-6399b103d84b1362cc0f69976d44c22f48de3419.zip
Merge pull request #49814 from aanderse/gitea
nixos/gitea: fix mysql issue, add mysql socket auth, and add a nixos test
Diffstat (limited to 'nixos/modules/services/misc')
-rw-r--r--nixos/modules/services/misc/gitea.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index a222325579f..7a10bd87299 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -6,6 +6,7 @@ let
   cfg = config.services.gitea;
   gitea = cfg.package;
   pg = config.services.postgresql;
+  useMysql = cfg.database.type == "mysql";
   usePostgresql = cfg.database.type == "postgres";
   configFile = pkgs.writeText "app.ini" ''
     APP_NAME = ${cfg.appName}
@@ -14,7 +15,7 @@ let
 
     [database]
     DB_TYPE = ${cfg.database.type}
-    HOST = ${cfg.database.host}:${toString cfg.database.port}
+    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#
@@ -148,6 +149,13 @@ in
           '';
         };
 
+        socket = mkOption {
+          type = types.nullOr types.path;
+          default = null;
+          example = "/run/mysqld/mysqld.sock";
+          description = "Path to the unix socket file to use for authentication.";
+        };
+
         path = mkOption {
           type = types.str;
           default = "${cfg.stateDir}/data/gitea.db";
@@ -253,7 +261,7 @@ in
 
     systemd.services.gitea = {
       description = "gitea";
-      after = [ "network.target" "postgresql.service" ];
+      after = [ "network.target" ] ++ lib.optional usePostgresql "postgresql.service" ++ lib.optional useMysql "mysql.service";
       wantedBy = [ "multi-user.target" ];
       path = [ gitea.bin ];