Skip to content

Commit

Permalink
git: switch to an SSH-based git server and cgit
Browse files Browse the repository at this point in the history
  • Loading branch information
wagdav committed Feb 12, 2024
1 parent fb865d7 commit f56d069
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 37 deletions.
60 changes: 24 additions & 36 deletions modules/git.nix
Original file line number Diff line number Diff line change
@@ -1,53 +1,41 @@
{ config, ... }:
{ config, pkgs, ... }:
let
user = "git";
group = "gitolite";
httpPort = 8022;

in
{
imports = [ ./consul-catalog.nix ];

services = {
gitolite = {
enable = true;
adminPubkey = builtins.head (import ./keys.nix).dwagner;

inherit user group;
};

gitweb = {
projectroot = "${config.services.gitolite.dataDir}/repositories";
};
users.users.git = {
isNormalUser = true;
shell = "${pkgs.git}/bin/git-shell";
openssh.authorizedKeys.keys = (import ./keys.nix).dwagner;
};

nginx = {
services = {
cgit.git = {
enable = true;

recommendedOptimisation = true;
recommendedGzipSettings = true;
recommendedProxySettings = true;

virtualHosts."_".listen = [
{
addr = "0.0.0.0";
port = httpPort;
}
{
addr = "[::]";
port = httpPort;
}
];

gitweb = {
enable = true;
inherit group;
location = "";
scanPath = "/srv/git";
settings = {
enable-git-config = true;
clone-url = "git@nuc:/srv/git/$CGIT_REPO_URL";
};
};

nginx.virtualHosts.git.listen = [
{
addr = "0.0.0.0";
port = httpPort;
}
{
addr = "[::]";
port = httpPort;
}
];

consul.catalog = [
{
name = "gitweb";
name = "cgit";
port = httpPort;
tags = (import ./lib/traefik.nix).tagsForHost "git";
}
Expand Down
2 changes: 1 addition & 1 deletion modules/grafana/dashboards/nixos.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"showLineNumbers": false,
"showMiniMap": false
},
"content": "* [Alertmanager](http://nuc:9093)\n* [Grafana](http://nuc:3000)\n* [Gitolite](http://nuc:8022)\n* [Node Exporter (nuc)](http://nuc:9100)\n* [Ntfy (nuc)](http://nuc:8080)\n* [Prometheus](http://nuc:9090)",
"content": "* [Alertmanager](http://nuc:9093)\n* [Grafana](http://nuc:3000)\n* [Git](http://nuc:8022)\n* [Node Exporter (nuc)](http://nuc:9100)\n* [Ntfy (nuc)](http://nuc:8080)\n* [Prometheus](http://nuc:9090)",
"mode": "markdown"
},
"pluginVersion": "9.4.9",
Expand Down

0 comments on commit f56d069

Please sign in to comment.