Skip to content

Commit

Permalink
haiti: init at 3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KSJ2000 committed Mar 11, 2025
1 parent eaad2a7 commit 16543b8
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions pkgs/by-name/ha/haiti/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
fetchFromGitHub,
lib,
makeWrapper,
ruby,
stdenv,
versionCheckHook,
}:

stdenv.mkDerivation (finalAttrs: {
pname = "haiti";
version = "3.0.0";

src = fetchFromGitHub {
owner = "noraj";
repo = "haiti";
tag = "v${finalAttrs.version}";
hash = "sha256-1PGGlnbw8zg2sNEc85Un7no7elS5aPSfjzfmqovmiHk=";
};

nativeBuildInputs = [
makeWrapper
ruby
];

paintSrc = fetchFromGitHub {
owner = "janlelis";
repo = "paint";
rev = "7076784c5d57f178690d19e4f8644441ff73f518";
hash = "sha256-uITUfcZjOACeCGsozpUxAYd98Y9oFTgyXems2Q3aYRU=";
};

docoptSrc = fetchFromGitHub {
owner = "docopt";
repo = "docopt.rb";
rev = "794c47d7cb62ca71d65086623a55881449bc2f9e";
hash = "sha256-9DbKTPsZRRAqDkN2wMzBtbbtyKDcVSGmVDcekf4WBnw=";
};

buildPhase = ''
runHook preBuild
paintBuild=$(mktemp -d)
cp -r ${finalAttrs.paintSrc}/* $paintBuild
pushd $paintBuild
sed -i '/.github/d' paint.gemspec
sed -i '/.rspec/d' paint.gemspec
gem build -V paint.gemspec
popd
paintGem=$paintBuild/paint-2.3.0.gem
docoptBuild=$(mktemp -d)
cp -r ${finalAttrs.docoptSrc}/* $docoptBuild
pushd $docoptBuild
gem build -V docopt.gemspec
popd
docoptGem=$docoptBuild/docopt-0.6.1.gem
gem build -V haiti.gemspec
runHook postBuild
'';

installPhase = ''
runHook preInstall
gem install -V $paintGem $docoptGem haiti-hash-${finalAttrs.version}.gem \
--install-dir=$out/lib \
--ignore-dependencies
for i in $out/lib/bin/*;
do
filename=$(basename $i)
makeWrapper ${lib.getExe ruby} $out/bin/$filename \
--set GEM_PATH $out/lib \
--add-flags $out/lib/bin/$filename
done
rm -rf $out/lib/{build_info,cache,doc,extensions,plugins}
runHook postInstall
'';

doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];

meta = {
description = "CLI tool to identify hash types";
homepage = "https://github.com/noraj/haiti";
license = lib.licenses.mit;
mainProgram = "haiti";
maintainers = with lib.maintainers; [ KSJ2000 ];
platforms = lib.platforms.unix;
};
})

0 comments on commit 16543b8

Please sign in to comment.