1 {pkgs, lib, config, ...}:
2 let inherit (config.services) gitweb gitolite nginx;
3 package = pkgs.gitweb.override (lib.optionalAttrs gitweb.gitwebTheme {
6 RuntimeDirectory = "gitweb";
7 gitwebSocket = "/run/${RuntimeDirectory}/gitweb.sock";
11 systemd.services.gitweb = {
12 description = "GitWeb service";
13 script = "${pkgs.gitweb}/gitweb.cgi --fastcgi --nproc=1";
15 FCGI_SOCKET_PATH = gitwebSocket;
16 FCGI_SOCKET_PERM = "432"; # decimal of 660 in octal, since current CGI::Fast doesn't use perl's oct()
21 RuntimeDirectory = [ RuntimeDirectory ];
25 wantedBy = [ "multi-user.target" ];
29 projectroot = "${gitolite.dataDir}/repositories";
31 # FIX: gitweb bug: FCGI is not Unicode aware.
33 my $enc = Encode::find_encoding('UTF-8');
34 my $org = \&FCGI::Stream::PRINT;
35 no warnings 'redefine';
36 *FCGI::Stream::PRINT = sub {
38 for (my $i = 1; $i < @_; $i++) {
39 $OUTPUT[$i] = $enc->encode($_[$i], Encode::FB_CROAK|Encode::LEAVE_SRC);
48 virtualHosts."git" = {
50 # { addr = "0.0.0.0"; port = 80; ssl = false; }
55 alias = "${pkgs.gitweb}/static/";
59 include ${pkgs.nginx}/conf/fastcgi_params;
60 fastcgi_param GITWEB_CONFIG ${gitweb.gitwebConfigFile};
61 fastcgi_pass unix:${gitwebSocket};