1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/modules/services/web-servers/nginx/gitweb.nix
2018-03-29 16:46:11 +03:00

65 lines
1.4 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.gitweb;
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
'';
};
};
config = mkIf config.services.nginx.gitweb.enable {
systemd.sockets.gitweb = {
description = "GitWeb Listen Socket";
listenStreams = [ "/run/gitweb.sock" ];
socketConfig = {
Accept = "false";
SocketUser = "nginx";
SocketGroup = "nginx";
SocketMode = "0600";
};
wantedBy = [ "sockets.target" ];
};
systemd.services.gitweb = {
description = "GitWeb service";
script = "${git}/share/gitweb/gitweb.cgi --fcgi";
serviceConfig = {
Type = "simple";
StandardInput = "socket";
User = "nginx";
Group = "nginx";
};
};
services.nginx = {
virtualHosts.default = {
locations."/gitweb" = {
root = "${pkgs.git}/share/gitweb";
extraConfig = ''
include ${pkgs.nginx}/conf/fastcgi_params;
fastcgi_param GITWEB_CONFIG ${cfg.gitwebConfigFile};
fastcgi_pass unix:/run/gitweb.sock;
'';
};
};
};
};
meta.maintainers = with maintainers; [ gnidorah ];
}