-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
television: add wrapper helper #438728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
television: add wrapper helper #438728
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| ; | ||
| }; | ||
RossSmyth marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.