mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
halp: init at 0.1.0
This commit is contained in:
parent
b538bc5f43
commit
ea8fc12427
80
pkgs/tools/misc/halp/default.nix
Normal file
80
pkgs/tools/misc/halp/default.nix
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
{ lib
|
||||||
|
, rustPlatform
|
||||||
|
, fetchFromGitHub
|
||||||
|
, installShellFiles
|
||||||
|
, stdenv
|
||||||
|
, darwin
|
||||||
|
, unixtools
|
||||||
|
, rust
|
||||||
|
}:
|
||||||
|
|
||||||
|
rustPlatform.buildRustPackage rec {
|
||||||
|
pname = "halp";
|
||||||
|
version = "0.1.0";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "orhun";
|
||||||
|
repo = "halp";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-GV+/+/BJTQW3VUtaX1FhY+m7J3vG0oL5fHO/cVVeY/E=";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoHash = "sha256-JqFRPOFKz/KHTym7XgIZ3nZwV1ZLsQ/F2p8i5UCG5aA=";
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# patch tests to point to the correct target directory
|
||||||
|
./fix-target-dir.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
installShellFiles
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = lib.optionals stdenv.isDarwin [
|
||||||
|
darwin.apple_sdk.frameworks.Security
|
||||||
|
];
|
||||||
|
|
||||||
|
nativeCheckInputs = [
|
||||||
|
unixtools.script
|
||||||
|
];
|
||||||
|
|
||||||
|
# tests are failing on darwin
|
||||||
|
doCheck = !stdenv.isDarwin;
|
||||||
|
|
||||||
|
checkFlags = [
|
||||||
|
# requires internet access
|
||||||
|
"--skip=helper::docs::cheat::tests::test_fetch_cheat_sheet"
|
||||||
|
];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace src/helper/args/mod.rs \
|
||||||
|
--subst-var-by releaseDir target/${rust.toRustTargetSpec stdenv.hostPlatform}/$cargoCheckType
|
||||||
|
'';
|
||||||
|
|
||||||
|
preCheck = ''
|
||||||
|
export NO_COLOR=1
|
||||||
|
export OUT_DIR=target
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
mkdir -p man completions
|
||||||
|
|
||||||
|
OUT_DIR=man $out/bin/halp-mangen
|
||||||
|
OUT_DIR=completions $out/bin/halp-completions
|
||||||
|
|
||||||
|
installManPage man/halp.1
|
||||||
|
installShellCompletion \
|
||||||
|
completions/halp.{bash,fish} \
|
||||||
|
--zsh completions/_halp
|
||||||
|
|
||||||
|
rm $out/bin/halp-{completions,mangen,test}
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A CLI tool to get help with CLI tools";
|
||||||
|
homepage = "https://github.com/orhun/halp";
|
||||||
|
changelog = "https://github.com/orhun/halp/blob/${src.rev}/CHANGELOG.md";
|
||||||
|
license = with licenses; [ asl20 mit ];
|
||||||
|
maintainers = with maintainers; [ figsoda ];
|
||||||
|
};
|
||||||
|
}
|
13
pkgs/tools/misc/halp/fix-target-dir.patch
Normal file
13
pkgs/tools/misc/halp/fix-target-dir.patch
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
--- a/src/helper/args/mod.rs
|
||||||
|
+++ b/src/helper/args/mod.rs
|
||||||
|
@@ -129,9 +129,7 @@ mod tests {
|
||||||
|
|
||||||
|
/// Returns the path of the test binary.
|
||||||
|
fn get_test_bin() -> String {
|
||||||
|
- PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
- .join("target")
|
||||||
|
- .join("debug")
|
||||||
|
+ PathBuf::from("@releaseDir@")
|
||||||
|
.join(format!("{}-test", env!("CARGO_PKG_NAME")))
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_string()
|
|
@ -30367,6 +30367,8 @@ with pkgs;
|
||||||
|
|
||||||
hakuneko = callPackage ../tools/misc/hakuneko { };
|
hakuneko = callPackage ../tools/misc/hakuneko { };
|
||||||
|
|
||||||
|
halp = callPackage ../tools/misc/halp { };
|
||||||
|
|
||||||
manga-cli = callPackage ../tools/misc/manga-cli { };
|
manga-cli = callPackage ../tools/misc/manga-cli { };
|
||||||
|
|
||||||
hamster = callPackage ../applications/misc/hamster { };
|
hamster = callPackage ../applications/misc/hamster { };
|
||||||
|
|
Loading…
Reference in a new issue