Merge pull request #145231 from thiagokokada/use-makewrapper-terranix

terranix: use wrapProgram on terranix-doc-json
This commit is contained in:
Thiago Kenji Okada 2021-11-11 22:51:03 -03:00 committed by GitHub
commit 6c9ac6fb13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
{ stdenv, lib, fetchFromGitHub, jq, nix, ... }:
{ stdenv, lib, fetchFromGitHub, jq, nix, makeWrapper }:
stdenv.mkDerivation rec {
pname = "terranix";
@ -11,29 +11,21 @@ stdenv.mkDerivation rec {
sha256 = "sha256-HDiyJGgyDUoLnpL8N+wDm3cM/vEfYYc/p4N1kKH/kLk=";
};
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/{bin,core,modules,lib}
mv bin core modules lib $out/
mv $out/bin/terranix-doc-json $out/bin/.wrapper_terranix-doc-json
# manual wrapper because makeWrapper expectes executables
wrapper=$out/bin/terranix-doc-json
cat <<EOF>$wrapper
#!/usr/bin/env bash
export PATH=$PATH:${jq}/bin:${nix}/bin
$out/bin/.wrapper_terranix-doc-json "\$@"
EOF
chmod +x $wrapper
wrapProgram $out/bin/terranix-doc-json \
--prefix PATH : ${lib.makeBinPath [ jq nix ]}
'';
meta = with lib; {
description = "A NixOS like terraform-json generator";
homepage = "https://terranix.org";
license = licenses.gpl3;
platforms = platforms.linux ++ platforms.darwin;
platforms = platforms.unix;
maintainers = with maintainers; [ mrVanDalo ];
};
}