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

56 lines
1.3 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
2018-07-30 02:09:02 +00:00
, procps # ps
2018-07-29 19:57:38 +00:00
, 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 {
name = "nix-top-${version}";
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
];
installPhase = ''
2018-07-30 02:09:02 +00:00
mkdir -p $out/bin $out/libexec/nix-top
2018-07-29 19:57:38 +00:00
cp ./nix-top $out/bin/nix-top
2018-07-30 02:09:02 +00:00
chmod +x $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;
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;
};
}