1 # Sourcehut {#module-services-sourcehut}
3 [Sourcehut](https://sr.ht.com/) is an open-source,
4 self-hostable software development platform. The server setup can be automated using
5 [services.sourcehut](#opt-services.sourcehut.enable).
7 ## Basic usage {#module-services-sourcehut-basic-usage}
9 Sourcehut is a Python and Go based set of applications.
10 This NixOS module also provides basic configuration integrating Sourcehut into locally running
11 `services.nginx`, `services.redis.servers.sourcehut`, `services.postfix`
12 and `services.postgresql` services.
14 A very basic configuration may look like this:
20 join = hostName: domain: hostName + optionalString (domain != null) ".${domain}";
21 in join config.networking.hostName config.networking.domain;
27 firewall.allowedTCPPorts = [ 22 80 443 ];
30 services.sourcehut = {
36 postfix.enable = true;
37 postgresql.enable = true;
41 environment = "production";
43 origin = "https://${fqdn}";
44 # Produce keys with srht-keygen from sourcehut.coresrht.
45 network-key = "/run/keys/path/to/network-key";
46 service-key = "/run/keys/path/to/service-key";
48 webhooks.private-key= "/run/keys/path/to/webhook-key";
52 security.acme.certs."${fqdn}".extraDomainNames = [
60 # only recommendedProxySettings are strictly required, but the rest make sense as well.
61 recommendedTlsSettings = true;
62 recommendedOptimisation = true;
63 recommendedGzipSettings = true;
64 recommendedProxySettings = true;
66 # Settings to setup what certificates are used for which endpoint.
68 "${fqdn}".enableACME = true;
69 "meta.${fqdn}".useACMEHost = fqdn;
70 "man.${fqdn}".useACMEHost = fqdn;
71 "git.${fqdn}".useACMEHost = fqdn;
77 The `hostName` option is used internally to configure the nginx
78 reverse-proxy. The `settings` attribute set is
79 used by the configuration generator and the result is placed in `/etc/sr.ht/config.ini`.
81 ## Configuration {#module-services-sourcehut-configuration}
83 All configuration parameters are also stored in
84 `/etc/sr.ht/config.ini` which is generated by
85 the module and linked from the store to ensure that all values from `config.ini`
86 can be modified by the module.
88 ## Using an alternative webserver as reverse-proxy (e.g. `httpd`) {#module-services-sourcehut-httpd}
90 By default, `nginx` is used as reverse-proxy for `sourcehut`.
91 However, it's possible to use e.g. `httpd` by explicitly disabling
92 `nginx` using [](#opt-services.nginx.enable) and fixing the