Getting Web-Services to run on NixOS

ops bowl nix reflection

published 2020-11-18 15:22

updated 2023-06-06 21:41



  • Haven't configured a systemd service to ln -s the nix derivation yet


  • Upstream seems broken
  • Docker works, but data is not persistent
  • Find a way to use overlay so I can use an older version


  • broken on 20.09
  • not sure what to do


  • does not mount the big partition
  • not sure why


  • Unconfigured
  • Need to restore nextcloud data
  • Most other data is missing

Basically I've learnt that running php web-apps are a nightmare, and that I don't really understand nginx, fastcgi, phpfpm at all really. For the past ~2 weeks I've been trying to rebuild bowl to be running on NixOS, and I've come up against many difficulties, and lost all the data in both of these services...

I had issues with getting shaarli to read the environment variable as defined in it's nix derivation. So instead, Timo (the package maintainer) told me another solution is to just ln -s the package directory into somewhere it can read/write to since that's what the environment variable is supposed to do anyway. Once I did this it was easy enough to get Shaarli running. I did have to be careful with the nginx config because I'd accidentally disabled the API. Currently my Shaarli install

Wallabag has been another story. It seems like upstream is broken because it's overwriting a php function (mb_string is the package and mb_str_replace is the function) that php says it can't overwrite.

Before I managed to get these to run on bare metal, I was using docker once again to run the services. But since Nix is declarative, and I have no idea how docker volumes work, it wiped everytime I ran nixos-rebuild switch, which remains a problem I haven't quite solved. I somehow managed to get the docker install working, but I don't believe it to be declarative because I did exec into the docker container and ran some esoteric database migration in order to get it to work.

Further more my main issue currently is that in order to do anything in nixOS I need to be able to write the language, understand the options, and then all the services that the options declaratively define. The way I currently run any of the infrastructure is through googling around and hoping to find a module or someone else trying to run the same software, but more profficient at nixOS than I am. That needs to change, since even for services written in easy to run languages like Go, I can't write the nix file to get them to work.