From e2650aa1629d9859473c07e54a50c797e58fee49 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Tue, 27 Sep 2022 22:04:22 +0100 Subject: [PATCH] add pppoe derivation, replacing override we use a custom installPhase so we don't drag in a bunch of scripts that we don't need and don't work --- overlay.nix | 10 +-------- pkgs/pppoe/default.nix | 46 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 pkgs/pppoe/default.nix diff --git a/overlay.nix b/overlay.nix index 2147fe6..f37310f 100644 --- a/overlay.nix +++ b/overlay.nix @@ -12,15 +12,7 @@ final: prev: { s6-init-bin = final.callPackage ./pkgs/s6-init-bin {}; s6-rc-database = final.callPackage ./pkgs/s6-rc-database {}; - pppoe = prev.rpPPPoE.overrideAttrs (o: { - # use newer rp-pppoe, it builds cleanly - src = final.fetchFromGitHub { - owner = "dfskoll"; - repo = "rp-pppoe"; - rev = "7cfd8c0405d14cf1c8d799d41d8207fd707979c1"; - hash = "sha256-MFdCwNj8c52blxEuXH5ltT2yYDmKMH5MLUgtddZV25E="; - }; - }); + pppoe = final.callPackage ./pkgs/pppoe {}; ppp = (prev.ppp.override { libpcap = null; diff --git a/pkgs/pppoe/default.nix b/pkgs/pppoe/default.nix new file mode 100644 index 0000000..e6f7861 --- /dev/null +++ b/pkgs/pppoe/default.nix @@ -0,0 +1,46 @@ +{ lib +, stdenv +, fetchFromGitHub +, ppp } : +let +in +stdenv.mkDerivation rec { + pname = "rp-pppoe"; + version = "3.15"; + + src = fetchFromGitHub { + owner = "dfskoll"; + repo = "rp-pppoe"; + rev = "7cfd8c0405d14cf1c8d799d41d8207fd707979c1"; + hash = "sha256-MFdCwNj8c52blxEuXH5ltT2yYDmKMH5MLUgtddZV25E="; + }; + + buildInputs = [ ppp ]; + + preConfigure = '' + cd src + export PPPD=${ppp}/sbin/pppd + ''; + + configureFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ "rpppoe_cv_pack_bitfields=rev" ]; + + postConfigure = '' + sed -i Makefile -e 's@DESTDIR)/etc/ppp@out)/etc/ppp@' + sed -i Makefile -e 's@PPPOESERVER_PPPD_OPTIONS=@&$(out)@' + ''; + + installPhase = '' + mkdir -p $out/bin $out/lib + cp pppoe pppoe-server $out/bin # ppoe-relay pppoe-sniff? + test -e rp-pppoe.so && cp rp-pppoe.so $out/lib + true + ''; + makeFlags = [ "AR:=$(AR)" ]; + + meta = with lib; { + description = "Roaring Penguin Point-to-Point over Ethernet tool"; + platforms = platforms.linux; + homepage = "https://www.roaringpenguin.com/products/pppoe"; + license = licenses.gpl2Plus; + }; +}