lol

nixos/cgit: add package option

schnusch 45f06d97 218c7795

+20 -4
+4 -2
nixos/modules/services/networking/cgit.nix
··· 100 100 options = { 101 101 enable = mkEnableOption (mdDoc "cgit"); 102 102 103 + package = mkPackageOptionMD pkgs "cgit" {}; 104 + 103 105 nginx.virtualHost = mkOption { 104 106 description = mdDoc "VirtualHost to serve cgit on, defaults to the attribute name."; 105 107 type = types.str; ··· 172 174 [ "cgit.css" "cgit.png" "favicon.ico" "robots.txt" ] 173 175 (name: nameValuePair "= ${stripLocation cfg}/${name}" { 174 176 extraConfig = '' 175 - alias ${pkgs.cgit}/cgit/${name}; 177 + alias ${cfg.package}/cgit/${name}; 176 178 ''; 177 179 }) 178 180 ) // { ··· 187 189 }; 188 190 "${stripLocation cfg}/" = { 189 191 fastcgiParams = { 190 - SCRIPT_FILENAME = "${pkgs.cgit}/cgit/cgit.cgi"; 192 + SCRIPT_FILENAME = "${cfg.package}/cgit/cgit.cgi"; 191 193 QUERY_STRING = "$args"; 192 194 HTTP_HOST = "$server_name"; 193 195 CGIT_CONFIG = mkCgitrc cfg;
+16 -2
nixos/tests/cgit.nix
··· 1 - import ./make-test-python.nix ({ pkgs, ...} : { 1 + import ./make-test-python.nix ({ pkgs, ... }: 2 + let 3 + robotsTxt = pkgs.writeText "cgit-robots.txt" '' 4 + User-agent: * 5 + Disallow: / 6 + ''; 7 + in { 2 8 name = "cgit"; 3 9 meta = with pkgs.lib.maintainers; { 4 10 maintainers = [ schnusch ]; ··· 8 14 server = { ... }: { 9 15 services.cgit."localhost" = { 10 16 enable = true; 17 + package = pkgs.cgit.overrideAttrs ({ postInstall, ... }: { 18 + postInstall = '' 19 + ${postInstall} 20 + cp ${robotsTxt} "$out/cgit/robots.txt" 21 + ''; 22 + }); 11 23 nginx.location = "/(c)git/"; 12 24 repos = { 13 25 some-repo = { ··· 28 40 server.wait_for_unit("network.target") 29 41 server.wait_for_open_port(80) 30 42 31 - server.succeed("curl -fsS http://localhost/%28c%29git/robots.txt") 43 + server.succeed("curl -fsS http://localhost/%28c%29git/cgit.css") 44 + 45 + server.succeed("curl -fsS http://localhost/%28c%29git/robots.txt | diff -u - ${robotsTxt}") 32 46 33 47 server.succeed( 34 48 "curl -fsS http://localhost/%28c%29git/ | grep -F 'some-repo description'"