television: add wrapper helper (#438728)
This commit is contained in:
@@ -1,60 +1,99 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
makeWrapper,
|
||||
testers,
|
||||
television,
|
||||
callPackage,
|
||||
installShellFiles,
|
||||
nix-update-script,
|
||||
extraPackages ? [ ],
|
||||
testers,
|
||||
targetPackages,
|
||||
extraPackages ? null,
|
||||
}:
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "television";
|
||||
version = "0.13.5";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "alexpasmantier";
|
||||
repo = "television";
|
||||
tag = finalAttrs.version;
|
||||
hash = "sha256-IlFOYnZ9xPQaRheielKqAckyVlSVQMhnO4wCtVixlNQ=";
|
||||
};
|
||||
assert
|
||||
(extraPackages == null)
|
||||
|| lib.warn "Overriding television with the 'extraPackages' attribute is deprecated. Please use `television.withPackages (p: [ p.fd ...])` instead.";
|
||||
|
||||
cargoHash = "sha256-QKUspbC1bmSeZP0n/O5roEqQkrja+fVKLhAvgzqNS9E=";
|
||||
let
|
||||
television = rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "television";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
version = "0.13.5";
|
||||
|
||||
postInstall = lib.optionalString (extraPackages != [ ]) ''
|
||||
wrapProgram $out/bin/tv \
|
||||
--prefix PATH : ${lib.makeBinPath extraPackages}
|
||||
'';
|
||||
|
||||
# TODO(@getchoo): Investigate selectively disabling some tests, or fixing them
|
||||
# https://github.com/NixOS/nixpkgs/pull/423662#issuecomment-3156362941
|
||||
doCheck = false;
|
||||
|
||||
passthru = {
|
||||
tests.version = testers.testVersion {
|
||||
package = television;
|
||||
command = "XDG_DATA_HOME=$TMPDIR tv --version";
|
||||
src = fetchFromGitHub {
|
||||
owner = "alexpasmantier";
|
||||
repo = "television";
|
||||
tag = finalAttrs.version;
|
||||
hash = "sha256-IlFOYnZ9xPQaRheielKqAckyVlSVQMhnO4wCtVixlNQ=";
|
||||
};
|
||||
updateScript = nix-update-script { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Blazingly fast general purpose fuzzy finder TUI";
|
||||
longDescription = ''
|
||||
Television is a fast and versatile fuzzy finder TUI.
|
||||
It lets you quickly search through any kind of data source (files, git
|
||||
repositories, environment variables, docker images, you name it) using a
|
||||
fuzzy matching algorithm and is designed to be easily extensible.
|
||||
'';
|
||||
homepage = "https://github.com/alexpasmantier/television";
|
||||
changelog = "https://github.com/alexpasmantier/television/releases/tag/${finalAttrs.version}";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "tv";
|
||||
maintainers = with lib.maintainers; [
|
||||
louis-thevenet
|
||||
getchoo
|
||||
cargoHash = "sha256-QKUspbC1bmSeZP0n/O5roEqQkrja+fVKLhAvgzqNS9E=";
|
||||
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [
|
||||
installShellFiles
|
||||
];
|
||||
};
|
||||
})
|
||||
|
||||
# TODO(@getchoo): Investigate selectively disabling some tests, or fixing them
|
||||
# https://github.com/NixOS/nixpkgs/pull/423662#issuecomment-3156362941
|
||||
doCheck = false;
|
||||
|
||||
postInstall = ''
|
||||
installManPage target/${stdenv.hostPlatform.rust.cargoShortTarget}/assets/tv.1
|
||||
|
||||
installShellCompletion --cmd tv \
|
||||
television/utils/shell/completion.bash \
|
||||
television/utils/shell/completion.fish \
|
||||
television/utils/shell/completion.nu \
|
||||
television/utils/shell/completion.zsh
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script { };
|
||||
|
||||
withPackages =
|
||||
f:
|
||||
callPackage ./wrapper.nix {
|
||||
television = finalAttrs.finalPackage;
|
||||
extraPackages = f targetPackages;
|
||||
};
|
||||
|
||||
tests = {
|
||||
version = testers.testVersion {
|
||||
package = finalAttrs.finalPackage;
|
||||
command = "XDG_DATA_HOME=$TMPDIR tv --version";
|
||||
};
|
||||
wrapper = testers.testVersion {
|
||||
package = finalAttrs.finalPackage.withPackages (pkgs: [
|
||||
pkgs.fd
|
||||
pkgs.git
|
||||
]);
|
||||
|
||||
command = "XDG_DATA_HOME=$TMPDIR tv --version";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Blazingly fast general purpose fuzzy finder TUI";
|
||||
longDescription = ''
|
||||
Television is a fast and versatile fuzzy finder TUI.
|
||||
It lets you quickly search through any kind of data source (files, git
|
||||
repositories, environment variables, docker images, you name it) using a
|
||||
fuzzy matching algorithm and is designed to be easily extensible.
|
||||
'';
|
||||
homepage = "https://github.com/alexpasmantier/television";
|
||||
changelog = "https://github.com/alexpasmantier/television/releases/tag/${finalAttrs.version}";
|
||||
license = lib.licenses.mit;
|
||||
mainProgram = "tv";
|
||||
maintainers = with lib.maintainers; [
|
||||
louis-thevenet
|
||||
getchoo
|
||||
RossSmyth
|
||||
];
|
||||
};
|
||||
});
|
||||
in
|
||||
|
||||
if extraPackages == null then television else television.withPackages (lib.const extraPackages)
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
lib,
|
||||
symlinkJoin,
|
||||
television,
|
||||
makeBinaryWrapper,
|
||||
extraPackages,
|
||||
}:
|
||||
|
||||
symlinkJoin {
|
||||
inherit (television) version;
|
||||
pname = "${television.pname}-with-pkgs";
|
||||
|
||||
paths = [ television ];
|
||||
|
||||
nativeBuildInputs = [ makeBinaryWrapper ];
|
||||
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/tv \
|
||||
--prefix PATH : "${lib.makeBinPath extraPackages}"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
inherit (television.meta)
|
||||
description
|
||||
longDescription
|
||||
homepage
|
||||
changelog
|
||||
license
|
||||
mainProgram
|
||||
maintainers
|
||||
;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user