git.iko.soy/typeable/nixpkgs
on master help sign in
ndppd module: init (#35533)
commit9f1da665876cdd4f68750a2241d2bd5fc203f275 authorgnidorah <gnidorah@users.noreply.github.com> dateSat 5 May 2018, 08:33 (9 years ago) parent21b9260
3 files changed+65−2
nixos/modules/module-list.nix+1 nixos/modules/services/networking/ndppd.nix+47 pkgs/applications/networking/ndppd/default.nix+17−2
nixos/modules/module-list.nix+1
@@ -515,6 +515,7 @@
515515 ./services/networking/murmur.nix
516516 ./services/networking/namecoind.nix
517517 ./services/networking/nat.nix
518+ ./services/networking/ndppd.nix
518519 ./services/networking/networkmanager.nix
519520 ./services/networking/nftables.nix
520521 ./services/networking/ngircd.nix
nixos/modules/services/networking/ndppd.nixnew file+47
@@ -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+}
pkgs/applications/networking/ndppd/default.nix+17−2
@@ -1,6 +1,11 @@
1−{ stdenv, fetchFromGitHub, gzip, ... }:
1+{ stdenv, fetchFromGitHub, fetchurl, gzip, ... }:
22
3−stdenv.mkDerivation rec {
3+let
4+ serviceFile = fetchurl {
5+ url = "https://raw.githubusercontent.com/DanielAdolfsson/ndppd/f37e8eb33dc68b3385ecba9b36a5efd92755580f/ndppd.service";
6+ sha256 = "1zf54pzjfj9j9gr48075njqrgad4myd3dqmhvzxmjy4gjy9ixmyh";
7+ };
8+in stdenv.mkDerivation rec {
49 name = "ndppd-${version}";
510 version = "0.2.5";
611
@@ -19,6 +24,16 @@ stdenv.mkDerivation rec {
1924 substituteInPlace Makefile --replace /bin/gzip ${gzip}/bin/gzip
2025 '';
2126
27+ postInstall = ''
28+ mkdir -p $out/etc
29+ cp ndppd.conf-dist $out/etc/ndppd.conf
30+
31+ mkdir -p $out/lib/systemd/system
32+ # service file needed for our module is not in release yet
33+ substitute ${serviceFile} $out/lib/systemd/system/ndppd.service \
34+ --replace /usr/sbin/ndppd $out/sbin/ndppd
35+ '';
36+
2237 meta = {
2338 description = "A daemon that proxies NDP (Neighbor Discovery Protocol) messages between interfaces";
2439 homepage = https://github.com/DanielAdolfsson/ndppd;