3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/package-management/nix-top/default.nix

54 lines
1.2 KiB
Nix
Raw Normal View History

2018-07-29 20:57:38 +01:00
{ stdenv
, lib
, fetchFromGitHub
, ruby
, makeWrapper
2018-07-30 03:09:02 +01:00
, getent # /etc/passwd
2018-07-29 20:57:38 +01:00
, ncurses # tput
, binutils-unwrapped # strings
2018-07-30 03:09:02 +01:00
, coreutils
2018-07-29 20:57:38 +01:00
, findutils
}:
# No gems used, so mkDerivation is fine.
let
2018-07-30 03:09:02 +01:00
additionalPath = lib.makeBinPath [ getent ncurses binutils-unwrapped coreutils findutils ];
2018-07-29 20:57:38 +01:00
in
stdenv.mkDerivation rec {
name = "nix-top-${version}";
2018-07-30 03:09:02 +01:00
version = "0.2.0";
2018-07-29 20:57:38 +01:00
src = fetchFromGitHub {
owner = "samueldr";
repo = "nix-top";
rev = "v${version}";
2018-07-30 03:09:02 +01:00
sha256 = "0560a9g8n4p764r3va1nn95iv4bg71g8h0wws1af2p5g553j4zps";
2018-07-29 20:57:38 +01:00
};
nativeBuildInputs = [
makeWrapper
];
buildInputs = [
ruby
];
2018-07-30 10:04:15 +01:00
2018-07-29 20:57:38 +01:00
installPhase = ''
2018-07-30 10:04:15 +01:00
mkdir -p $out/libexec/nix-top
install -D -m755 ./nix-top $out/bin/nix-top
2018-07-29 20:57:38 +01:00
wrapProgram $out/bin/nix-top \
2018-07-30 03:09:02 +01:00
--prefix PATH : "$out/libexec/nix-top:${additionalPath}"
'' + stdenv.lib.optionalString stdenv.isDarwin ''
ln -s /bin/stty $out/libexec/nix-top
2018-07-29 20:57:38 +01: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 03:09:02 +01:00
platforms = platforms.linux ++ platforms.darwin;
2018-07-29 20:57:38 +01:00
inherit version;
};
}