diff options
| author | Kleidi Bujari <mail@4kb.net> | 2024-12-01 22:30:26 -0500 |
|---|---|---|
| committer | Kleidi Bujari <mail@4kb.net> | 2024-12-01 22:30:26 -0500 |
| commit | f08f3812f40322b6098d75573413ed83f358871f (patch) | |
| tree | 0f864c4695dab404e261e6bf179cfc1b04d6c7f5 /modules/xnet/gitserver/gitweb.nix | |
| parent | 3ccc7e784a0ed5b19910ab856f6d9774a6f27956 (diff) | |
| download | depot-f08f3812f40322b6098d75573413ed83f358871f.tar.gz depot-f08f3812f40322b6098d75573413ed83f358871f.tar.bz2 depot-f08f3812f40322b6098d75573413ed83f358871f.zip | |
Cleanup xnet module and add baseline modules
With these changes, the xnet module is useable as a system builder. At
this point, it is still undecided whether all configuration will be
generalized into this module, rather than keeping mini-modules local to
the machine they will run on.
Diffstat (limited to 'modules/xnet/gitserver/gitweb.nix')
| -rw-r--r-- | modules/xnet/gitserver/gitweb.nix | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/modules/xnet/gitserver/gitweb.nix b/modules/xnet/gitserver/gitweb.nix new file mode 100644 index 0000000..c3696ab --- /dev/null +++ b/modules/xnet/gitserver/gitweb.nix @@ -0,0 +1,74 @@ +{ config, lib, pkgs, ... }: +let + cfg = config.xnet.gitServer.gitweb; + inherit (lib) mkOption mkIf types; +in +{ + options.xnet.gitServer.gitweb = { + enable = mkOption { + type = types.bool; + default = false; + description = "Enable web interface to git repos."; + }; + + hostName = mkOption { + type = types.str; + default = "src.web.4kb.net"; + description = "Hostname the webUI is served from."; + }; + }; + + config = mkIf cfg.enable { + xnet.nginx.enable = true; + + services.cgit.main = { + enable = true; + scanPath = config.xnet.gitServer.path; + package = pkgs.cgit-pink; + nginx = { + virtualHost = cfg.hostName; + location = "/"; + }; + extraConfig = '' + mimetype.gif=image/gif + mimetype.html=text/html + mimetype.jpeg=image/jpeg + mimetype.jpg=image/jpeg + mimetype.pdf=application/pdf + mimetype.png=image/png + mimetype.svg=image/svg+xml + readme=:readme + readme=:readme.md + readme=:readme.txt + readme=:README + readme=:README.md + readme=:README.txt + ''; + settings = { + about-filter = "${pkgs.cgit-pink}/lib/cgit/filters/about-formatting.sh"; + clone-url = "https://${cfg.hostName}/$CGIT_REPO_URL git@${cfg.hostName}:$CGIT_REPO_URL"; + enable-commit-graph = true; + enable-http-clone = false; + enable-index-links = true; + enable-remote-branches = true; + remove-suffix = true; + robots = "noindex, nofollow"; + root-desc = "What I cannot create, I do not understand"; + root-title = cfg.hostName; + section-from-path = true; + snapshots = "tar.gz tar.bz2 zip"; + }; + }; + + # required for rendering markdown readme + environment.systemPackages = with pkgs; [ + python312 + python312Packages.markdown + ]; + + # services.nginx.virtualHosts."${cfg.gitweb.hostName}" = { + # useACMEHost = "4kb.net"; + # addSSL = true; + # }; + }; +} |
