From 857ab32cca581dd891d13631c360321b374e2420 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 9 Jun 2018 22:13:01 +0200 Subject: [PATCH 1/2] darwin.iproute2mac: init at 1.2.1 --- .../darwin/iproute2mac/default.nix | 31 +++++++++++++++++++ pkgs/top-level/darwin-packages.nix | 4 ++- 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/darwin/iproute2mac/default.nix diff --git a/pkgs/os-specific/darwin/iproute2mac/default.nix b/pkgs/os-specific/darwin/iproute2mac/default.nix new file mode 100644 index 00000000000..3b227091cb3 --- /dev/null +++ b/pkgs/os-specific/darwin/iproute2mac/default.nix @@ -0,0 +1,31 @@ +{ stdenv, fetchFromGitHub, python }: + +stdenv.mkDerivation rec { + version = "1.2.1"; + name = "iproute2mac-${version}"; + + src = fetchFromGitHub { + owner = "brona"; + repo = "iproute2mac"; + rev = "v${version}"; + sha256 = "1n6la7blbxza2m79cpnywsavhzsdv4gzdxrkly4dppyidjg6jy1h"; + }; + + buildInputs = [ python ]; + + postPatch = '' + substituteInPlace src/ip.py --replace /usr/bin/python ${python}/bin/python + ''; + installPhase = '' + mkdir -p $out/bin + install -D -m 755 src/ip.py $out/bin/ip + ''; + + meta = with stdenv.lib; { + homepage = https://github.com/brona/iproute2mac; + description = "CLI wrapper for basic network utilites on Mac OS X inspired with iproute2 on Linux systems - ip command."; + license = licenses.mit; + maintainers = with maintainers; [ flokli ]; + platforms = platforms.darwin; + }; +} diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index a53b16919ee..c6be00b0288 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -51,8 +51,10 @@ in inherit (pkgs.llvmPackages) clang-unwrapped; }; + iproute2mac = callPackage ../os-specific/darwin/iproute2mac { }; + libobjc = apple-source-releases.objc4; - + lsusb = callPackage ../os-specific/darwin/lsusb { }; opencflite = callPackage ../os-specific/darwin/opencflite { }; From dcdeaa1a2455f61f2406431efd279aacb955544b Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 9 Jun 2018 23:12:16 +0200 Subject: [PATCH 2/2] darwin.iproute2mac: wrap network_cmds --- pkgs/os-specific/darwin/iproute2mac/default.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/darwin/iproute2mac/default.nix b/pkgs/os-specific/darwin/iproute2mac/default.nix index 3b227091cb3..3ff03aace4e 100644 --- a/pkgs/os-specific/darwin/iproute2mac/default.nix +++ b/pkgs/os-specific/darwin/iproute2mac/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, python }: +{ stdenv, fetchFromGitHub, darwin, python }: stdenv.mkDerivation rec { version = "1.2.1"; @@ -14,7 +14,14 @@ stdenv.mkDerivation rec { buildInputs = [ python ]; postPatch = '' - substituteInPlace src/ip.py --replace /usr/bin/python ${python}/bin/python + substituteInPlace src/ip.py \ + --replace /usr/bin/python ${python}/bin/python \ + --replace /sbin/ifconfig ${darwin.network_cmds}/bin/ifconfig \ + --replace /sbin/route ${darwin.network_cmds}/bin/route \ + --replace /usr/sbin/netstat ${darwin.network_cmds}/bin/netstat \ + --replace /usr/sbin/ndp ${darwin.network_cmds}/bin/ndp \ + --replace /usr/sbin/arp ${darwin.network_cmds}/bin/arp \ + --replace /usr/sbin/networksetup ${darwin.network_cmds}/bin/networksetup ''; installPhase = '' mkdir -p $out/bin