pkgs: diff-flake: use 'makeWrapper'

This makes it easier to test the script, as I just run it normally
without building it.
This commit is contained in:
Bruno BELANYI 2021-04-27 17:14:49 +00:00
parent 12475ff3a8
commit 2a1dda12d4
2 changed files with 23 additions and 17 deletions

View file

@ -1,13 +1,14 @@
{ coreutils, git, gnused, lib, shellcheck, stdenvNoCC }:
stdenvNoCC.mkDerivation {
{ coreutils, git, gnused, makeWrapper, lib, shellcheck, stdenvNoCC }:
stdenvNoCC.mkDerivation rec {
pname = "diff-flake";
version = "0.1.0";
src = ./diff-flake;
phases = [ "buildPhase" "installPhase" ];
phases = [ "buildPhase" "installPhase" "fixupPhase" ];
buildInputs = [
makeWrapper
shellcheck
];
@ -17,15 +18,20 @@ stdenvNoCC.mkDerivation {
installPhase = ''
mkdir -p $out/bin
cp $src $out/bin/diff-flake
substituteAllInPlace $out/bin/diff-flake
patchShebangs $out/bin/diff-flake
cp $src $out/bin/${pname}
chmod a+x $out/bin/${pname}
'';
cat = "${coreutils}/bin/cat";
mktemp = "${coreutils}/bin/mktemp";
git = "${git}/bin/git";
sed = "${gnused}/bin/sed";
wrapperPath = lib.makeBinPath [
coreutils
git
gnused
];
fixupPhase = ''
patchShebangs $out/bin/${pname}
wrapProgram $out/bin/${pname} --prefix PATH : "${wrapperPath}"
'';
meta = with lib; {
description = "Nix flake helper to visualize changes in closures";