nixos/sourcehut: convert manual chapter to MD
This commit is contained in:
parent
73d8b04f30
commit
0cc9d6cf5d
|
@ -1390,6 +1390,8 @@ in
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Don't edit the docbook xml directly, edit the md and generate it:
|
||||||
|
# `pandoc sourcehut.md -t docbook --top-level-division=chapter --extract-media=media -f markdown-smart --lua-filter ../../../../../doc/build-aux/pandoc-filters/myst-reader/roles.lua --lua-filter ../../../../../doc/build-aux/pandoc-filters/docbook-writer/rst-roles.lua > sourcehut.xml`
|
||||||
meta.doc = ./sourcehut.xml;
|
meta.doc = ./sourcehut.xml;
|
||||||
meta.maintainers = with maintainers; [ tomberek ];
|
meta.maintainers = with maintainers; [ tomberek ];
|
||||||
}
|
}
|
||||||
|
|
93
nixos/modules/services/misc/sourcehut/sourcehut.md
Normal file
93
nixos/modules/services/misc/sourcehut/sourcehut.md
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
# Sourcehut {#module-services-sourcehut}
|
||||||
|
|
||||||
|
[Sourcehut](https://sr.ht.com/) is an open-source,
|
||||||
|
self-hostable software development platform. The server setup can be automated using
|
||||||
|
[services.sourcehut](#opt-services.sourcehut.enable).
|
||||||
|
|
||||||
|
## Basic usage {#module-services-sourcehut-basic-usage}
|
||||||
|
|
||||||
|
Sourcehut is a Python and Go based set of applications.
|
||||||
|
This NixOS module also provides basic configuration integrating Sourcehut into locally running
|
||||||
|
`services.nginx`, `services.redis.servers.sourcehut`, `services.postfix`
|
||||||
|
and `services.postgresql` services.
|
||||||
|
|
||||||
|
A very basic configuration may look like this:
|
||||||
|
```
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
fqdn =
|
||||||
|
let
|
||||||
|
join = hostName: domain: hostName + optionalString (domain != null) ".${domain}";
|
||||||
|
in join config.networking.hostName config.networking.domain;
|
||||||
|
in {
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
hostName = "srht";
|
||||||
|
domain = "tld";
|
||||||
|
firewall.allowedTCPPorts = [ 22 80 443 ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.sourcehut = {
|
||||||
|
enable = true;
|
||||||
|
git.enable = true;
|
||||||
|
man.enable = true;
|
||||||
|
meta.enable = true;
|
||||||
|
nginx.enable = true;
|
||||||
|
postfix.enable = true;
|
||||||
|
postgresql.enable = true;
|
||||||
|
redis.enable = true;
|
||||||
|
settings = {
|
||||||
|
"sr.ht" = {
|
||||||
|
environment = "production";
|
||||||
|
global-domain = fqdn;
|
||||||
|
origin = "https://${fqdn}";
|
||||||
|
# Produce keys with srht-keygen from sourcehut.coresrht.
|
||||||
|
network-key = "/run/keys/path/to/network-key";
|
||||||
|
service-key = "/run/keys/path/to/service-key";
|
||||||
|
};
|
||||||
|
webhooks.private-key= "/run/keys/path/to/webhook-key";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
security.acme.certs."${fqdn}".extraDomainNames = [
|
||||||
|
"meta.${fqdn}"
|
||||||
|
"man.${fqdn}"
|
||||||
|
"git.${fqdn}"
|
||||||
|
];
|
||||||
|
|
||||||
|
services.nginx = {
|
||||||
|
enable = true;
|
||||||
|
# only recommendedProxySettings are strictly required, but the rest make sense as well.
|
||||||
|
recommendedTlsSettings = true;
|
||||||
|
recommendedOptimisation = true;
|
||||||
|
recommendedGzipSettings = true;
|
||||||
|
recommendedProxySettings = true;
|
||||||
|
|
||||||
|
# Settings to setup what certificates are used for which endpoint.
|
||||||
|
virtualHosts = {
|
||||||
|
"${fqdn}".enableACME = true;
|
||||||
|
"meta.${fqdn}".useACMEHost = fqdn:
|
||||||
|
"man.${fqdn}".useACMEHost = fqdn:
|
||||||
|
"git.${fqdn}".useACMEHost = fqdn:
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The `hostName` option is used internally to configure the nginx
|
||||||
|
reverse-proxy. The `settings` attribute set is
|
||||||
|
used by the configuration generator and the result is placed in `/etc/sr.ht/config.ini`.
|
||||||
|
|
||||||
|
## Configuration {#module-services-sourcehut-configuration}
|
||||||
|
|
||||||
|
All configuration parameters are also stored in
|
||||||
|
`/etc/sr.ht/config.ini` which is generated by
|
||||||
|
the module and linked from the store to ensure that all values from `config.ini`
|
||||||
|
can be modified by the module.
|
||||||
|
|
||||||
|
## Using an alternative webserver as reverse-proxy (e.g. `httpd`) {#module-services-sourcehut-httpd}
|
||||||
|
|
||||||
|
By default, `nginx` is used as reverse-proxy for `sourcehut`.
|
||||||
|
However, it's possible to use e.g. `httpd` by explicitly disabling
|
||||||
|
`nginx` using [](#opt-services.nginx.enable) and fixing the
|
||||||
|
`settings`.
|
|
@ -1,41 +1,36 @@
|
||||||
<chapter xmlns="http://docbook.org/ns/docbook"
|
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="module-services-sourcehut">
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
<title>Sourcehut</title>
|
||||||
xmlns:xi="http://www.w3.org/2001/XInclude"
|
|
||||||
version="5.0"
|
|
||||||
xml:id="module-services-sourcehut">
|
|
||||||
<title>Sourcehut</title>
|
|
||||||
<para>
|
|
||||||
<link xlink:href="https://sr.ht.com/">Sourcehut</link> is an open-source,
|
|
||||||
self-hostable software development platform. The server setup can be automated using
|
|
||||||
<link linkend="opt-services.sourcehut.enable">services.sourcehut</link>.
|
|
||||||
</para>
|
|
||||||
|
|
||||||
<section xml:id="module-services-sourcehut-basic-usage">
|
|
||||||
<title>Basic usage</title>
|
|
||||||
<para>
|
<para>
|
||||||
Sourcehut is a Python and Go based set of applications.
|
<link xlink:href="https://sr.ht.com/">Sourcehut</link> is an
|
||||||
This NixOS module also provides basic configuration integrating Sourcehut into locally running
|
open-source, self-hostable software development platform. The server
|
||||||
<literal>services.nginx</literal>,
|
setup can be automated using
|
||||||
<literal>services.redis.servers.sourcehut</literal>,
|
<link linkend="opt-services.sourcehut.enable">services.sourcehut</link>.
|
||||||
<literal>services.postfix</literal>
|
|
||||||
and
|
|
||||||
<literal>services.postgresql</literal> services.
|
|
||||||
</para>
|
</para>
|
||||||
|
<section xml:id="module-services-sourcehut-basic-usage">
|
||||||
<para>
|
<title>Basic usage</title>
|
||||||
A very basic configuration may look like this:
|
<para>
|
||||||
<programlisting>
|
Sourcehut is a Python and Go based set of applications. This NixOS
|
||||||
|
module also provides basic configuration integrating Sourcehut
|
||||||
|
into locally running <literal>services.nginx</literal>,
|
||||||
|
<literal>services.redis.servers.sourcehut</literal>,
|
||||||
|
<literal>services.postfix</literal> and
|
||||||
|
<literal>services.postgresql</literal> services.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
A very basic configuration may look like this:
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
let
|
let
|
||||||
fqdn =
|
fqdn =
|
||||||
let
|
let
|
||||||
join = hostName: domain: hostName + optionalString (domain != null) ".${domain}";
|
join = hostName: domain: hostName + optionalString (domain != null) ".${domain}";
|
||||||
in join config.networking.hostName config.networking.domain;
|
in join config.networking.hostName config.networking.domain;
|
||||||
in {
|
in {
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "srht";
|
hostName = "srht";
|
||||||
domain = "tld";
|
domain = "tld";
|
||||||
firewall.allowedTCPPorts = [ 22 80 443 ];
|
firewall.allowedTCPPorts = [ 22 80 443 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,22 +44,22 @@ in {
|
||||||
postgresql.enable = true;
|
postgresql.enable = true;
|
||||||
redis.enable = true;
|
redis.enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
"sr.ht" = {
|
"sr.ht" = {
|
||||||
environment = "production";
|
environment = "production";
|
||||||
global-domain = fqdn;
|
global-domain = fqdn;
|
||||||
origin = "https://${fqdn}";
|
origin = "https://${fqdn}";
|
||||||
# Produce keys with srht-keygen from sourcehut.coresrht.
|
# Produce keys with srht-keygen from sourcehut.coresrht.
|
||||||
network-key = "/run/keys/path/to/network-key";
|
network-key = "/run/keys/path/to/network-key";
|
||||||
service-key = "/run/keys/path/to/service-key";
|
service-key = "/run/keys/path/to/service-key";
|
||||||
};
|
};
|
||||||
webhooks.private-key= "/run/keys/path/to/webhook-key";
|
webhooks.private-key= "/run/keys/path/to/webhook-key";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
security.acme.certs."${fqdn}".extraDomainNames = [
|
security.acme.certs."${fqdn}".extraDomainNames = [
|
||||||
"meta.${fqdn}"
|
"meta.${fqdn}"
|
||||||
"man.${fqdn}"
|
"man.${fqdn}"
|
||||||
"git.${fqdn}"
|
"git.${fqdn}"
|
||||||
];
|
];
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx = {
|
||||||
|
@ -77,43 +72,40 @@ in {
|
||||||
|
|
||||||
# Settings to setup what certificates are used for which endpoint.
|
# Settings to setup what certificates are used for which endpoint.
|
||||||
virtualHosts = {
|
virtualHosts = {
|
||||||
"${fqdn}".enableACME = true;
|
"${fqdn}".enableACME = true;
|
||||||
"meta.${fqdn}".useACMEHost = fqdn:
|
"meta.${fqdn}".useACMEHost = fqdn:
|
||||||
"man.${fqdn}".useACMEHost = fqdn:
|
"man.${fqdn}".useACMEHost = fqdn:
|
||||||
"git.${fqdn}".useACMEHost = fqdn:
|
"git.${fqdn}".useACMEHost = fqdn:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
<para>
|
||||||
|
The <literal>hostName</literal> option is used internally to
|
||||||
<para>
|
configure the nginx reverse-proxy. The <literal>settings</literal>
|
||||||
The <literal>hostName</literal> option is used internally to configure the nginx
|
attribute set is used by the configuration generator and the
|
||||||
reverse-proxy. The <literal>settings</literal> attribute set is
|
result is placed in <literal>/etc/sr.ht/config.ini</literal>.
|
||||||
used by the configuration generator and the result is placed in <literal>/etc/sr.ht/config.ini</literal>.
|
</para>
|
||||||
</para>
|
</section>
|
||||||
</section>
|
<section xml:id="module-services-sourcehut-configuration">
|
||||||
|
<title>Configuration</title>
|
||||||
<section xml:id="module-services-sourcehut-configuration">
|
<para>
|
||||||
<title>Configuration</title>
|
All configuration parameters are also stored in
|
||||||
|
<literal>/etc/sr.ht/config.ini</literal> which is generated by the
|
||||||
<para>
|
module and linked from the store to ensure that all values from
|
||||||
All configuration parameters are also stored in
|
<literal>config.ini</literal> can be modified by the module.
|
||||||
<literal>/etc/sr.ht/config.ini</literal> which is generated by
|
</para>
|
||||||
the module and linked from the store to ensure that all values from <literal>config.ini</literal>
|
</section>
|
||||||
can be modified by the module.
|
<section xml:id="module-services-sourcehut-httpd">
|
||||||
</para>
|
<title>Using an alternative webserver as reverse-proxy (e.g.
|
||||||
|
<literal>httpd</literal>)</title>
|
||||||
</section>
|
<para>
|
||||||
|
By default, <literal>nginx</literal> is used as reverse-proxy for
|
||||||
<section xml:id="module-services-sourcehut-httpd">
|
<literal>sourcehut</literal>. However, it's possible to use e.g.
|
||||||
<title>Using an alternative webserver as reverse-proxy (e.g. <literal>httpd</literal>)</title>
|
<literal>httpd</literal> by explicitly disabling
|
||||||
<para>
|
<literal>nginx</literal> using
|
||||||
By default, <literal>nginx</literal> is used as reverse-proxy for <literal>sourcehut</literal>.
|
<xref linkend="opt-services.nginx.enable"></xref> and fixing the
|
||||||
However, it's possible to use e.g. <literal>httpd</literal> by explicitly disabling
|
<literal>settings</literal>.
|
||||||
<literal>nginx</literal> using <xref linkend="opt-services.nginx.enable" /> and fixing the
|
</para>
|
||||||
<literal>settings</literal>.
|
</section>
|
||||||
</para>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
Loading…
Reference in a new issue