diff options
author | Notkea <pacien@users.noreply.github.com> | 2018-06-10 16:25:01 +0200 |
---|---|---|
committer | pacien <pacien.trangirard@pacien.net> | 2018-06-13 00:28:52 +0200 |
commit | 8b9559e417f529138449a1a80aeed7c3fa449d7f (patch) | |
tree | 3fd766e085701733343cfb61637e833763bf0c7c /nixos | |
parent | f0bfa9de83082fd27a092f330b22b697a7955883 (diff) | |
download | nixpkgs-8b9559e417f529138449a1a80aeed7c3fa449d7f.tar nixpkgs-8b9559e417f529138449a1a80aeed7c3fa449d7f.tar.gz nixpkgs-8b9559e417f529138449a1a80aeed7c3fa449d7f.tar.bz2 nixpkgs-8b9559e417f529138449a1a80aeed7c3fa449d7f.tar.lz nixpkgs-8b9559e417f529138449a1a80aeed7c3fa449d7f.tar.xz nixpkgs-8b9559e417f529138449a1a80aeed7c3fa449d7f.tar.zst nixpkgs-8b9559e417f529138449a1a80aeed7c3fa449d7f.zip |
cgit: parametrise subdirectory
This proposal enables the user to choose the sub-directory in which to serve cgit. The previous default behaviour isn't altered.
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/web-servers/lighttpd/cgit.nix | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/nixos/modules/services/web-servers/lighttpd/cgit.nix b/nixos/modules/services/web-servers/lighttpd/cgit.nix index 710fecc0c05..e6a054c296d 100644 --- a/nixos/modules/services/web-servers/lighttpd/cgit.nix +++ b/nixos/modules/services/web-servers/lighttpd/cgit.nix @@ -4,8 +4,15 @@ with lib; let cfg = config.services.lighttpd.cgit; + pathPrefix = if stringLength cfg.subdir == 0 then "" else "/" + cfg.subdir; 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} ''; in @@ -18,8 +25,17 @@ in type = types.bool; description = '' If true, enable cgit (fast web interface for git repositories) as a - sub-service in lighttpd. cgit will be accessible at - http://yourserver/cgit + sub-service in lighttpd. + ''; + }; + + 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.extraConfig = '' - $HTTP["url"] =~ "^/cgit" { + $HTTP["url"] =~ "^/${cfg.subdir}" { cgi.assign = ( "cgit.cgi" => "${pkgs.cgit}/cgit/cgit.cgi" ) alias.url = ( - "/cgit.css" => "${pkgs.cgit}/cgit/cgit.css", - "/cgit.png" => "${pkgs.cgit}/cgit/cgit.png", - "/cgit" => "${pkgs.cgit}/cgit/cgit.cgi" + "${pathPrefix}/cgit.css" => "${pkgs.cgit}/cgit/cgit.css", + "${pathPrefix}/cgit.png" => "${pkgs.cgit}/cgit/cgit.png", + "${pathPrefix}" => "${pkgs.cgit}/cgit/cgit.cgi" ) setenv.add-environment = ( "CGIT_CONFIG" => "${configFile}" |