aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/git/default.nix7
-rwxr-xr-xmodules/git/git-shell-commands/desc6
-rwxr-xr-xmodules/git/git-shell-commands/help11
-rwxr-xr-xmodules/git/git-shell-commands/init9
-rwxr-xr-xmodules/git/git-shell-commands/owner6
-rwxr-xr-xmodules/git/git-shell-commands/section6
6 files changed, 45 insertions, 0 deletions
diff --git a/modules/git/default.nix b/modules/git/default.nix
index 465d859..e30e529 100644
--- a/modules/git/default.nix
+++ b/modules/git/default.nix
@@ -33,6 +33,7 @@
max-repodesc-length = 120;
clone-url = "https://$HTTP_HOST/$CGIT_REPO_URL";
+ readme = "README.adoc";
source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py";
# about-filter = "${pkgs.asciidoctor}"
@@ -65,6 +66,12 @@
};
};
+ system.activationScripts.setup-git-shell-commands.text = ''
+ if [[ ! -h "/var/lib/git/git-shell-commands" ]]; then
+ ln -s "${./git-shell-commands}" "/var/lib/git/git-shell-commands"
+ fi
+ '';
+
services.nginx.virtualHosts = {
"git.audron.dev" = {
forceSSL = true;
diff --git a/modules/git/git-shell-commands/desc b/modules/git/git-shell-commands/desc
new file mode 100755
index 0000000..52cc8bb
--- /dev/null
+++ b/modules/git/git-shell-commands/desc
@@ -0,0 +1,6 @@
+#!/usr/bin/env sh
+
+if [ -f "$1/config" ]; then
+ cd "$1"
+ git config cgit.desc "$2"
+fi
diff --git a/modules/git/git-shell-commands/help b/modules/git/git-shell-commands/help
new file mode 100755
index 0000000..7572fe4
--- /dev/null
+++ b/modules/git/git-shell-commands/help
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+
+echo "Commands:"
+echo " init <repo>"
+echo " Initialize a new bare repo, default branch is main"
+echo " desc <repo> <desc>"
+echo " Set repo description"
+echo " owner <repo> <owner>"
+echo " Set repo owner"
+echo " section <repo> <section>"
+echo " Set repo section"
diff --git a/modules/git/git-shell-commands/init b/modules/git/git-shell-commands/init
new file mode 100755
index 0000000..603b817
--- /dev/null
+++ b/modules/git/git-shell-commands/init
@@ -0,0 +1,9 @@
+#!/usr/bin/env sh
+
+REPO="$1"
+
+if [ ! -f "$REPO/config" ]; then
+ mkdir -p "$REPO"
+ cd "$REPO"
+ git init --bare --shared
+fi
diff --git a/modules/git/git-shell-commands/owner b/modules/git/git-shell-commands/owner
new file mode 100755
index 0000000..d65fd02
--- /dev/null
+++ b/modules/git/git-shell-commands/owner
@@ -0,0 +1,6 @@
+#!/usr/bin/env sh
+
+if [ -f "$1/config" ]; then
+ cd "$1"
+ git config cgit.owner "$2"
+fi
diff --git a/modules/git/git-shell-commands/section b/modules/git/git-shell-commands/section
new file mode 100755
index 0000000..b1a998e
--- /dev/null
+++ b/modules/git/git-shell-commands/section
@@ -0,0 +1,6 @@
+#!/usr/bin/env sh
+
+if [ -f "$1/config" ]; then
+ cd "$1"
+ git config cgit.section "$2"
+fi