My Server Setup with NixOS

This little server here runs gemserv on a NixOS machine. I'm far from an expert NixOS user and often resort to searching the web when trying to achieve some goals. Hence, the solution below might be far from optimal. I hope it's nevertheless useful for some. Since most gemini software is developing quite rapidly right now, I don't see much value in upstreaming this into nixpkgs.

The Gemserv Server

The Configuration

In my configuration.nix I have a custom expression for gemserv, a systemd service configuration, an acme configuration to get the certificates, and a `pkgs.writeText` call to generate the configuration. The relevant parts are:

The variable `gemserv_conf` is defined in the `let ... in` block ontop of the `configuration.nix` file.

The gemserv Expression

In the `let` block at the top of my `configuration.nix` file I have the

following expression:

then I just added gemserv in the `systemPackages` list.

This uses the `buildRustPackage` builder and seems to work well. The gemserv git repository does not contain a `Cargo.lock` file. I had to create a patch to add this. To do so run `cargo update`, commit the file, and then run

The resulting file must be in the same directory as the `configuration.nix` file.

Proxied content from gemini://otrn.org/updates/2020-06-04-gemserv.gmi (external content)

Gemini request details:

Original URL
gemini://otrn.org/updates/2020-06-04-gemserv.gmi
Status code
Success
Meta
text/gemini
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.