I am currently trying to set up a Nextcloud server on NixOS because it seemed like it’d be easier than on other distros (finally an easy-to-use firewall and so on), and I’m rather new to both. When I rebuild the configuration (nixos-rebuild switch), it doesn’t return any errors or warnings. However when I try to connect to the localhost or the local IP address on the server it runs on, Firefox always says it was “unable to connect” (however it always switches to /login (e.g. localhost/nextcloud will bring me to https://localhost/login), so some part of the webserver must be running). I mostly followed the manual’s instructions for enabling Nextcloud and so. I even tried reinstalling NixOS to see whether it’d change anything. I guess these are the relevant parts in my configuration:
networking.hostName = “FuerstServer”; # Define your hostname. #Nextcloud config
services.nextcloud = {
enable = true;
autoUpdateApps.enable = true;
hostName = “fuerstserver.org”;
nginx.enable = true;
config = {
dbtype = “pgsql”;
dbuser = “nextcloud”;
dbhost = “/run/postgresql”; # nextcloud will add /.s.PGSQL.5432 by itself #adminpassFile = “/var/lib/nextcloud/config/passwd”;
adminpass = “my password, won’t type that here”; #just for testing, will change to file later
adminuser = “root”;
extraTrustedDomains = [ “192.168.1.162” “fuerstserver.fritz.box” ];
overwriteProtocol = “https”;
};
};
#ensure that postgres is running before running the setup
systemd.services.“nextcloud-setup” = {
requires = [“postgresql.service”];
after = [“postgresql.service”];
};
#Enable the OpenSSH daemon.
services.openssh.enable = true;
#Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 80 443 ]; #networking.firewall.allowedUDPPorts = [ … ];
networking.firewall.enable = true;
Error
It looks like you are trying to reinstall your Nextcloud. However the file CAN_INSTALL is missing from your config directory. Please create the file CAN_INSTALL in your config folder to continue.
I can’t see any logs, nothing in /var/log nor in journalctl or /nix/store/692666sls0cxiw5dfpn3kadwxhaydb6r-nextcloud-16.0.5 Where it seems o be installed.
I’ve noticed that there is no config.php in that directory (is this expected?) and touching CAN_INSTALL change nothing.
Thanks @otwieracz.
Firstly - I didn’t remove the container correctly. It seems like deleting its configuration from the configuration.nix is not enough you need to remove /var/lib/containers/{name} Which caused my issue.
Secondly - I missed bindMount when trying to change services.nextcloud.home.
@FantasyCookie17 how about trying nextcloud in nixos container? So you can be sure to have clean environment?
It does not seem to work either - or maybe I don’t know how to connect to that container.
Anything I need to set outside of the container’s definition to be able to do that?
Have you tried logging in into container (nixos-container root-login <container-name>) and examining with ss -tnulp if it’s indeed listening where it is supposed to? Try looking into journal with journalctl to look for errors - for example postgres initialization was, in some cases, “touchy” for me,
Apparently the container does not start at all. systemd/journalctl was not very helpful providing error information, only saying it returned an ‘exit code’. Apparently the pre-init of the container ran, and wen it failed at main init or something. My nextcloud config file now looks like this (I have a 192.168.1.0/24-network btw):