aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-06-13 16:27:15 +0530
committerAkshay Nair <phenax5@gmail.com>2025-06-13 16:27:15 +0530
commit60e26854dac063f0732f44babb3c7d3dbf7888a0 (patch)
treeba19e14d142a06e7cec3abdb377a986214e290c4
parentbe1266cb5fd7a5a65a47a2238ba23447b6062c2d (diff)
downloadhomeserver-nixos-config-60e26854dac063f0732f44babb3c7d3dbf7888a0.tar.gz
homeserver-nixos-config-60e26854dac063f0732f44babb3c7d3dbf7888a0.zip
Add git + gitweb integration
-rw-r--r--modules/network/default.nix1
-rw-r--r--modules/network/service-router.service.nix4
-rw-r--r--modules/storage/default.nix1
-rw-r--r--modules/storage/git.nix41
-rw-r--r--settings.nix5
5 files changed, 51 insertions, 1 deletions
diff --git a/modules/network/default.nix b/modules/network/default.nix
index 6a40ef7..53e64b0 100644
--- a/modules/network/default.nix
+++ b/modules/network/default.nix
@@ -20,6 +20,7 @@ in
"jellyfin.local" = { inherit host; port = ports.jellyfin; };
"syncthing.local" = { inherit host; port = ports.syncthing; };
"lidarr.local" = { inherit host; port = ports.lidarr; };
+ "git.local" = { inherit host; port = 80; basePath = "/gitweb/"; };
};
};
diff --git a/modules/network/service-router.service.nix b/modules/network/service-router.service.nix
index 9c4e6e2..3d0b6e7 100644
--- a/modules/network/service-router.service.nix
+++ b/modules/network/service-router.service.nix
@@ -19,6 +19,7 @@ in {
port = mkOption { type = types.int; };
host = mkOption { type = types.str; default = "127.0.0.1"; };
protocol = mkOption { type = types.str; default = "http"; };
+ basePath = mkOption { type = types.str; default = ""; };
nginx = mkOption { type = types.attrs; default = {}; };
}; });
default = {};
@@ -31,7 +32,8 @@ in {
recommendedOptimisation = true;
virtualHosts = lib.mapAttrs (_: val: {
locations."/" = if val.nginx == {} then {
- proxyPass = "${val.protocol}://${val.host}:${toString val.port}";
+ proxyPass =
+ "${val.protocol}://${val.host}:${toString val.port}${val.basePath}";
proxyWebsockets = true;
} else val.nginx;
}) cfg.routes;
diff --git a/modules/storage/default.nix b/modules/storage/default.nix
index 22bd2ff..b5cb2b2 100644
--- a/modules/storage/default.nix
+++ b/modules/storage/default.nix
@@ -2,5 +2,6 @@
{
imports = [
./syncthing.nix
+ ./git.nix
];
}
diff --git a/modules/storage/git.nix b/modules/storage/git.nix
new file mode 100644
index 0000000..c9d447e
--- /dev/null
+++ b/modules/storage/git.nix
@@ -0,0 +1,41 @@
+{ lib, ... }:
+let
+ settings = import ../../settings.nix { inherit lib; };
+in
+{
+ systemd.tmpfiles.rules = [
+ "d ${settings.git.baseDir} 0770 - ${settings.git.group} - -"
+ ];
+ users.groups.${settings.git.group} = { };
+ users.users.bacchus.extraGroups = [ settings.git.group ];
+
+ programs.git = {
+ enable = true;
+ config = {
+ init = {
+ defaultBranch = "main";
+ };
+ color.ui = true;
+ pull.rebase = true;
+ rebase.autosquash = true;
+ user = {
+ email = "phenax5@gmail.com";
+ name = "Akshay Nair";
+ };
+ };
+ };
+
+ services.gitweb = {
+ gitwebTheme = true;
+ projectroot = settings.git.baseDir;
+ };
+
+ services.nginx = {
+ enable = true;
+ gitweb = {
+ enable = true;
+ group = settings.git.group;
+ virtualHost = "_";
+ };
+ };
+}
diff --git a/settings.nix b/settings.nix
index f6c717b..f1b7ebb 100644
--- a/settings.nix
+++ b/settings.nix
@@ -17,6 +17,11 @@ in lib.recursiveUpdate privateSettings rec {
exposeTransmissionRPC = false;
};
+ git = {
+ baseDir = "/git";
+ group = "git";
+ };
+
syncthing = {
baseDir = "/media/syncthing";
photosDir = "${syncthing.baseDir}/photos";