From 7024b4dc62c8f212150f791bf94ff3202bd7c4e2 Mon Sep 17 00:00:00 2001 From: Jude Taylor Date: Wed, 29 Jul 2015 10:29:36 -0700 Subject: [PATCH] add Darwin's flavor of lsof --- pkgs/development/tools/misc/lsof/default.nix | 2 ++ .../darwin/apple-source-releases/default.nix | 1 + .../apple-source-releases/lsof/default.nix | 27 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++- 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/darwin/apple-source-releases/lsof/default.nix diff --git a/pkgs/development/tools/misc/lsof/default.nix b/pkgs/development/tools/misc/lsof/default.nix index f7feeca5d9d6..c17c2d73e5f8 100644 --- a/pkgs/development/tools/misc/lsof/default.nix +++ b/pkgs/development/tools/misc/lsof/default.nix @@ -27,6 +27,8 @@ stdenv.mkDerivation rec { cp lsof $out/bin ''; + isBroken = stdenv.isDarwin; + meta = { homepage = ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/; description = "A tool to list open files"; diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix index f29a2b5b9111..e53637ee148b 100644 --- a/pkgs/os-specific/darwin/apple-source-releases/default.nix +++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix @@ -78,6 +78,7 @@ let Libsystem = applePackage "Libsystem" "1197.1.1" "1yfj2qdrf9vrzs7p9m4wlb7zzxcrim1gw43x4lvz4qydpp5kg2rh" {}; libutil = applePackage "libutil" "38" "12gsvmj342n5d81kqwba68bmz3zf2757442g1sz2y5xmcapa3g5f" {}; libunwind = applePackage "libunwind" "35.3" "0miffaa41cv0lzf8az5k1j1ng8jvqvxcr4qrlkf3xyj479arbk1b" {}; + lsof = applePackage "lsof" "53" "0ylzds2rhq5v8rddh0dgpcndsp9n3slfp30wsbl5fmsch7a5356j" {}; mDNSResponder = applePackage "mDNSResponder" "522.92.1" "1cp87qda1s7brriv413i71yggm8yqfwv64vknrnqv24fcb8hzbmy" {}; objc4 = applePackage "objc4" "551.1" "1jrdb6yyb5jwwj27c1r0nr2y2ihqjln8ynj61mpkvp144c1cm5bg" {}; objc4_pure = applePackage "objc4/pure.nix" "551.1" "1jrdb6yyb5jwwj27c1r0nr2y2ihqjln8ynj61mpkvp144c1cm5bg" {}; diff --git a/pkgs/os-specific/darwin/apple-source-releases/lsof/default.nix b/pkgs/os-specific/darwin/apple-source-releases/lsof/default.nix new file mode 100644 index 000000000000..23506f5c2175 --- /dev/null +++ b/pkgs/os-specific/darwin/apple-source-releases/lsof/default.nix @@ -0,0 +1,27 @@ +{ stdenv, appleDerivation, ncurses }: + +appleDerivation { + buildInputs = [ ncurses ]; + + postUnpack = '' + sourceRoot="$sourceRoot/lsof" + ''; + + prePatch = '' + mv Configure configure + substituteInPlace configure \ + --replace '`which make`' "$(type -P make)" \ + --replace /usr/include "${stdenv.libc}/include" \ + --replace -lcurses -lncurses + ''; + + dontAddPrefix = true; + + configureFlags = [ "-n" "darwin" ]; + + installPhase = '' + mkdir -p $out/bin $out/man/man8 + cp lsof.8 $out/man/man8/ + cp lsof $out/bin + ''; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4c75b65cde6e..7bbca479b1a4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5607,7 +5607,9 @@ let libtool_2 = callPackage ../development/tools/misc/libtool/libtool2.nix { }; - lsof = callPackage ../development/tools/misc/lsof { }; + lsof = if stdenv.isDarwin + then darwin.lsof + else callPackage ../development/tools/misc/lsof { }; ltrace = callPackage ../development/tools/misc/ltrace { };