1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p nix nix-update
6 nix-update
"${UPDATE_NIX_ATTR_PATH}"
7 nix-update
"${UPDATE_NIX_ATTR_PATH}.npmPkg" --version=skip
9 FILE
="$(nix-instantiate --eval -E 'with import ./. {}; (builtins.unsafeGetAttrPos "version
" '"${UPDATE_NIX_ATTR_PATH}"').file' | tr -d '"')"
11 MVNHASH_OLD=$(nix-instantiate --eval . -A "${UPDATE_NIX_ATTR_PATH}.mvnHash" | tr -d '"')
12 MVNHASH_OLD_ESCAPED=$(echo "${MVNHASH_OLD}" | sed -re 's|[+]|\\&|g')
13 FAKEHASH=$(nix-instantiate --eval . -A "lib.fakeHash
" | tr -d '"')
14 FAKEHASH_ESCAPED=$(echo "${FAKEHASH}" | sed -re 's|
[+]|
\\&|g
')
16 sed -E -i "s|${MVNHASH_OLD_ESCAPED}|${FAKEHASH}|g" "${FILE}"
18 MVNHASH_NEW="$(nix-build . -A "${UPDATE_NIX_ATTR_PATH}" 2>&1 | tail -n10 | grep 'got
:' | cut -d: -f2- | xargs echo || true)"
20 sed -E -i "s|${FAKEHASH_ESCAPED}|${MVNHASH_NEW}|g" "${FILE}"