nixpkgs/pkgs/development/tools/misc/patsh/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.2 KiB
Nix
Raw Normal View History

2022-11-27 15:20:00 +00:00
{ lib
, runCommand
2022-11-27 15:20:00 +00:00
, rustPlatform
, fetchFromGitHub
, stdenv
, coreutils
2022-11-27 15:20:00 +00:00
}:
let
# copied from flake.nix
# tests require extra setup with nix
custom = runCommand "custom" { } ''
mkdir -p $out/bin
touch $out/bin/{'foo$','foo"`'}
chmod +x $out/bin/{'foo$','foo"`'}
'';
in
2022-11-27 15:20:00 +00:00
rustPlatform.buildRustPackage rec {
pname = "patsh";
version = "0.2.0";
2022-11-27 15:20:00 +00:00
src = fetchFromGitHub {
owner = "nix-community";
repo = pname;
rev = "v${version}";
sha256 = "sha256-7HXJspebluQeejKYmVA7sy/F3dtU1gc4eAbKiPexMMA=";
2022-11-27 15:20:00 +00:00
};
cargoSha256 = "sha256-R6ScpLYbEJAu7+CyJsMdljtXq7wsMojHK5O1lH+E/E8=";
2022-11-27 15:20:00 +00:00
checkInputs = [ custom ];
2022-11-27 15:20:00 +00:00
# see comment on `custom`
postPatch = ''
for file in tests/fixtures/*-expected.sh; do
substituteInPlace $file \
--subst-var-by cc ${stdenv.cc} \
--subst-var-by coreutils ${coreutils} \
--subst-var-by custom ${custom}
done
2022-11-27 15:20:00 +00:00
'';
meta = with lib; {
description = "A command-line tool for patching shell scripts inspired by resholve";
homepage = "https://github.com/nix-community/patsh";
changelog = "https://github.com/nix-community/patsh/blob/v${version}/CHANGELOG.md";
license = licenses.mpl20;
maintainers = with maintainers; [ figsoda ];
};
}