2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2013-05-06 11:49:29 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2013-05-06 11:49:29 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
});
|
2013-06-02 18:26:55 +01:00
|
|
|
|
2013-05-06 11:49:29 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
|
|
|
|
options.services.lighttpd.gitweb = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
2015-06-15 17:10:26 +01:00
|
|
|
type = types.bool;
|
2013-05-06 11:49:29 +01:00
|
|
|
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 {
|
2013-05-06 11:49:29 +01:00
|
|
|
|
2014-09-07 15:47:49 +01:00
|
|
|
# declare module dependencies
|
|
|
|
services.lighttpd.enableModules = [ "mod_cgi" "mod_redirect" "mod_alias" "mod_setenv" ];
|
|
|
|
|
2013-05-06 11:49:29 +01:00
|
|
|
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"
|
2013-05-06 11:49:29 +01:00
|
|
|
)
|
|
|
|
setenv.add-environment = (
|
2018-03-29 14:42:49 +01:00
|
|
|
"GITWEB_CONFIG" => "${cfg.gitwebConfigFile}",
|
2017-04-11 21:45:41 +01:00
|
|
|
"HOME" => "${cfg.projectroot}"
|
2013-05-06 11:49:29 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|