2018-03-27 16:42:13 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2018-03-29 13:42:49 +00:00
|
|
|
cfg = config.services.gitweb;
|
2018-04-17 17:06:44 +00:00
|
|
|
package = pkgs.gitweb.override (optionalAttrs cfg.gitwebTheme {
|
|
|
|
gitwebTheme = true;
|
|
|
|
});
|
2018-03-27 16:42:13 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
|
|
|
|
options.services.nginx.gitweb = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
type = types.bool;
|
|
|
|
description = ''
|
|
|
|
If true, enable gitweb in nginx. Access it at http://yourserver/gitweb
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2018-03-29 13:42:49 +00:00
|
|
|
config = mkIf config.services.nginx.gitweb.enable {
|
2018-03-27 16:42:13 +00:00
|
|
|
|
|
|
|
systemd.services.gitweb = {
|
|
|
|
description = "GitWeb service";
|
2018-04-17 17:06:44 +00:00
|
|
|
script = "${package}/gitweb.cgi --fastcgi --nproc=1";
|
2018-04-06 19:36:03 +00:00
|
|
|
environment = {
|
|
|
|
FCGI_SOCKET_PATH = "/run/gitweb/gitweb.sock";
|
|
|
|
};
|
2018-03-27 16:42:13 +00:00
|
|
|
serviceConfig = {
|
|
|
|
User = "nginx";
|
|
|
|
Group = "nginx";
|
2018-04-06 19:36:03 +00:00
|
|
|
RuntimeDirectory = [ "gitweb" ];
|
2018-03-27 16:42:13 +00:00
|
|
|
};
|
2018-04-06 19:36:03 +00:00
|
|
|
wantedBy = [ "multi-user.target" ];
|
2018-03-27 16:42:13 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
virtualHosts.default = {
|
2018-04-17 17:06:44 +00:00
|
|
|
locations."/gitweb/static/" = {
|
|
|
|
alias = "${package}/static/";
|
2018-04-06 19:36:03 +00:00
|
|
|
};
|
2018-04-17 17:06:44 +00:00
|
|
|
locations."/gitweb/" = {
|
2018-03-27 16:42:13 +00:00
|
|
|
extraConfig = ''
|
|
|
|
include ${pkgs.nginx}/conf/fastcgi_params;
|
2018-03-29 13:42:49 +00:00
|
|
|
fastcgi_param GITWEB_CONFIG ${cfg.gitwebConfigFile};
|
2018-04-06 19:36:03 +00:00
|
|
|
fastcgi_pass unix:/run/gitweb/gitweb.sock;
|
2018-03-27 16:42:13 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = with maintainers; [ gnidorah ];
|
|
|
|
|
|
|
|
}
|