summaryrefslogtreecommitdiff
path: root/configuration/snorlax/git.nix
diff options
context:
space:
mode:
authorJasper Ras <jaspert.ras@gmail.com>2025-02-08 19:47:15 +0100
committerJasper Ras <jaspert.ras@gmail.com>2025-02-08 19:48:50 +0100
commit4564b73de139a54c98f5a46c817485374de46e7e (patch)
tree20d4f942087e9643d2d71a259a3ab210ff87be5a /configuration/snorlax/git.nix
parentd46dab2a072e89f3663967b902e8b1b4e5fc5443 (diff)
Declaratively create git repos
Diffstat (limited to 'configuration/snorlax/git.nix')
-rw-r--r--configuration/snorlax/git.nix50
1 files changed, 47 insertions, 3 deletions
diff --git a/configuration/snorlax/git.nix b/configuration/snorlax/git.nix
index 4b200c5..7a696fe 100644
--- a/configuration/snorlax/git.nix
+++ b/configuration/snorlax/git.nix
@@ -1,20 +1,64 @@
-{ pkgs, ... }:
+{ lib, pkgs, ... }:
let
home = "/var/lib/git";
+ repos = {
+ nixos = {
+ path = "${home}/nixos.git";
+ desc = "My NixOS Configurations";
+ owner = "jras";
+ };
+
+ notes = {
+ path = "${home}/notes.git";
+ desc = "My notes";
+ owner = "jras";
+ };
+
+ obsidian-wavez-theme = {
+ path = "${home}/obsidian-wavez-theme.git";
+ desc = "The bordeaux theme for Obsidian";
+ owner = "jras";
+ };
+
+ astal-bar = {
+ path = "${home}/astal-bar.git";
+ desc = "A wayland bar in jsx";
+ owner = "jras";
+ };
+ };
+
+ startScript = pkgs.writeShellScript "init-git-repos" ''
+ ${lib.concatMapStrings ({ path, ... }: "${pkgs.git}/bin/git init --bare --shared ${path} && cd ${path} && ${pkgs.git}/bin/git branch -m main \n") (builtins.attrValues repos)}
+ '';
in
{
networking.firewall.allowedTCPPorts = [ 80 ];
- services.cgit.jap56 = {
+ services.cgit.snorlax = {
enable = true;
group = "git";
- scanPath = "${home}";
+ repos = repos;
+ };
+
+ systemd.services.init-repos = {
+ description = "Initialize git repositories";
+ wantedBy = [ "multi-user.target" ];
+ restartTriggers = [ startScript ];
+
+ serviceConfig = {
+ Type = "oneshot";
+ User = "git";
+ Group = "git";
+ ExecStart = startScript;
+ };
};
users.groups.git = {};
users.users.git = {
isNormalUser = true;
home = "${home}";
+ homeMode = "0750";
+ createHome = true;
shell = pkgs.zsh;
group = "git";
hashedPassword = "$6$Rc//lmBr5orYHn.0$M9y3Zj4zCe723r8hYGIhPC5kPv5SVGHjF1FsjrT9IIx7trxuNTLtLDQVL9lhmR5/7bFMUFEf0CMx9w7.vgXgY0";