summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-10-11 23:50:19 +0200
committerGitHub <noreply@github.com>2020-10-11 23:50:19 +0200
commita6fec75d0472670448b9708e1619fef2c36af9d5 (patch)
tree591a4d050b48e8033271171a88be203efad46ce0 /nixos
parenta1cb02148bf9611136b1c939ec46eaf2ac3e8d8a (diff)
parentd85f50b71fa58651bbc7baef3fcc29a4a271eef3 (diff)
downloadnixpkgs-a6fec75d0472670448b9708e1619fef2c36af9d5.tar
nixpkgs-a6fec75d0472670448b9708e1619fef2c36af9d5.tar.gz
nixpkgs-a6fec75d0472670448b9708e1619fef2c36af9d5.tar.bz2
nixpkgs-a6fec75d0472670448b9708e1619fef2c36af9d5.tar.lz
nixpkgs-a6fec75d0472670448b9708e1619fef2c36af9d5.tar.xz
nixpkgs-a6fec75d0472670448b9708e1619fef2c36af9d5.tar.zst
nixpkgs-a6fec75d0472670448b9708e1619fef2c36af9d5.zip
Merge pull request #93426 from helsinki-systems/feat/gitlab-pages
nixos/gitlab: Support pages
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/misc/gitlab.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix
index 9896b8023e4..122bc3000b4 100644
--- a/nixos/modules/services/misc/gitlab.nix
+++ b/nixos/modules/services/misc/gitlab.nix
@@ -73,6 +73,11 @@ let
 
   redisConfig.production.url = cfg.redisUrl;
 
+  pagesArgs = [
+    "-pages-domain" gitlabConfig.production.pages.host
+    "-pages-root" "${gitlabConfig.production.shared.path}/pages"
+  ] ++ cfg.pagesExtraArgs;
+
   gitlabConfig = {
     # These are the default settings from config/gitlab.example.yml
     production = flip recursiveUpdate cfg.extraConfig {
@@ -236,6 +241,13 @@ in {
         description = "Reference to the gitaly package";
       };
 
+      packages.pages = mkOption {
+        type = types.package;
+        default = pkgs.gitlab-pages;
+        defaultText = "pkgs.gitlab-pages";
+        description = "Reference to the gitlab-pages package";
+      };
+
       statePath = mkOption {
         type = types.str;
         default = "/var/gitlab/state";
@@ -451,6 +463,12 @@ in {
         };
       };
 
+      pagesExtraArgs = mkOption {
+        type = types.listOf types.str;
+        default = [ "-listen-proxy" "127.0.0.1:8090" ];
+        description = "Arguments to pass to the gitlab-pages daemon";
+      };
+
       secrets.secretFile = mkOption {
         type = with types; nullOr path;
         default = null;
@@ -754,6 +772,26 @@ in {
       };
     };
 
+    systemd.services.gitlab-pages = mkIf (gitlabConfig.production.pages.enabled or false) {
+      description = "GitLab static pages daemon";
+      after = [ "network.target" "redis.service" "gitlab.service" ]; # gitlab.service creates configs
+      wantedBy = [ "multi-user.target" ];
+
+      path = [ pkgs.unzip ];
+
+      serviceConfig = {
+        Type = "simple";
+        TimeoutSec = "infinity";
+        Restart = "on-failure";
+
+        User = cfg.user;
+        Group = cfg.group;
+
+        ExecStart = "${cfg.packages.pages}/bin/gitlab-pages ${escapeShellArgs pagesArgs}";
+        WorkingDirectory = gitlabEnv.HOME;
+      };
+    };
+
     systemd.services.gitlab-workhorse = {
       after = [ "network.target" ];
       wantedBy = [ "multi-user.target" ];