summary refs log tree commit diff
path: root/nixos/modules/services/misc/gitea.nix
diff options
context:
space:
mode:
authorIzorkin <izorkin@elven.pw>2020-07-31 01:16:53 +0300
committerIzorkin <izorkin@elven.pw>2020-08-05 11:19:32 +0300
commit6a0fd33b4c15d7e0e0b0cdad5ef280eba32ccdcc (patch)
tree29d2f7da27fdcbd5cc0ca343cfc115d7ad5d7c5a /nixos/modules/services/misc/gitea.nix
parent1a0e633c600805cae48e09f2ecae5201fa369ba0 (diff)
downloadnixpkgs-6a0fd33b4c15d7e0e0b0cdad5ef280eba32ccdcc.tar
nixpkgs-6a0fd33b4c15d7e0e0b0cdad5ef280eba32ccdcc.tar.gz
nixpkgs-6a0fd33b4c15d7e0e0b0cdad5ef280eba32ccdcc.tar.bz2
nixpkgs-6a0fd33b4c15d7e0e0b0cdad5ef280eba32ccdcc.tar.lz
nixpkgs-6a0fd33b4c15d7e0e0b0cdad5ef280eba32ccdcc.tar.xz
nixpkgs-6a0fd33b4c15d7e0e0b0cdad5ef280eba32ccdcc.tar.zst
nixpkgs-6a0fd33b4c15d7e0e0b0cdad5ef280eba32ccdcc.zip
nixos/gitea: add support socket connection
Diffstat (limited to 'nixos/modules/services/misc/gitea.nix')
-rw-r--r--nixos/modules/services/misc/gitea.nix30
1 files changed, 22 insertions, 8 deletions
diff --git a/nixos/modules/services/misc/gitea.nix b/nixos/modules/services/misc/gitea.nix
index e672440564a..734bf79ddf6 100644
--- a/nixos/modules/services/misc/gitea.nix
+++ b/nixos/modules/services/misc/gitea.nix
@@ -206,6 +206,12 @@ in
         description = "HTTP listen port.";
       };
 
+      enableUnixSocket = mkOption {
+        type = types.bool;
+        default = false;
+        description = "Configure Gitea to listen on a unix socket instead of the default TCP port.";
+      };
+
       cookieSecure = mkOption {
         type = types.bool;
         default = false;
@@ -306,14 +312,22 @@ in
         ROOT = cfg.repositoryRoot;
       };
 
-      server = {
-        DOMAIN = cfg.domain;
-        HTTP_ADDR = cfg.httpAddress;
-        HTTP_PORT = cfg.httpPort;
-        ROOT_URL = cfg.rootUrl;
-        STATIC_ROOT_PATH = cfg.staticRootPath;
-        LFS_JWT_SECRET = "#jwtsecret#";
-      };
+      server = mkMerge [
+        {
+          DOMAIN = cfg.domain;
+          STATIC_ROOT_PATH = cfg.staticRootPath;
+          LFS_JWT_SECRET = "#jwtsecret#";
+          ROOT_URL = cfg.rootUrl;
+        }
+        (mkIf cfg.enableUnixSocket {
+          PROTOCOL = "unix";
+          HTTP_ADDR = "/run/gitea/gitea.sock";
+        })
+        (mkIf (!cfg.enableUnixSocket) {
+          HTTP_ADDR = cfg.httpAddress;
+          HTTP_PORT = cfg.httpPort;
+        })
+      ];
 
       session = {
         COOKIE_NAME = "session";