at 18.09-beta 1.3 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 cfg = config.services.gitweb; 7 package = pkgs.gitweb.override (optionalAttrs cfg.gitwebTheme { 8 gitwebTheme = true; 9 }); 10 11in 12{ 13 14 options.services.nginx.gitweb = { 15 16 enable = mkOption { 17 default = false; 18 type = types.bool; 19 description = '' 20 If true, enable gitweb in nginx. Access it at http://yourserver/gitweb 21 ''; 22 }; 23 24 }; 25 26 config = mkIf config.services.nginx.gitweb.enable { 27 28 systemd.services.gitweb = { 29 description = "GitWeb service"; 30 script = "${package}/gitweb.cgi --fastcgi --nproc=1"; 31 environment = { 32 FCGI_SOCKET_PATH = "/run/gitweb/gitweb.sock"; 33 }; 34 serviceConfig = { 35 User = "nginx"; 36 Group = "nginx"; 37 RuntimeDirectory = [ "gitweb" ]; 38 }; 39 wantedBy = [ "multi-user.target" ]; 40 }; 41 42 services.nginx = { 43 virtualHosts.default = { 44 locations."/gitweb/static/" = { 45 alias = "${package}/static/"; 46 }; 47 locations."/gitweb/" = { 48 extraConfig = '' 49 include ${pkgs.nginx}/conf/fastcgi_params; 50 fastcgi_param GITWEB_CONFIG ${cfg.gitwebConfigFile}; 51 fastcgi_pass unix:/run/gitweb/gitweb.sock; 52 ''; 53 }; 54 }; 55 }; 56 57 }; 58 59 meta.maintainers = with maintainers; [ gnidorah ]; 60 61}