Merge pull request #41799 from pacien/patch-4
cgit: Parametrise cgit subdirectory
This commit is contained in:
commit
be3a8c4bdb
@ -4,8 +4,15 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.lighttpd.cgit;
|
cfg = config.services.lighttpd.cgit;
|
||||||
|
pathPrefix = if stringLength cfg.subdir == 0 then "" else "/" + cfg.subdir;
|
||||||
configFile = pkgs.writeText "cgitrc"
|
configFile = pkgs.writeText "cgitrc"
|
||||||
''
|
''
|
||||||
|
# default paths to static assets
|
||||||
|
css=${pathPrefix}/cgit.css
|
||||||
|
logo=${pathPrefix}/cgit.png
|
||||||
|
favicon=${pathPrefix}/favicon.ico
|
||||||
|
|
||||||
|
# user configuration
|
||||||
${cfg.configText}
|
${cfg.configText}
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
@ -18,8 +25,17 @@ in
|
|||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = ''
|
description = ''
|
||||||
If true, enable cgit (fast web interface for git repositories) as a
|
If true, enable cgit (fast web interface for git repositories) as a
|
||||||
sub-service in lighttpd. cgit will be accessible at
|
sub-service in lighttpd.
|
||||||
http://yourserver/cgit
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
subdir = mkOption {
|
||||||
|
default = "cgit";
|
||||||
|
example = "";
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
The subdirectory in which to serve cgit. The web application will be
|
||||||
|
accessible at http://yourserver/''${subdir}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -48,14 +64,14 @@ in
|
|||||||
services.lighttpd.enableModules = [ "mod_cgi" "mod_alias" "mod_setenv" ];
|
services.lighttpd.enableModules = [ "mod_cgi" "mod_alias" "mod_setenv" ];
|
||||||
|
|
||||||
services.lighttpd.extraConfig = ''
|
services.lighttpd.extraConfig = ''
|
||||||
$HTTP["url"] =~ "^/cgit" {
|
$HTTP["url"] =~ "^/${cfg.subdir}" {
|
||||||
cgi.assign = (
|
cgi.assign = (
|
||||||
"cgit.cgi" => "${pkgs.cgit}/cgit/cgit.cgi"
|
"cgit.cgi" => "${pkgs.cgit}/cgit/cgit.cgi"
|
||||||
)
|
)
|
||||||
alias.url = (
|
alias.url = (
|
||||||
"/cgit.css" => "${pkgs.cgit}/cgit/cgit.css",
|
"${pathPrefix}/cgit.css" => "${pkgs.cgit}/cgit/cgit.css",
|
||||||
"/cgit.png" => "${pkgs.cgit}/cgit/cgit.png",
|
"${pathPrefix}/cgit.png" => "${pkgs.cgit}/cgit/cgit.png",
|
||||||
"/cgit" => "${pkgs.cgit}/cgit/cgit.cgi"
|
"${pathPrefix}" => "${pkgs.cgit}/cgit/cgit.cgi"
|
||||||
)
|
)
|
||||||
setenv.add-environment = (
|
setenv.add-environment = (
|
||||||
"CGIT_CONFIG" => "${configFile}"
|
"CGIT_CONFIG" => "${configFile}"
|
||||||
|
Loading…
Reference in New Issue
Block a user