0

Genuinely cannot install NixOS on a VPS

preview

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.

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.
0

How to remove a dead binary cache from config

preview

Recently garnix shutdown, which mean trying to rebuild my config while having it as a subsituter just failswith a bad gateway. Issue is, to remove it from my config, i gotta rebuild my config, which obviously fails since it tries to check for garnix. Not sure what to do here

EDIT: I fixed by by “overriding” my nix config, I jsut copied the substituter related entry in the nix.conf geberated by nix, pasted them in ~/.config/nix/nix.conf and removed garnix from those, then just rebuild the config and boom it worked. Just dot forget to then remove those lines from the user nix config

Recently garnix shutdown, which mean trying to rebuild my config while having it as a subsituter just failswith a bad gateway. Issue is, to remove it from my config, i gotta rebuild my config, which obviously fails since it tries to check for garnix. Not sure what to do here

EDIT: I fixed by by “overriding” my nix config, I jsut copied the substituter related entry in the nix.conf geberated by nix, pasted them in ~/.config/nix/nix.conf and removed garnix from those, then just rebuild the config and boom it worked. Just dot forget to then remove those lines from the user nix config

0

permitted insecure package isn't actually permitted

preview

I just updated my nixpkgs input and now thenodejs-20.20.2 package (prolly used by another package and idk why) is flagged as insecure, no big deal i just gotta add it to nixpkgs.config.permittedInsecurePackages, which I do:

  nixpkgs.config.permittedInsecurePackages = [
    "nodejs-20.20.2"
    "electron-38.8.4"
  ];

Execpt that it STILL doesn’t rebuild and tells me the same error message as when I didn’t have added it to the permitted insecure packages

       error: Refusing to evaluate package 'nodejs-20.20.2' in /nix/store/1hb1glkkpl6vjjpfrwzmvjyvhcyqfxfk-source/pkgs/development/web/nodejs/nodejs.nix:689 because it is marked as insecure

       Known issues:
        - This NodeJS release has reached its end of life. See https://nodejs.org/en/about/releases/.

       You can install it anyway by allowing this package, using the
       following methods:

       a) To temporarily allow all insecure packages, you can use an environment
          variable for a single invocation of the nix tools:

            $ export NIXPKGS_ALLOW_INSECURE=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) for `nixos-rebuild` you can add ‘nodejs-20.20.2’ to
          `nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
          like so:

            {
              nixpkgs.config.permittedInsecurePackages = [
                "nodejs-20.20.2"
              ];
            }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
          ‘nodejs-20.20.2’ to `permittedInsecurePackages` in
          ~/.config/nixpkgs/config.nix, like so:

            {
              permittedInsecurePackages = [
                "nodejs-20.20.2"
              ];
            }

not sure what to do when the option to allow insecure packages does not allow insecure packages, weirdly enough tho it works just fine with

I just updated my nixpkgs input and now thenodejs-20.20.2 package (prolly used by another package and idk why) is flagged as insecure, no big deal i just gotta add it to nixpkgs.config.permittedInsecurePackages, which I do:

  nixpkgs.config.permittedInsecurePackages = [
    "nodejs-20.20.2"
    "electron-38.8.4"
  ];

Execpt that it STILL doesn’t rebuild and tells me the same error message as when I didn’t have added it to the permitted insecure packages

       error: Refusing to evaluate package 'nodejs-20.20.2' in /nix/store/1hb1glkkpl6vjjpfrwzmvjyvhcyqfxfk-source/pkgs/development/web/nodejs/nodejs.nix:689 because it is marked as insecure

       Known issues:
        - This NodeJS release has reached its end of life. See https://nodejs.org/en/about/releases/.

       You can install it anyway by allowing this package, using the
       following methods:

       a) To temporarily allow all insecure packages, you can use an environment
          variable for a single invocation of the nix tools:

            $ export NIXPKGS_ALLOW_INSECURE=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) for `nixos-rebuild` you can add ‘nodejs-20.20.2’ to
          `nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
          like so:

            {
              nixpkgs.config.permittedInsecurePackages = [
                "nodejs-20.20.2"
              ];
            }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
          ‘nodejs-20.20.2’ to `permittedInsecurePackages` in
          ~/.config/nixpkgs/config.nix, like so:

            {
              permittedInsecurePackages = [
                "nodejs-20.20.2"
              ];
            }

not sure what to do when the option to allow insecure packages does not allow insecure packages, weirdly enough tho it works just fine with

0

Use multiple ? in flake input url

preview

I need to use multiple ? in one of my flake input’s url, the issue is only the first ? gets registered but not the second. I’ve tried github:SteamClientHomebrew/Millennium?tag=latest?dir=packages/nix which returns this:

error:
       … while updating the lock file of flake 'git+file:///home/claymorwan/.dotfiles?dir=NixOS'

       … while updating the flake input 'millennium'

       error: path '«github:SteamClientHomebrew/Millennium/fcb0e5627deecf2fc03067ee3dfb63d37e8e82d4»/flake.nix' does not exist

Then I’ve tried github:SteamClientHomebrew/Millennium?dir=packages/nix?tag=latest which returns this:

error:
       … while updating the lock file of flake 'git+file:///home/claymorwan/.dotfiles?dir=NixOS'

       … while updating the flake input 'millennium'

       error: path '«github:SteamClientHomebrew/Millennium/fcb0e5627deecf2fc03067ee3dfb63d37e8e82d4»/packages/nix?tag=latest/flake.nix' does not exist

I’ve also tried to write the input differently like this

millenium = {
  type = "github";
  owner = "SteamClientHomebrew";
  repo = "Millennium";
  tag = "latest";
  dir = "packages/nix";
  inputs.nixpkgs.follows = "nixpkgs";
}

which also didn’t work and returns this

error:
       … while evaluating flake input
         at /home/claymorwan/.dotfiles/NixOS/flake.nix:48:5:
           47|
           48|     millennium = {
             |     ^
           49|       type = "github";

       error: input attribute 'tag' not supported by scheme 'github'

So not really sure how to set that up

I need to use multiple ? in one of my flake input’s url, the issue is only the first ? gets registered but not the second. I’ve tried github:SteamClientHomebrew/Millennium?tag=latest?dir=packages/nix which returns this:

error:
       … while updating the lock file of flake 'git+file:///home/claymorwan/.dotfiles?dir=NixOS'

       … while updating the flake input 'millennium'

       error: path '«github:SteamClientHomebrew/Millennium/fcb0e5627deecf2fc03067ee3dfb63d37e8e82d4»/flake.nix' does not exist

Then I’ve tried github:SteamClientHomebrew/Millennium?dir=packages/nix?tag=latest which returns this:

error:
       … while updating the lock file of flake 'git+file:///home/claymorwan/.dotfiles?dir=NixOS'

       … while updating the flake input 'millennium'

       error: path '«github:SteamClientHomebrew/Millennium/fcb0e5627deecf2fc03067ee3dfb63d37e8e82d4»/packages/nix?tag=latest/flake.nix' does not exist

I’ve also tried to write the input differently like this

millenium = {
  type = "github";
  owner = "SteamClientHomebrew";
  repo = "Millennium";
  tag = "latest";
  dir = "packages/nix";
  inputs.nixpkgs.follows = "nixpkgs";
}

which also didn’t work and returns this

error:
       … while evaluating flake input
         at /home/claymorwan/.dotfiles/NixOS/flake.nix:48:5:
           47|
           48|     millennium = {
             |     ^
           49|       type = "github";

       error: input attribute 'tag' not supported by scheme 'github'

So not really sure how to set that up