mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-29 00:53:57 +00:00
571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
53 lines
1.3 KiB
Nix
53 lines
1.3 KiB
Nix
{ lib
|
|
, runCommand
|
|
, rustPlatform
|
|
, fetchFromGitHub
|
|
, stdenv
|
|
, coreutils
|
|
}:
|
|
|
|
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
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "patsh";
|
|
version = "0.2.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "nix-community";
|
|
repo = "patsh";
|
|
rev = "v${version}";
|
|
sha256 = "sha256-d2Br4RAlKO7Bpse8sFbIDCIYd2fYvby0ar9oIbQS2jc=";
|
|
};
|
|
|
|
cargoHash = "sha256-hAWMm3YjwTB8ajn3QeXEOJYmPzbbitdwyO4k/IyhlOI=";
|
|
|
|
nativeCheckInputs = [ custom ];
|
|
|
|
# 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
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Command-line tool for patching shell scripts inspired by resholve";
|
|
mainProgram = "patsh";
|
|
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 ];
|
|
};
|
|
}
|