Setting up Nextcloud using nix
Nextcloud is a cool self hosted application. I finished setting it up with nix and this is how I did it. It was relatively easy when you know nix and it’s weirdness and how to find help with it.
TODO: Add a long SEO targeted paragraph here
Ingredients
- Need a VPS, I use digitalocean.
- Point your domain to the VPS (for letsencrypt)
- nix, I already have it installed
- nixops, it has been in a migration for a while now. Last I checked they are working on version 4 but I have not seen 2 and 3 yet.
Step 1
Create the droplet. I have a script for this. It also adds a script which converts the Ubuntu to a NixOS installation.
I run the script, then wait for the nix-infect to finish.
Intermission: The nextcloud configuration
The configuration is basically just a nix configuration. I put it together from various places that I didn’t make note of. I also just looked at the nix docs a bunch. duck.ai is kinda not helpful with nix for me which is kinda dissapointing.
Step 2
Deploy using nixops
- Create a deployment
- Run the deployment
- Wait for the deployment to finish
Step 3
Check that everything is working fine.
That’s it. Took like 3 days to get it working though.
- Systemd logs helped
- permissions were wrong (wrong group actually for the keys)
- the configuration was wrong (gateway)
- Digitalocean can rebuild the droplet and run the infect script automatically