nixpkgs/nixos/modules/services/web-servers/lighttpd/gitweb.nix

53 lines
1.1 KiB
Nix
Raw Normal View History

{ 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;
});
in
{
options.services.lighttpd.gitweb = {
enable = mkOption {
default = false;
2015-06-15 16:10:26 +00:00
type = types.bool;
description = ''
If true, enable gitweb in lighttpd. Access it at http://yourserver/gitweb
'';
};
};
2018-03-29 13:42:49 +00:00
config = mkIf config.services.lighttpd.gitweb.enable {
# declare module dependencies
services.lighttpd.enableModules = [ "mod_cgi" "mod_redirect" "mod_alias" "mod_setenv" ];
services.lighttpd.extraConfig = ''
$HTTP["url"] =~ "^/gitweb" {
cgi.assign = (
".cgi" => "${pkgs.perl}/bin/perl"
)
url.redirect = (
"^/gitweb$" => "/gitweb/"
)
alias.url = (
2018-04-17 17:06:44 +00:00
"/gitweb/static/" => "${package}/static/",
"/gitweb/" => "${package}/gitweb.cgi"
)
setenv.add-environment = (
2018-03-29 13:42:49 +00:00
"GITWEB_CONFIG" => "${cfg.gitwebConfigFile}",
"HOME" => "${cfg.projectroot}"
)
}
'';
};
}