From 8b628ed61020060f953769b2624ed04cc57db9a9 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 13 Jun 2024 15:22:54 +0200 Subject: refactor(modules): Ensure strict coherence to patterns --- modules/nixos/vhack/default.nix | 2 +- modules/nixos/vhack/git-server.nix | 40 -------------------------- modules/nixos/vhack/git-server/default.nix | 46 ++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 41 deletions(-) delete mode 100644 modules/nixos/vhack/git-server.nix create mode 100644 modules/nixos/vhack/git-server/default.nix (limited to 'modules') diff --git a/modules/nixos/vhack/default.nix b/modules/nixos/vhack/default.nix index 9f717c2..b6abcc1 100644 --- a/modules/nixos/vhack/default.nix +++ b/modules/nixos/vhack/default.nix @@ -1,5 +1,5 @@ {...}: { imports = [ - ./git-server.nix + ./git-server ]; } diff --git a/modules/nixos/vhack/git-server.nix b/modules/nixos/vhack/git-server.nix deleted file mode 100644 index bcc049a..0000000 --- a/modules/nixos/vhack/git-server.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - cfg = config.vhack.git-server; -in { - options.vhack.git-server.enable = lib.mkEnableOption "a lightweight git-server, - realised with cgit and gitolite."; - config = lib.mkIf cfg.enable { - services = { - gitolite = { - enable = true; - adminPubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAe4o1PM6VasT3KZNl5NYvgkkBrPOg36dqsywd10FztS openpgp:0x21D20D6A"; - dataDir = "/srv/gitolite"; - user = "git"; - group = "git"; - extraGitoliteRc = '' - $RC{UMASK} = 0027; # Enable group access, important for cgit. - ''; - }; - cgit."git.vhack.eu" = { - enable = true; - package = pkgs.cgit-pink; - scanPath = "${config.services.gitolite.dataDir}/repositories"; - settings = { - enable-http-clone = true; - section-from-path = true; - project-list = "${config.services.gitolite.dataDir}/projects.list"; - source-filter = "${config.services.cgit."git.vhack.eu".package}/lib/cgit/filters/syntax-highlighting.py"; - }; - }; - nginx.virtualHosts."git.vhack.eu" = { - enableACME = true; - forceSSL = true; - }; - }; - }; -} diff --git a/modules/nixos/vhack/git-server/default.nix b/modules/nixos/vhack/git-server/default.nix new file mode 100644 index 0000000..550bc90 --- /dev/null +++ b/modules/nixos/vhack/git-server/default.nix @@ -0,0 +1,46 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.vhack.git-server; +in { + options.vhack.git-server = { + enable = lib.mkEnableOption '' + a lightweight git-server, realised with cgit and gitolite. + ''; + }; + + config = lib.mkIf cfg.enable { + services = { + gitolite = { + enable = true; + adminPubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAe4o1PM6VasT3KZNl5NYvgkkBrPOg36dqsywd10FztS openpgp:0x21D20D6A"; + dataDir = "/srv/gitolite"; + user = "git"; + group = "git"; + extraGitoliteRc = '' + $RC{UMASK} = 0027; # Enable group access, important for cgit. + ''; + }; + + cgit."git.vhack.eu" = { + enable = true; + package = pkgs.cgit-pink; + scanPath = "${config.services.gitolite.dataDir}/repositories"; + settings = { + enable-http-clone = true; + section-from-path = true; + project-list = "${config.services.gitolite.dataDir}/projects.list"; + source-filter = "${config.services.cgit."git.vhack.eu".package}/lib/cgit/filters/syntax-highlighting.py"; + }; + }; + + nginx.virtualHosts."git.vhack.eu" = { + enableACME = true; + forceSSL = true; + }; + }; + }; +} -- cgit 1.4.1