zerotier / zeronsd

A DNS server for ZeroTier users
https://zerotier.com
BSD 3-Clause "New" or "Revised" License
520 stars 58 forks source link

Update + clean up dependencies, move API crates into repo, prune down the target platforms/formats we build + publish #238

Closed rcoder closed 3 weeks ago

rcoder commented 1 month ago

This does a number of things which could be separated, so I consider this more or less experimental.

Implied in the removal of the various dockerfiles is the expectation that production deployments of ZeroNSD will simply use a Docker container, rather than distro-native packages.

TODO: automate publishing of containers from Nix-generated image

rcoder commented 1 month ago

I'll definitely update the README and add Docker publishing tasks to the justfile (or port that to a boring ol' Makefile if needed).

Two other questions:

  1. Are folks generally okay with requiring Nix to do any non-trivial builds? cargo build works on a machine with a normal Rust development toolchain, so I'm inclined to just stick with Nix instead of trying to support builds on arbitrary base distros/images.
  2. Do we want/need to be able to generate deb or rpm packages? It's possible to output those archive formats via nix-bundlers but I haven't used that package in anger.

Also, as an aside: I have a proof of concept for a NixOS module that would let you provide a network ID and path to a token file and get a fully-running ZT1 + ZeroNSD setup that joins and serves DNS for that network. If folks are interested in seeing how that works I can add it to the Flake. Combined with nixos-generators I think it would be a pretty easy way to create VM images that could run on a cloud or local hypervisor.

laduke commented 1 month ago

I don't personally know how to manage the distro packages efficiently and without ssl lib problems. I think they are one of the main reasons no updates are happening. Maybe others have a better handle on that.

laduke commented 1 month ago

I was getting an error during cargo build in nix develop, so I added to the devInputs in the flake and it worke.d

        devInputs = with pkgs; [
          rust-bin.stable.${rust-version}.complete
          pkg-config
          openssl
        ] ++ lib.optionals pkgs.stdenv.isDarwin [
          pkgs.libiconv
          pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
        ] ;

I don't know if this is idomatic

glimberg commented 1 month ago

All looks good to me so far. Only issue is trying to build with just in the nix develop environment results in this error:

error: a 'x86_64-linux' with features {kvm} is required to build '/nix/store/lpjhzs199wpjwraqrcm1gnmjcv5f1jyk-docker-layer-zeronsd.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, nixos-test, uid-range}
error: Recipe `build` failed on line 2 with exit code 1
glimberg commented 1 month ago

Alright. Got that fixed by adding

system-features = kvm

to /etc/nix/nix.conf