node updater improvements

- Make it run from anywhere
- overwrite old packages only on success to prevent getting into a bad
state
This commit is contained in:
Matthieu Coudron 2019-10-11 21:45:41 +09:00
parent d7a03511b6
commit 33323e4006
2 changed files with 21 additions and 7 deletions

View File

@ -1,10 +1,15 @@
#!/usr/bin/env nix-shell
#! nix-shell -I nixpkgs=../../.. -i bash -p nodePackages.node2nix
# NOTE: Script must be run from the node-packages directory
#! nix-shell shell-generate.nix -i bash
set -eu -o pipefail
rm -f node-env.nix
node2nix --nodejs-10 -i node-packages-v10.json -o node-packages-v10.nix -c composition-v10.nix
node2nix --nodejs-12 -i node-packages-v12.json -o node-packages-v12.nix -c composition-v12.nix
node2nix --nodejs-13 -i node-packages-v13.json -o node-packages-v13.nix -c composition-v13.nix
cd "$NODE_NIXPKGS_PATH/pkgs/development/node-packages"
rm -f ./node-env.nix
for version in 10 12 13; do
tmpdir=$(mktemp -d)
node2nix --nodejs-$version -i node-packages-v$version.json -o $tmpdir/node-packages-v$version.nix -c $tmpdir/composition-v$version.nix
if [ $? -eq 0 ]; then
mv $tmpdir/node-packages-v$version.nix .
mv $tmpdir/composition-v$version.nix .
fi
done
cd -

View File

@ -0,0 +1,9 @@
{ nixpkgs ? import ../../.. {} }:
with nixpkgs;
mkShell {
buildInputs = [
bash nodePackages.node2nix
];
NODE_NIXPKGS_PATH = toString ./.;
}