aboutsummaryrefslogtreecommitdiff
path: root/modules/cgit/default.nix
diff options
context:
space:
mode:
authoraethrvmn <me@aethrvmn.gr>2025-11-30 21:59:43 +0000
committeraethrvmn <me@aethrvmn.gr>2025-11-30 21:59:43 +0000
commit893ea11e1dc05fe1a2a34e66d4ebcfdffda34720 (patch)
treeef454e299f49cbb58e1b9fbafd0b759b4379ac2a /modules/cgit/default.nix
parentadded .lock to ignorelist (diff)
huge restructure of modules
Diffstat (limited to 'modules/cgit/default.nix')
-rw-r--r--modules/cgit/default.nix76
1 files changed, 76 insertions, 0 deletions
diff --git a/modules/cgit/default.nix b/modules/cgit/default.nix
new file mode 100644
index 0000000..08784fe
--- /dev/null
+++ b/modules/cgit/default.nix
@@ -0,0 +1,76 @@
+{ config, pkgs, lib, ... }:
+let
+ cgitWithAssets = pkgs.cgit.overrideAttrs (old: {
+ pname = "cgit-with-assets";
+
+ postInstall = (old.postInstall or "") + ''
+ # overwrite the stock files that the module aliases
+ install -Dm444 ${./static/cgit.css} $out/cgit/cgit.css
+ install -Dm444 ${./static/logo.png} $out/cgit/cgit.png # keep the name!
+ install -Dm444 ${./static/favicon.png} $out/cgit/favicon.ico
+ '';
+ });
+in {
+ services = {
+ cgit."code" = {
+ enable = true;
+ scanPath = "/srv/git";
+ package = cgitWithAssets;
+
+ settings = {
+ cache-size = 0;
+ cache-scanrc-ttl = 0;
+ enable-log-filecount = 1;
+ enable-log-linecount = 1;
+ enable-git-config = 1;
+
+ localtime = 1;
+
+ noplainemail = 1;
+
+ root-title = "code.aethrvmn.gr";
+ root-desc = "αpothēke of aethrvmn";
+ clone-url = "https://code.aethrvmn.gr/$CGIT_REPO_URL";
+
+ logo-link = "https://aethrvmn.gr/";
+
+ about-filter = "${pkgs.cgit}/lib/cgit/filters/about-formatting.sh";
+ source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py";
+ };
+
+ nginx.virtualHost = "code.internal";
+ };
+ };
+
+ users = {
+ groups.git = { };
+
+ users = {
+ git = {
+ isSystemUser = true;
+ description = "aethrvmn";
+ group = "git";
+ home = "/srv/git";
+ homeMode = "0755";
+ createHome = true;
+ shell = "${pkgs.git}/bin/git-shell";
+
+ openssh.authorizedKeys.keys = [
+ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFTRmMBlTFJbOWQBLI9XS2HMdUSlsAcaQ6vWjLpfweEo aethrvmn@apotheke.earth"
+ ];
+ };
+
+ cgit = {
+ isSystemUser = true;
+ extraGroups = [ "git" ];
+ };
+ };
+ };
+
+ systemd = {
+ tmpfiles.rules = [
+ # type path mode uid gid age target
+ "L /srv/git/static - git git - /home/aethrvmn/.nix/modules/server/cgit/static"
+ ];
+ };
+}
Directive (EU) 2019/790, Article 4(3); all rights regarding Text and Data Mining (TDM) are reserved.