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 14:42:49 +01:00
cfg = config.services.gitweb;
2018-04-17 18:06:44 +01:00
package = pkgs.gitweb.override (optionalAttrs cfg.gitwebTheme {
gitwebTheme = true;
});
in
{
options.services.lighttpd.gitweb = {
enable = mkOption {
default = false;
2015-06-15 17:10:26 +01:00
type = types.bool;
description = ''
If true, enable gitweb in lighttpd. Access it at http://yourserver/gitweb
'';
};
};
2018-03-29 14:42:49 +01: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 18:06:44 +01:00
"/gitweb/static/" => "${package}/static/",
"/gitweb/" => "${package}/gitweb.cgi"
)
setenv.add-environment = (
2018-03-29 14:42:49 +01:00
"GITWEB_CONFIG" => "${cfg.gitwebConfigFile}",
"HOME" => "${cfg.projectroot}"
)
}
'';
};
}