Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 91 additions & 52 deletions pkgs/by-name/te/television/package.nix
Original file line number Diff line number Diff line change
@@ -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=";
};

cargoHash = "sha256-QKUspbC1bmSeZP0n/O5roEqQkrja+fVKLhAvgzqNS9E=";

nativeBuildInputs = [ makeWrapper ];

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";

assert
(extraPackages == null)
|| lib.warn "Overriding television with the 'extraPackages' attribute is deprecated. Please use `television.withPackages (p: [ p.fd ...])` instead.";

let
television = rustPlatform.buildRustPackage (finalAttrs: {
pname = "television";

version = "0.13.5";

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)
33 changes: 33 additions & 0 deletions pkgs/by-name/te/television/wrapper.nix
Original file line number Diff line number Diff line change
@@ -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
;
};
}
Loading