@@ -0,0 +1,47 @@
1+{ config, lib, pkgs, ... }:
2+
3+with lib;
4+
5+let
6+ cfg = config.services.ndppd;
7+
8+ configFile = pkgs.runCommand "ndppd.conf" {} ''
9+ substitute ${pkgs.ndppd}/etc/ndppd.conf $out \
10+ --replace eth0 ${cfg.interface} \
11+ --replace 1111:: ${cfg.network}
12+ '';
13+in {
14+ options = {
15+ services.ndppd = {
16+ enable = mkEnableOption "daemon that proxies NDP (Neighbor Discovery Protocol) messages between interfaces";
17+ interface = mkOption {
18+ type = types.string;
19+ default = "eth0";
20+ example = "ens3";
21+ description = "Interface which is on link-level with router.";
22+ };
23+ network = mkOption {
24+ type = types.string;
25+ default = "1111::";
26+ example = "2001:DB8::/32";
27+ description = "Network that we proxy.";
28+ };
29+ configFile = mkOption {
30+ type = types.nullOr types.path;
31+ default = null;
32+ description = "Path to configuration file.";
33+ };
34+ };
35+ };
36+
37+ config = mkIf cfg.enable {
38+ systemd.packages = [ pkgs.ndppd ];
39+ environment.etc."ndppd.conf".source = if (cfg.configFile != null) then cfg.configFile else configFile;
40+ systemd.services.ndppd = {
41+ serviceConfig.RuntimeDirectory = [ "ndppd" ];
42+ wantedBy = [ "multi-user.target" ];
43+ };
44+ };
45+
46+ meta.maintainers = with maintainers; [ gnidorah ];
47+}