Skip to content

Module Request: nixos/zerotier-systemd-manager #391248

@ferrine

Description

@ferrine

Nixpkgs version

  • Unstable (25.05)

Describe the proposed module

in #391247 package allows to monitor zerotier interfaces and update DNS periodically. To use this in NixOS, there should be a module to allow that.

Additional context

I've done this for my personal use

{
  pkgs,
  lib,
  config,
  ...
}:
let
  cfg = config.services.zerotier-systemd-manager;
in
  {
    options.services.zerotier-systemd-manager = {
      enable = lib.mkEnableOption "Zerotier DNS Update Service";
      package = lib.mkPackageOption pkgs "zerotier-systemd-manager" { };
    };
    config = lib.mkIf cfg.enable {
      assertions = [
        {
          assertion = config.systemd.network.enable;
          message = ''
            This module relies on systemd-networkd to manage DNS records per iterface,
            please enable it with

            systemd.network.enable = true.

            In case you use NetworkManager, you might also need

            systemd.network.wait-online.enable = false;

            See more info on how to enable systemd-networkd in https://nixos.wiki/wiki/Systemd-networkd
          '';
        }
      ];
      systemd.services.zerotier-dns-update = {
        description = "Update zerotier per-interface DNS settings";
        requires = [ "zerotierone.service" ];
        after = [ "zerotierone.service" ];
        serviceConfig = {
          Type = "oneshot";
          ExecStart = "${cfg.package}/bin/zerotier-systemd-manager";
        };
      };
      systemd.timers.zerotier-dns-update = {
        description = "Update zerotier per-interface DNS settings";
        wantedBy = [ "timers.target" ];
        timerConfig = {
          OnStartupSec = "1min";
          OnUnitInactiveSec = "1min";
        };
        unitConfig = {
          Description = "Update zerotier per-interface DNS settings";
        };
      };
    };
  }

Notify maintainers


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancementAdd something new or improve an existing system.2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS9.needs: module (new)This needs a module to be created

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions