diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-02-22 02:17:49 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-02-22 02:17:49 +0100 |
commit | 03b05e7ea5e094fd25275f0c549ef5b74d0284d6 (patch) | |
tree | 4acb248eca14c2e32d3a2021753a970316035667 | |
parent | 606d121ba0b5f36f9a6419c48e6986a27ac1f5b0 (diff) |
cgit: add default filters
-rw-r--r-- | apps/cgit/module.nix | 58 |
1 files changed, 43 insertions, 15 deletions
diff --git a/apps/cgit/module.nix b/apps/cgit/module.nix index 106764b..593f8a5 100644 --- a/apps/cgit/module.nix +++ b/apps/cgit/module.nix @@ -1,16 +1,44 @@ { appConfig, config, lib, pkgs, ... }: -{ - services.cgit.default.enable = true; - services.cgit.default.nginx.virtualHost = appConfig.domain; - services.cgit.default.repos = lib.mapAttrs - (name: attrs: { - desc = attrs.description; - path = "/var/lib/git/${name}"; - }) - appConfig.repositories; - services.cgit.default.settings = appConfig.settings; - - users.users.git.isSystemUser = true; - users.users.git.home = "/var/lib/git"; - users.users.git.group = "nogroup"; -} +lib.mkMerge [ + { + services.cgit.default.enable = true; + services.cgit.default.nginx.virtualHost = appConfig.domain; + # XXX https://github.com/NixOS/nixpkgs/issues/290524 + services.cgit.default.package = pkgs.symlinkJoin { + name = "cgit"; + paths = [ + pkgs.cgit + (pkgs.luajit.withPackages (luaPackages: [ luaPackages.luaossl ])) + (pkgs.runCommandLocal "cgit-lua-packages" { } '' + mkdir -p $out/cgit + ln -s ../lib $out/cgit/lib + ln -s ../share $out/cgit/share + '' + ) + ]; + }; + services.cgit.default.settings = appConfig.settings; + } + { + services.cgit.default.settings.about-filter = "${pkgs.cgit}/lib/cgit/filters/about-formatting.sh"; + services.cgit.default.settings.commit-filter = "${pkgs.cgit}/lib/cgit/filters/commit-links.sh"; + services.cgit.default.settings.email-filter = "lua:${pkgs.cgit}/lib/cgit/filters/email-libravatar.lua"; + services.cgit.default.settings.source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py"; + } + { + services.cgit.default.repos = lib.mapAttrs + (name: attrs: { + defbranch = "main"; + desc = attrs.description; + #owner = "aforemny"; + path = "/var/lib/git/${name}"; + readme = "main:README.md"; + }) + appConfig.repositories; + } + { + users.users.git.isSystemUser = true; + users.users.git.home = "/var/lib/git"; + users.users.git.group = "nogroup"; + } +] |