Created
December 4, 2017 07:17
-
-
Save LisannaAtHome/4e7b38fbd426e9d5d78b25512aff526f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
fixup = options: name: file: stdenvNoCC.mkDerivation | |
( options // | |
{ inherit name; | |
installPhase = | |
''cp -r ${file} $out | |
''; | |
} | |
); | |
wrap = { paths ? [], vars ? {}, file ? null, script ? null, name ? "wrap" }: | |
assert file != null || script != null || | |
abort "wrap needs 'file' or 'script' argument"; | |
with rec | |
{ set = n: v: | |
"--set ${escapeShellArg (escapeShellArg n)} " + | |
"'\"'${escapeShellArg (escapeShellArg v)}'\"'"; | |
args = | |
(map (p: "--prefix PATH : ${p}/bin") paths) ++ | |
(attrValues (mapAttrs set vars)); | |
}; | |
runCommand name | |
{ f = | |
if file == null then writeScript name script | |
else file; | |
buildInputs = [ makeWrapper ]; | |
} | |
'' makeWrapper "$f" "$out" ${toString args} | |
''; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment