forked from
whitequark.org/git-pages
fork of whitequark.org/git-pages with mods for tangled
1{
2 nixpkgs,
3 system,
4 hostSystem,
5 self,
6}:
7nixpkgs.lib.nixosSystem {
8 inherit system;
9 modules = [
10 self.nixosModules.default
11 (
12 {
13 lib,
14 config,
15 pkgs,
16 ...
17 }:
18 {
19 virtualisation.vmVariant.virtualisation = {
20 host.pkgs = import nixpkgs { system = hostSystem; };
21
22 graphics = false;
23 memorySize = 2048;
24 diskSize = 10 * 1024;
25 cores = 2;
26 forwardPorts = [
27 # ssh
28 {
29 from = "host";
30 host.port = 2222;
31 guest.port = 22;
32 }
33 # git-pages main server
34 {
35 from = "host";
36 host.port = 3000;
37 guest.port = 3000;
38 }
39 # git-pages caddy integration
40 {
41 from = "host";
42 host.port = 3001;
43 guest.port = 3001;
44 }
45 # git-pages metrics
46 {
47 from = "host";
48 host.port = 3002;
49 guest.port = 3002;
50 }
51 ];
52 };
53
54 networking.firewall.enable = false;
55 time.timeZone = "Europe/London";
56 services.getty.autologinUser = "root";
57 environment.systemPackages = with pkgs; [
58 curl
59 vim
60 git
61 htop
62 ];
63
64 services.git-pages = {
65 enable = true;
66 dataDir = "/var/lib/git-pages";
67 configFile = ''
68 [server]
69 pages = "tcp/0.0.0.0:3000"
70 caddy = "tcp/0.0.0.0:3001"
71 metrics = "tcp/0.0.0.0:3002"
72
73 [storage]
74 type = "fs"
75
76 [storage.fs]
77 root = "/var/lib/git-pages/data"
78
79 # Example wildcard configuration for development
80 [[wildcard]]
81 domain = "*.localhost"
82 clone-url = "https://github.com/{domain}.git"
83 authorization = ""
84 '';
85 };
86
87 users = {
88 users.${config.services.git-pages.user}.uid = 777;
89 groups.${config.services.git-pages.group}.gid = 777;
90 };
91 }
92 )
93 ];
94}