upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/nix/example-configuration.nix
blob: a00d9701f61f9f52e37feaab80609208251b3203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Example NixOS configuration using ngit-grasp module
# 
# Usage:
#   1. Add to your server's flake.nix inputs:
#      inputs.ngit-grasp.url = "github:DanConwayDev/ngit-grasp";
#
#   2. Import the module in your configuration:
#      imports = [ inputs.ngit-grasp.nixosModules.default ];
#
#   3. Configure the service (example below)

{ inputs, ... }:

{
  imports = [ inputs.ngit-grasp.nixosModules.default ];

  services.ngit-grasp = {
    enable = true;
    domain = "ngit.danconwaydev.com";
    
    # Network
    bindAddress = "127.0.0.1";
    port = 8082;  # Same port as current ngit-relay for Caddy compatibility
    
    # Storage (reuse existing persistent path pattern)
    dataDir = "/persistent/ngit-danconwaydev-com-ngit-grasp";
    
    # Identity
    relayName = "DanConwayDev's ngit-grasp";
    relayDescription = "personal instance of ngit-grasp, a Rust GRASP implementation with proactive sync";
    
    # Option 1: Use nsec file (recommended - more secure)
    relayOwnerNsecFile = "/persistent/ngit-danconwaydev-com-ngit-grasp/relay-owner.nsec";
    
    # Option 2: Inline nsec (less secure, ends up in nix store)
    # relayOwnerNsec = "nsec1...";
    
    # Option 3: Auto-generate (default if neither above is set)
    # ngit-grasp will create .relay-owner.nsec in dataDir automatically
    
    # Sync
    syncBootstrapRelayUrl = "wss://relay.ngit.dev";
    
    # Metrics
    metricsEnabled = true;
    
    # Logging
    logLevel = "info";  # Options: trace, debug, info, warn, error
  };

  # Caddy reverse proxy (unchanged from current setup)
  services.caddy.virtualHosts."ngit.danconwaydev.com" = {
    extraConfig = ''
      reverse_proxy 127.0.0.1:8082 {
        header_down X-Real-IP {http.request.remote}
        header_down X-Forwarded-For {http.request.remote}
      }
    '';
  };
}