neosam's dev blog

Warning: This content is outdated.

Host rusty-blog with NixOS

It's very simple to deploy rusty-blog with NixOS. All you need is a hoster which allows you to boot from a NixOS ISO image so you can run the installer. Since rusty-blog is not part of NixOS, an extension must be installed. Lets rock!

1. CD into your NixOS configuration page

If you run it from an image, you are about to install NixOS on your system and the system is mounted under /mnt:

cd /mnt/etc/nixos/

If you are already on an installed system

cd /etc/nixos/

2. Get the latest NixOS package


Check rusty blog releases for specific versions:

3. Extract the files

tar xvzf rusty-blog-nixos-overlay-0.0.2.tgz

4. Include rusty-blog in the nix configuration

Add ./rusty-blog under imports so it look like this:

   imports = 

5. Enable and configure rusty-blog in the configuration

Add these lines to configuration.nix

    # Enable rusty blog
    services.rusty-blog.enable = true;
    # Content of the blog.  An example is here:
    services.rusty-blog.documentRoot = "/path/to/the/rustyblog/document/root";

    # The root URL of the blog
    services.rusty-blog.context = "";

    # Use a custom user without 'wheel' permission
    services.rusty-blog.user = "blog";

6. Set up NGINX to run it on HTTPS

Add these lines to your configuration.nix

   services.nginx = {
     enable = true;
     virtualHosts."" = {
       # Use SSL
       forceSSL = true;

       # Let let's encrypt take care of valid certificates
       enableACME = true;

       default = true;

       # Redirect to the blog
       locations."/" = {
         proxyPass = "http://localhost:8080";

   # Open SSH, HTTP and HTTPS in the firewall.
   networking.firewall.allowedTCPPorts = [ 22 80 443 ];


This should be it! Install or update the system.