diff options
Diffstat (limited to 'virtual/modules/gitweb')
-rw-r--r-- | virtual/modules/gitweb/default.nix | 30 | ||||
-rw-r--r-- | virtual/modules/gitweb/gitweb.nix | 64 |
2 files changed, 94 insertions, 0 deletions
diff --git a/virtual/modules/gitweb/default.nix b/virtual/modules/gitweb/default.nix new file mode 100644 index 0000000..2a860ba --- /dev/null +++ b/virtual/modules/gitweb/default.nix | |||
@@ -0,0 +1,30 @@ | |||
1 | { lib, pkgs, config, mylibs, ... }: | ||
2 | let | ||
3 | # FIXME: add buildbot | ||
4 | gitweb = pkgs.callPackage ./gitweb.nix { gitoliteDir = config.services.myGitolite.gitoliteDir; }; | ||
5 | cfg = config.services.myGitweb; | ||
6 | in { | ||
7 | options.services.myGitweb = { | ||
8 | enable = lib.mkEnableOption "my gitweb service"; | ||
9 | }; | ||
10 | |||
11 | config = lib.mkIf cfg.enable { | ||
12 | security.acme.certs."eldiron".extraDomains."git.immae.eu" = null; | ||
13 | |||
14 | nixpkgs.config.packageOverrides = oldpkgs: rec { | ||
15 | gitweb = oldpkgs.gitweb.overrideAttrs(old: { | ||
16 | installPhase = old.installPhase + '' | ||
17 | cp -r ${./theme} $out/gitweb-theme; | ||
18 | ''; | ||
19 | }); | ||
20 | }; | ||
21 | |||
22 | services.myWebsites.tools.modules = gitweb.apache.modules; | ||
23 | services.myWebsites.tools.vhostConfs.git = { | ||
24 | certName = "eldiron"; | ||
25 | hosts = ["git.immae.eu" ]; | ||
26 | root = gitweb.webRoot; | ||
27 | extraConfig = [ gitweb.apache.vhostConf ]; | ||
28 | }; | ||
29 | }; | ||
30 | } | ||
diff --git a/virtual/modules/gitweb/gitweb.nix b/virtual/modules/gitweb/gitweb.nix new file mode 100644 index 0000000..7b4dcac --- /dev/null +++ b/virtual/modules/gitweb/gitweb.nix | |||
@@ -0,0 +1,64 @@ | |||
1 | { gitweb, writeText, gitolite, git, gitoliteDir }: | ||
2 | rec { | ||
3 | varDir = gitoliteDir; | ||
4 | webRoot = gitweb; | ||
5 | config = writeText "gitweb.conf" '' | ||
6 | $git_temp = "/tmp"; | ||
7 | |||
8 | # The directories where your projects are. Must not end with a | ||
9 | # slash. | ||
10 | $projectroot = "${varDir}/repositories"; | ||
11 | |||
12 | $projects_list = "${varDir}/projects.list"; | ||
13 | $strict_export = "true"; | ||
14 | |||
15 | # Base URLs for links displayed in the web interface. | ||
16 | our @git_base_url_list = qw(ssh://gitolite@git.immae.eu https://git.immae.eu); | ||
17 | |||
18 | $feature{'blame'}{'default'} = [1]; | ||
19 | $feature{'avatar'}{'default'} = ['gravatar']; | ||
20 | $feature{'highlight'}{'default'} = [1]; | ||
21 | |||
22 | @stylesheets = ("gitweb-theme/gitweb.css"); | ||
23 | $logo = "gitweb-theme/git-logo.png"; | ||
24 | $favicon = "gitweb-theme/git-favicon.png"; | ||
25 | $javascript = "gitweb-theme/gitweb.js"; | ||
26 | $logo_url = "https://git.immae.eu/"; | ||
27 | $projects_list_group_categories = "true"; | ||
28 | $projects_list_description_width = 60; | ||
29 | $project_list_default_category = "__Others__"; | ||
30 | ''; | ||
31 | apache = { | ||
32 | user = "wwwrun"; | ||
33 | group = "wwwrun"; | ||
34 | modules = [ "cgid" ]; | ||
35 | vhostConf = '' | ||
36 | SetEnv GIT_PROJECT_ROOT ${varDir}/repositories/ | ||
37 | ScriptAliasMatch \ | ||
38 | "(?x)^/(.*/(HEAD | \ | ||
39 | info/refs | \ | ||
40 | objects/(info/[^/]+ | \ | ||
41 | [0-9a-f]{2}/[0-9a-f]{38} | \ | ||
42 | pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ | ||
43 | git-(upload|receive)-pack))$" \ | ||
44 | ${git}/libexec/git-core/git-http-backend/$1 | ||
45 | |||
46 | <Directory "${gitolite}"> | ||
47 | Require all granted | ||
48 | </Directory> | ||
49 | <Directory "${git}/libexec/git-core"> | ||
50 | Require all granted | ||
51 | </Directory> | ||
52 | <Directory "${webRoot}"> | ||
53 | DirectoryIndex gitweb.cgi | ||
54 | Require all granted | ||
55 | AllowOverride None | ||
56 | Options ExecCGI FollowSymLinks | ||
57 | <Files gitweb.cgi> | ||
58 | SetHandler cgi-script | ||
59 | SetEnv GITWEB_CONFIG "${config}" | ||
60 | </Files> | ||
61 | </Directory> | ||
62 | ''; | ||
63 | }; | ||
64 | } | ||