I’ve recently bought a VPS from Contabo in order to host my own Nextcloud instance (and maybe vaultwarden and abby later). It’s my first time ever using a VPS but I’ve figured NixOS would be great to host those thanks to the reproducibility and modules, and I’ve been using NixOS on my desktop so I figured it wouldn’t so hard right ? right ???

Well turns out it IS hard, I’ve been trying to install NixOS on my VPS using nixos-anywhere and using this template. The config works but the install seems to fail all the time ? It should output Done when it successfully finished the install, but instead it outputs this:

+ partprobe /dev/sda
+ udevadm trigger --subsystem-match=block
+ udevadm settle --timeout 120
+ device=/dev/disk/by-partlabel/disk-disk1-ESP
+ extraArgs=()
+ declare -a extraArgs
+ format=vfat
+ mountOptions=('defaults')
+ declare -a mountOptions
+ mountpoint=/boot
+ type=filesystem
+ grep -q TYPE=
+ blkid /dev/disk/by-partlabel/disk-disk1-ESP
+ mkfs.vfat /dev/disk/by-partlabel/disk-disk1-ESP
mkfs.fat 4.2 (2021-01-31)
mkfs.vfat: unable to open /dev/disk/by-partlabel/disk-disk1-ESP: No such file or directory
+ rm -rf /tmp/tmp.1dADBpsCkQ
Connection to 185.174.255.56 closed.

I was running the install like so: nix run nixpkgs#nixos-anywhere – --flake .#generic --generate-hardware-config nixos-generate-config ./hardware-configuration.nix root@<address>

And I can confirm it’s broken cuz when I try to ssh into the VPS afterward it just never let’s me connect.

But that’s not all, it actually did work TWICE and I was able to ssh into the server, but it then I noticed it just didn’t have any network access, couldn’t pull a git repo or even ping an address, and so couldn’t rebuild my config in the VPS. Idk how to fix that either, I imagine this could be related to the nextwork config but I’m not sure For example:

$ ping nixos.org
ping: nixos.org: Name or service not known

I tried all I could find online but nothing really worked, so idk what to do from here

Here’s a link to the config I’m using: codeberg.org/claymorwan/nixos-VPS

EDIT: I’ve managed to fix both of those issue it seems, but my nextcloud instance still isn’t reachable. I did create an A record in my domain’s DNS pointing to my VPS’ ip address and I belive I’ve opened the correct ports in the config so idk what’s wrong here

Nextcloud does start correctly too according to the service

Nov 10 20:29:37 nixos systemd[1]: Starting nextcloud-setup.service...
Nov 10 20:29:41 nixos nextcloud-setup-start[683]: No upgrade required.
Nov 10 20:29:41 nixos nextcloud-setup-start[683]: Note: This command triggers the upgrade actions associated with a new version. The new version's updated source files must be deployed in advance.
Nov 10 20:29:41 nixos nextcloud-setup-start[683]: See the upgrade documentation: https://docs.nextcloud.com/server/35/go.php?to=admin-update for more information.
Nov 10 20:29:42 nixos nextcloud-setup-start[687]: System config value trusted_domains deleted
Nov 10 20:29:42 nixos nextcloud-setup-start[691]: calendar already enabled
Nov 10 20:29:42 nixos nextcloud-setup-start[691]: tasks already enabled
Nov 10 20:29:43 nixos nextcloud-setup-start[695]: System config value trusted_domains => 0 set to string nextcloud.deadf.org
Nov 10 20:29:43 nixos systemd[1]: nextcloud-setup.service: Deactivated successfully.
Nov 10 20:29:43 nixos systemd[1]: Finished nextcloud-setup.service.
Nov 10 20:29:43 nixos systemd[1]: nextcloud-setup.service: Consumed 3.423s CPU time over 5.718s wall clock time, 129.1M memory peak, 145.3M read from disk, 8K written to disk.