]> Untitled Git - awful.systems.git/blob - git/default.nix
docs: add database information
[awful.systems.git] / git / default.nix
1 { config, lib, pkgs, ... }:
2
3 let
4   new-repo = pkgs.writeShellScriptBin "new-repo" ''
5     mkdir -p ${config.users.extraUsers.git.home}/repos/''${1}.git
6     ${pkgs.git}/bin/git init --bare ${config.users.extraUsers.git.home}/repos/''${1}.git/
7     chown -R git:git ${config.users.extraUsers.git.home}/repos
8   '';
9 in {
10   imports = [ ../secrets/keys/git.nix ];
11
12   users.extraUsers.git = {
13     uid = config.ids.uids.git;
14     isSystemUser = true;
15     home = "/home/git";
16     createHome = true;
17     group = "git";
18     homeMode = "770";
19     shell = "${pkgs.git}/bin/git-shell";
20   };
21
22   users.extraGroups.git = { gid = config.ids.gids.git; };
23
24   services.nginx.gitweb = {
25     enable = true;
26     location = "/git";
27     group = "git";
28     #virtualHost = "awful.systems these.awful.systems these";
29   };
30
31   services.gitweb = {
32     gitwebTheme = true;
33     projectroot = "/home/git/repos";
34   };
35
36   services.gitDaemon = {
37     enable = true;
38     user = "git";
39     group = "git";
40     basePath = "/home/git/repos";
41     exportAll = true;
42     repositories = [ "/home/git/repos" ];
43   };
44
45   environment.systemPackages = [ new-repo ];
46
47   networking.firewall.allowedTCPPorts = [ 9418 ];
48 }