mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-11 07:15:54 +03:00
nixos/cgit: add package option
This commit is contained in:
parent
218c7795a6
commit
45f06d9712
@ -100,6 +100,8 @@ in
|
|||||||
options = {
|
options = {
|
||||||
enable = mkEnableOption (mdDoc "cgit");
|
enable = mkEnableOption (mdDoc "cgit");
|
||||||
|
|
||||||
|
package = mkPackageOptionMD pkgs "cgit" {};
|
||||||
|
|
||||||
nginx.virtualHost = mkOption {
|
nginx.virtualHost = mkOption {
|
||||||
description = mdDoc "VirtualHost to serve cgit on, defaults to the attribute name.";
|
description = mdDoc "VirtualHost to serve cgit on, defaults to the attribute name.";
|
||||||
type = types.str;
|
type = types.str;
|
||||||
@ -172,7 +174,7 @@ in
|
|||||||
[ "cgit.css" "cgit.png" "favicon.ico" "robots.txt" ]
|
[ "cgit.css" "cgit.png" "favicon.ico" "robots.txt" ]
|
||||||
(name: nameValuePair "= ${stripLocation cfg}/${name}" {
|
(name: nameValuePair "= ${stripLocation cfg}/${name}" {
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
alias ${pkgs.cgit}/cgit/${name};
|
alias ${cfg.package}/cgit/${name};
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
) // {
|
) // {
|
||||||
@ -187,7 +189,7 @@ in
|
|||||||
};
|
};
|
||||||
"${stripLocation cfg}/" = {
|
"${stripLocation cfg}/" = {
|
||||||
fastcgiParams = {
|
fastcgiParams = {
|
||||||
SCRIPT_FILENAME = "${pkgs.cgit}/cgit/cgit.cgi";
|
SCRIPT_FILENAME = "${cfg.package}/cgit/cgit.cgi";
|
||||||
QUERY_STRING = "$args";
|
QUERY_STRING = "$args";
|
||||||
HTTP_HOST = "$server_name";
|
HTTP_HOST = "$server_name";
|
||||||
CGIT_CONFIG = mkCgitrc cfg;
|
CGIT_CONFIG = mkCgitrc cfg;
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
import ./make-test-python.nix ({ pkgs, ...} : {
|
import ./make-test-python.nix ({ pkgs, ... }:
|
||||||
|
let
|
||||||
|
robotsTxt = pkgs.writeText "cgit-robots.txt" ''
|
||||||
|
User-agent: *
|
||||||
|
Disallow: /
|
||||||
|
'';
|
||||||
|
in {
|
||||||
name = "cgit";
|
name = "cgit";
|
||||||
meta = with pkgs.lib.maintainers; {
|
meta = with pkgs.lib.maintainers; {
|
||||||
maintainers = [ schnusch ];
|
maintainers = [ schnusch ];
|
||||||
@ -8,6 +14,12 @@ import ./make-test-python.nix ({ pkgs, ...} : {
|
|||||||
server = { ... }: {
|
server = { ... }: {
|
||||||
services.cgit."localhost" = {
|
services.cgit."localhost" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs.cgit.overrideAttrs ({ postInstall, ... }: {
|
||||||
|
postInstall = ''
|
||||||
|
${postInstall}
|
||||||
|
cp ${robotsTxt} "$out/cgit/robots.txt"
|
||||||
|
'';
|
||||||
|
});
|
||||||
nginx.location = "/(c)git/";
|
nginx.location = "/(c)git/";
|
||||||
repos = {
|
repos = {
|
||||||
some-repo = {
|
some-repo = {
|
||||||
@ -28,7 +40,9 @@ import ./make-test-python.nix ({ pkgs, ...} : {
|
|||||||
server.wait_for_unit("network.target")
|
server.wait_for_unit("network.target")
|
||||||
server.wait_for_open_port(80)
|
server.wait_for_open_port(80)
|
||||||
|
|
||||||
server.succeed("curl -fsS http://localhost/%28c%29git/robots.txt")
|
server.succeed("curl -fsS http://localhost/%28c%29git/cgit.css")
|
||||||
|
|
||||||
|
server.succeed("curl -fsS http://localhost/%28c%29git/robots.txt | diff -u - ${robotsTxt}")
|
||||||
|
|
||||||
server.succeed(
|
server.succeed(
|
||||||
"curl -fsS http://localhost/%28c%29git/ | grep -F 'some-repo description'"
|
"curl -fsS http://localhost/%28c%29git/ | grep -F 'some-repo description'"
|
||||||
|
Loading…
Reference in New Issue
Block a user