mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-29 17:33:46 +03:00
feature: installMethod copy
This commit is contained in:
parent
bfcd5b6f35
commit
c5126b2053
@ -99,6 +99,8 @@ let
|
||||
|
||||
pname = utils.sanitizeDerivationName name;
|
||||
|
||||
installMethod = "symlink";
|
||||
|
||||
# only run build on the main package
|
||||
runBuild =
|
||||
packageName == mainPackageName
|
||||
@ -237,12 +239,12 @@ let
|
||||
for submodule in $(ls $dep/lib/node_modules/$module); do
|
||||
mkdir -p $nodeModules/$packageName/node_modules/$module
|
||||
echo "installing: $module/$submodule"
|
||||
ln -s $dep/lib/node_modules/$module/$submodule $nodeModules/$packageName/node_modules/$module/$submodule
|
||||
ln -s $(realpath $dep/lib/node_modules/$module/$submodule) $nodeModules/$packageName/node_modules/$module/$submodule
|
||||
done
|
||||
else
|
||||
mkdir -p $nodeModules/$packageName/node_modules/
|
||||
echo "installing: $module"
|
||||
ln -s $dep/lib/node_modules/$module $nodeModules/$packageName/node_modules/$module
|
||||
ln -s $(realpath $dep/lib/node_modules/$module) $nodeModules/$packageName/node_modules/$module
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@ -251,6 +253,24 @@ let
|
||||
# symlink sub dependencies as well as this imitates npm better
|
||||
python ${./symlink-deps.py}
|
||||
|
||||
# resolve symlinks to copies
|
||||
if [ "$installMethod" == "copy" ]; then
|
||||
echo "transforming symlinked dependencies to copies..."
|
||||
chmod +wx .
|
||||
for f in $(find . -type l); do
|
||||
if [ -f $f ]; then
|
||||
continue
|
||||
fi
|
||||
chmod +wx $(dirname "$f")
|
||||
mv "$f" "$f.bak"
|
||||
mkdir "$f"
|
||||
if [ -n "$(ls -A "$f.bak/")" ]; then
|
||||
cp -r "$f.bak"/* "$f/"
|
||||
fi
|
||||
rm "$f.bak"
|
||||
done
|
||||
fi
|
||||
|
||||
# add dependencies to NODE_PATH
|
||||
export NODE_PATH="$NODE_PATH:$nodeModules/$packageName/node_modules"
|
||||
|
||||
|
@ -62,7 +62,7 @@ for dep in deps:
|
||||
pathlib.Path(os.path.dirname(path)).mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# symlink dependency
|
||||
os.symlink(dep, path)
|
||||
os.symlink(os.path.realpath(dep), path)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user