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

53 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 {
pname = "nix-top";
2022-01-06 01:03:13 +00:00
version = "0.3.0";
2018-07-29 20:57:38 +01:00
src = fetchFromGitHub {
owner = "samueldr";
repo = "nix-top";
rev = "v${version}";
2022-01-06 01:03:13 +00:00
sha256 = "sha256-w/TKzbZmMt4CX2KnLwPvR1ydp5NNlp9nNx78jJvhp54=";
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}"
2021-01-15 09:19:50 +00:00
'' + lib.optionalString stdenv.isDarwin ''
2018-07-30 03:09:02 +01:00
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";
2018-07-29 20:57:38 +01:00
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
};
}