nixpkgs/pkgs/tools/package-management/nix-top/default.nix

54 lines
1.2 KiB
Nix
Raw Normal View History

2018-07-29 19:57:38 +00:00
{ stdenv
, lib
, fetchFromGitHub
, ruby
, makeWrapper
2018-07-30 02:09:02 +00:00
, getent # /etc/passwd
2018-07-29 19:57:38 +00:00
, ncurses # tput
, binutils-unwrapped # strings
2018-07-30 02:09:02 +00:00
, coreutils
2018-07-29 19:57:38 +00:00
, findutils
}:
# No gems used, so mkDerivation is fine.
let
2018-07-30 02:09:02 +00:00
additionalPath = lib.makeBinPath [ getent ncurses binutils-unwrapped coreutils findutils ];
2018-07-29 19:57:38 +00:00
in
stdenv.mkDerivation rec {
pname = "nix-top";
2018-07-30 02:09:02 +00:00
version = "0.2.0";
2018-07-29 19:57:38 +00:00
src = fetchFromGitHub {
owner = "samueldr";
repo = "nix-top";
rev = "v${version}";
2018-07-30 02:09:02 +00:00
sha256 = "0560a9g8n4p764r3va1nn95iv4bg71g8h0wws1af2p5g553j4zps";
2018-07-29 19:57:38 +00:00
};
nativeBuildInputs = [
makeWrapper
];
buildInputs = [
ruby
];
2018-07-30 09:04:15 +00:00
2018-07-29 19:57:38 +00:00
installPhase = ''
2018-07-30 09:04:15 +00:00
mkdir -p $out/libexec/nix-top
install -D -m755 ./nix-top $out/bin/nix-top
2018-07-29 19:57:38 +00:00
wrapProgram $out/bin/nix-top \
2018-07-30 02:09:02 +00:00
--prefix PATH : "$out/libexec/nix-top:${additionalPath}"
'' + stdenv.lib.optionalString stdenv.isDarwin ''
ln -s /bin/stty $out/libexec/nix-top
2018-07-29 19:57:38 +00:00
'';
meta = with lib; {
description = "Tracks what nix is building";
homepage = "https://github.com/samueldr/nix-top";
2018-07-29 19:57:38 +00:00
license = licenses.mit;
maintainers = with maintainers; [ samueldr ];
2018-07-30 02:09:02 +00:00
platforms = platforms.linux ++ platforms.darwin;
2018-07-29 19:57:38 +00:00
inherit version;
};
}