Reproduction script:
# Bulk rewrite
./maintainers/scripts/sha-to-sri.py pkgs/by-name
# Revert some packages which will need manual intervention
for n in amdvlk azure-cli cargo-profiler corefonts flatito fluxcd gist perf_data_converter protoc-gen-js solana-cli swt verible; do
git checkout -- "pkgs/by-name/${n:0:2}/${n}"
done
This focuses on Rust packages, since the most commonly used argument
parser library (clap/structopt) makes the following pattern natural and
thus common:
postInstall = ''
installShellCompletion --cmd foo \
--bash <($out/bin/foo completion bash) \
…
This commit just guards those with
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform)
splitting the string where unrelated actions are performed.
I added `asciidoctor` to the nativeBuildInputs as I saw warnings that it
wasn't found as I built the tool.
I also stopped using `rec` syntax as the nixpkgs manual recommends
[against it](https://nixos.org/manual/nixpkgs/unstable/#mkderivation-recursive-attributes).
However, `rustPlatform.buildRustPackage` doesn't allow the use of
`mkDerivation (finalAttrs: {` form, so it's just a simple `let` binding
here.