Twingate on NixOS unstable

Does anyone know of a guide to getting twingate working on NixOS unstable / 23.11?

According to the 23.11 release notes under New Services: “twingate, a high performance, easy to use zero trust solution that enables access to private resources from any device with better security than a VPN.”

The package installs fine, but attempting to run setup results in:

Twingate Setup 1.0.60.47219 | 0.130.0
By continuing, you agree to the User Terms of Service (https://twingate.com/terms/user)
and acknowledge the Privacy Policy (https://twingate.com/privacy). [A]gree/[q]uit: A
Enter the name of your Twingate network (eg. "acme" for "acme.twingate.com"): xxxxxxxx
checking...
xxxxxxxx is a valid Twingate network
No such file or directory (os error 2)

Running with strace shows that /etc/twingate/network.conf can’t be written:

...
futex(0x7f4738509990, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 6246, NULL, FUTEX_BITSET_MATCH_ANY) = 0
write(6, "<15>Jun 12 17:54:58 twingate-cli"..., 75) = 75
write(1, "\33[92mxxxxxxxx is a valid Twingat"..., 46xxxxxxxx is a valid Twingate network
) = 46
openat(AT_FDCWD, "/etc/twingate/network.conf", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = -1 ENOENT (No such file or directory)
write(2, "No such file or directory", 25No such file or directory) = 25
write(2, " (os error ", 11 (os error )             = 11
...

Creating /etc/twingate allows the configuration to be written, but it then fails with network issues.

I’m able to connect without issues from Ubuntu 22.04, so it isn’t a network name or credentials issue. :slight_smile:

Thanks in anticipation :`-)
Alistair

Did you just install the package, or did you actually enable the service using services.twingate.enable = true? The latter seems to do exactly that, create a twingate-folder under /etc.

2 Likes

Thanks very much!

You’re correct, I installed the package, not enable the service. Now that you’ve said it, it seems obvious, however as a newbie to NixOS, how can I tell that a service should be enabled from:

Thanks again,
Alistair

I don’t know, after a while you just know that when they talk about a new service being available, you first do a “NixOS Options” search on https://search.nixos.org. And when there is a service configurable, it’s usually a good idea to use that.

Thanks! I wasn’t able to get the “NixOS Options” search to help, however while trying to figure it out I came across List available services which suggests:

nixos-option services
nixos-option services.twingate

that can be used to determine that twingate is a service and what can be set.