nixpkgs-suyu/pkgs/build-support/substitute/substitute.nix
Dave Nicponski 7914de9b8c substitute: init at 0
Similar to the colocated `substituteAll` script and derivation, this
PR adds nix-level support for `substitute` directly.  This is useful,
for instance, to be able to easily make tweaks to patch files for an
existing derivation's existing patch files.
2019-11-18 15:55:41 -05:00

14 lines
485 B
Nix

{ stdenvNoCC }:
args:
# This is a wrapper around `substitute` in the stdenv.
# The `replacements` attribute should be a list of list of arguments
# to `substitute`, such as `[ "--replace" "sourcetext" "replacementtext" ]`
stdenvNoCC.mkDerivation ({
name = if args ? name then args.name else baseNameOf (toString args.src);
builder = ./substitute.sh;
inherit (args) src;
preferLocalBuild = true;
allowSubstitutes = false;
} // args // { replacements = args.replacements; })