tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixos/cgit: add package option
schnusch
3 years ago
45f06d97
218c7795
+20
-4
2 changed files
expand all
collapse all
unified
split
nixos
modules
services
networking
cgit.nix
tests
cgit.nix
+4
-2
nixos/modules/services/networking/cgit.nix
···
100
100
options = {
101
101
enable = mkEnableOption (mdDoc "cgit");
102
102
103
103
+
package = mkPackageOptionMD pkgs "cgit" {};
104
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
175
-
alias ${pkgs.cgit}/cgit/${name};
177
177
+
alias ${cfg.package}/cgit/${name};
176
178
'';
177
179
})
178
180
) // {
···
187
189
};
188
190
"${stripLocation cfg}/" = {
189
191
fastcgiParams = {
190
190
-
SCRIPT_FILENAME = "${pkgs.cgit}/cgit/cgit.cgi";
192
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
1
-
import ./make-test-python.nix ({ pkgs, ...} : {
1
1
+
import ./make-test-python.nix ({ pkgs, ... }:
2
2
+
let
3
3
+
robotsTxt = pkgs.writeText "cgit-robots.txt" ''
4
4
+
User-agent: *
5
5
+
Disallow: /
6
6
+
'';
7
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
17
+
package = pkgs.cgit.overrideAttrs ({ postInstall, ... }: {
18
18
+
postInstall = ''
19
19
+
${postInstall}
20
20
+
cp ${robotsTxt} "$out/cgit/robots.txt"
21
21
+
'';
22
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
31
-
server.succeed("curl -fsS http://localhost/%28c%29git/robots.txt")
43
43
+
server.succeed("curl -fsS http://localhost/%28c%29git/cgit.css")
44
44
+
45
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'"