Can't start cloudflare warp-cli

warp-cli register
Unable to connect to CloudflareWARP daemon. Maybe the daemon is not running?

and I typed the command to start the service

sudo systemctl enable --now warp-svc.service
Failed to enable unit: Unit file warp-svc.service does not exist.

usually can on other linux distro but on nixos the command can’t. Can you help fix this problem?

Seems like this is a know issue, a workaround seems to be provided here to manually start the service without systemd. To better solve this issue, a Pull Request is waiting for review since one month here. Maybe you can try it out and help the reviewing process to go further?

To test it, the simplest is certainly to manually create the file cloudflare-warp.nix as describe here and add this file to your imports like:

imports = [
  # …
services.cloudflare-warp = {
  enable = true;
  certificate = ./Cloudflare_CA.crt; # download here

I maintain cloudflare-warp. Yes, the problem is that the service, although contained on the package, will not work. The only way to use it on that case would be running the warp-svc on the background and then run the rest of commands through warp-cli. That’s why the module (the one linked by @tobiasBora) was created, to specifically move that service to /etc/systemd and make it available (which is why on NixOS it works differently compared to the other distros).

Feel free to try the module and see if it works.

sudo nixos-rebuild switch instead appears erorr like this

error: builder for ‘/nix/store/h82pgsnl6a05s2bxw32bhy6vccgqdcp7-nss-cacert-3.86.drv’ failed with exit code 1
error: 1 dependencies of derivation ‘/nix/store/z2v318zraq18kg4j9qbx7wwyy3hp1fd5-etc.drv’ failed to build
error: 1 dependencies of derivation ‘/nix/store/ga0zw4rk5g026rbza93cc1xg0qlw3njp-nixos-system-nixos-22.11.1580.e285dd0ca97.drv’ failed to build

the config that I use is like this

I have gotten this to work, but it’s not 100% reproducible. You have to download the CA Certificate and point it to the downloaded file in the config.

I have this section commented in my config:

The certificate file should be .pem rather than .crt format.
That’s what buildcatrust accepts which is used to generate certificates in NixOS.