diff options
Diffstat (limited to 'nixops/modules/websites/tools/git')
-rw-r--r-- | nixops/modules/websites/tools/git/default.nix | 45 | ||||
-rw-r--r-- | nixops/modules/websites/tools/git/gitweb.nix | 64 | ||||
-rw-r--r-- | nixops/modules/websites/tools/git/mantisbt.nix | 90 |
3 files changed, 0 insertions, 199 deletions
diff --git a/nixops/modules/websites/tools/git/default.nix b/nixops/modules/websites/tools/git/default.nix deleted file mode 100644 index 495c5ea..0000000 --- a/nixops/modules/websites/tools/git/default.nix +++ /dev/null | |||
@@ -1,45 +0,0 @@ | |||
1 | { lib, pkgs, config, myconfig, ... }: | ||
2 | let | ||
3 | mantisbt = pkgs.callPackage ./mantisbt.nix { | ||
4 | inherit (pkgs.webapps) mantisbt_2 mantisbt_2-plugins; | ||
5 | env = myconfig.env.tools.mantisbt; | ||
6 | }; | ||
7 | gitweb = pkgs.callPackage ./gitweb.nix { gitoliteDir = config.services.myGitolite.gitoliteDir; }; | ||
8 | |||
9 | cfg = config.services.myWebsites.tools.git; | ||
10 | in { | ||
11 | options.services.myWebsites.tools.git = { | ||
12 | enable = lib.mkEnableOption "enable git's website"; | ||
13 | }; | ||
14 | |||
15 | config = lib.mkIf cfg.enable { | ||
16 | secrets.keys = mantisbt.keys; | ||
17 | services.websites.tools.modules = | ||
18 | gitweb.apache.modules ++ | ||
19 | mantisbt.apache.modules; | ||
20 | system.extraSystemBuilderCmds = '' | ||
21 | mkdir -p $out/webapps | ||
22 | ln -s ${gitweb.webRoot} $out/webapps/${gitweb.apache.webappName} | ||
23 | ln -s ${mantisbt.webRoot} $out/webapps/${mantisbt.apache.webappName} | ||
24 | ''; | ||
25 | |||
26 | services.websites.tools.vhostConfs.git = { | ||
27 | certName = "eldiron"; | ||
28 | addToCerts = true; | ||
29 | hosts = ["git.immae.eu" ]; | ||
30 | root = gitweb.apache.root; | ||
31 | extraConfig = [ | ||
32 | gitweb.apache.vhostConf | ||
33 | mantisbt.apache.vhostConf | ||
34 | '' | ||
35 | RewriteEngine on | ||
36 | RewriteCond %{REQUEST_URI} ^/releases | ||
37 | RewriteRule /releases(.*) https://release.immae.eu$1 [P,L] | ||
38 | '' | ||
39 | ]; | ||
40 | }; | ||
41 | services.phpfpm.poolConfigs = { | ||
42 | mantisbt = mantisbt.phpFpm.pool; | ||
43 | }; | ||
44 | }; | ||
45 | } | ||
diff --git a/nixops/modules/websites/tools/git/gitweb.nix b/nixops/modules/websites/tools/git/gitweb.nix deleted file mode 100644 index 2ee7a63..0000000 --- a/nixops/modules/websites/tools/git/gitweb.nix +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | { gitweb, writeText, gitolite, git, gitoliteDir, highlight }: | ||
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 | $highlight_bin = "${highlight}/bin/highlight"; | ||
31 | ''; | ||
32 | apache = rec { | ||
33 | user = "wwwrun"; | ||
34 | group = "wwwrun"; | ||
35 | modules = [ "cgid" ]; | ||
36 | webappName = "tools_gitweb"; | ||
37 | root = "/run/current-system/webapps/${webappName}"; | ||
38 | vhostConf = '' | ||
39 | SetEnv GIT_PROJECT_ROOT ${varDir}/repositories/ | ||
40 | ScriptAliasMatch \ | ||
41 | "(?x)^/(.*/(HEAD | \ | ||
42 | info/refs | \ | ||
43 | objects/(info/[^/]+ | \ | ||
44 | [0-9a-f]{2}/[0-9a-f]{38} | \ | ||
45 | pack/pack-[0-9a-f]{40}\.(pack|idx)) | \ | ||
46 | git-(upload|receive)-pack))$" \ | ||
47 | ${git}/libexec/git-core/git-http-backend/$1 | ||
48 | |||
49 | <Directory "${git}/libexec/git-core"> | ||
50 | Require all granted | ||
51 | </Directory> | ||
52 | <Directory "${root}"> | ||
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 | } | ||
diff --git a/nixops/modules/websites/tools/git/mantisbt.nix b/nixops/modules/websites/tools/git/mantisbt.nix deleted file mode 100644 index 0c459a7..0000000 --- a/nixops/modules/websites/tools/git/mantisbt.nix +++ /dev/null | |||
@@ -1,90 +0,0 @@ | |||
1 | { env, mantisbt_2, mantisbt_2-plugins }: | ||
2 | rec { | ||
3 | keys = [{ | ||
4 | dest = "webapps/tools-mantisbt"; | ||
5 | user = apache.user; | ||
6 | group = apache.group; | ||
7 | permissions = "0400"; | ||
8 | text = '' | ||
9 | <?php | ||
10 | $g_hostname = '${env.postgresql.socket}'; | ||
11 | $g_db_username = '${env.postgresql.user}'; | ||
12 | $g_db_password = '${env.postgresql.password}'; | ||
13 | $g_database_name = '${env.postgresql.database}'; | ||
14 | $g_db_type = 'pgsql'; | ||
15 | $g_crypto_master_salt = '${env.master_salt}'; | ||
16 | $g_allow_signup = OFF; | ||
17 | $g_allow_anonymous_login = ON; | ||
18 | $g_anonymous_account = 'anonymous'; | ||
19 | |||
20 | $g_phpMailer_method = PHPMAILER_METHOD_SENDMAIL; | ||
21 | $g_smtp_host = 'localhost'; | ||
22 | $g_smtp_username = '''; | ||
23 | $g_smtp_password = '''; | ||
24 | $g_webmaster_email = 'mantisbt@tools.immae.eu'; | ||
25 | $g_from_email = 'mantisbt@tools.immae.eu'; | ||
26 | $g_return_path_email = 'mantisbt@tools.immae.eu'; | ||
27 | $g_from_name = 'Mantis Bug Tracker at git.immae.eu'; | ||
28 | $g_email_receive_own = OFF; | ||
29 | # --- LDAP --- | ||
30 | $g_login_method = LDAP; | ||
31 | $g_ldap_protocol_version = 3; | ||
32 | $g_ldap_server = 'ldaps://ldap.immae.eu:636'; | ||
33 | $g_ldap_root_dn = 'ou=users,dc=immae,dc=eu'; | ||
34 | $g_ldap_bind_dn = 'cn=mantisbt,ou=services,dc=immae,dc=eu'; | ||
35 | $g_ldap_bind_passwd = '${env.ldap.password}'; | ||
36 | $g_use_ldap_email = ON; | ||
37 | $g_use_ldap_realname = ON; | ||
38 | $g_ldap_uid_field = 'uid'; | ||
39 | $g_ldap_realname_field = 'cn'; | ||
40 | $g_ldap_organization = '(memberOf=cn=users,cn=mantisbt,ou=services,dc=immae,dc=eu)'; | ||
41 | ''; | ||
42 | }]; | ||
43 | webRoot = (mantisbt_2.override { mantis_config = "/var/secrets/webapps/tools-mantisbt"; }).withPlugins (builtins.attrValues mantisbt_2-plugins); | ||
44 | apache = rec { | ||
45 | user = "wwwrun"; | ||
46 | group = "wwwrun"; | ||
47 | modules = [ "proxy_fcgi" ]; | ||
48 | webappName = "tools_mantisbt"; | ||
49 | root = "/run/current-system/webapps/${webappName}"; | ||
50 | vhostConf = '' | ||
51 | Alias /mantisbt "${root}" | ||
52 | <Directory "${root}"> | ||
53 | DirectoryIndex index.php | ||
54 | <FilesMatch "\.php$"> | ||
55 | SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" | ||
56 | </FilesMatch> | ||
57 | |||
58 | AllowOverride All | ||
59 | Options FollowSymlinks | ||
60 | Require all granted | ||
61 | </Directory> | ||
62 | <Directory "${root}/admin"> | ||
63 | #Reenable during upgrade | ||
64 | Require all denied | ||
65 | </Directory> | ||
66 | ''; | ||
67 | }; | ||
68 | phpFpm = rec { | ||
69 | serviceDeps = [ "postgresql.service" "openldap.service" ]; | ||
70 | basedir = builtins.concatStringsSep ":" ( | ||
71 | [ webRoot "/var/secrets/webapps/tools-mantisbt" ] | ||
72 | ++ webRoot.plugins); | ||
73 | socket = "/var/run/phpfpm/mantisbt.sock"; | ||
74 | pool = '' | ||
75 | listen = ${socket} | ||
76 | user = ${apache.user} | ||
77 | group = ${apache.group} | ||
78 | listen.owner = ${apache.user} | ||
79 | listen.group = ${apache.group} | ||
80 | pm = ondemand | ||
81 | pm.max_children = 60 | ||
82 | pm.process_idle_timeout = 60 | ||
83 | |||
84 | php_admin_value[upload_max_filesize] = 5000000 | ||
85 | |||
86 | php_admin_value[open_basedir] = "${basedir}:/tmp:/var/lib/php/sessions/mantisbt" | ||
87 | php_admin_value[session.save_path] = "/var/lib/php/sessions/mantisbt" | ||
88 | ''; | ||
89 | }; | ||
90 | } | ||