Brandon Lucas

Journal

· updated 11 October 2026

  environment.etc."nextcloud-admin-pass".text = "PWD";
  services.nextcloud = {
    enable = true;
    package = pkgs.nextcloud30;
    hostName = "10.8.0.2"; # An example of an IP assigned to the device by Wireguard VPN. This way it's accessible from other devices.
    config.adminpassFile = "/etc/nextcloud-admin-pass";
    config.dbtype = "sqlite";
  };

There are a couple of deviations here from the original post. First, I needed to upgrade to pkgs.nextcloud30 instead of pkgs.nextcloud28, as the docs recommend (it’s officially deprecated and nixos-rebuild switch will hassle you about it). You also have to change "PWD" to a password that’s allowed by Nextcloud’s default password policy as mentioned in the article above, which, in my case, just amounted to creating a secure password with a password manager and them using that.

Also, be sure to later enable the TCP ports 80 (HTTP) and 443 (HTTPs):

nixpkgs.firewall.allowedTCPPorts = [ 80 443 ];

I was able to access the Nextcloud UI at 10.8.0.2 after this! However, I got stuck in password hell for reasons I cannot fathom (it seemed like it was loading my password correctly, only to tell me after over 10 seconds that the password was wrong). What I think was happening was that Nextcloud wasn’t accepting the original password I used, which was something stupid simple like password123, and it was failing Nextcloud’s password rules. But then when I went to change it, something about the database was already screwed up or my IP address was just banned and I couldn’t login even after having set a good password. In the end, I just ended up nuking all the Nextcloud setup via sudo rm -rf /var/lib/nextcloud (careful with that command!), and then I re-ran sudo nixos-rebuild switch which re-setup the config with a good password from the start this time. And wouldn’t you know it, things worked! I could login with the default username of root and the password I had set in the config above.

By the way, another neat trick I learned is that you can look up what options exist for a nix service by using the nixos-option command. By running nixos-option services.nextcloud.config, I found you could set an admin username of your choice as well via config.adminuser.