milahu / nodejs-hide-symlinks Goto Github PK
View Code? Open in Web Editor NEWhide symlinks from nodejs, to implement a symlinked machine-level global NPM store
License: MIT License
hide symlinks from nodejs, to implement a symlinked machine-level global NPM store
License: MIT License
it works : )
git clone --depth=1 https://github.com/milahu/nur-packages
nix-build . -A nodePackages.cowsay
./result/bin/cowsay yeah
currently, this will flood the console with debug messages from nodejs-hide-symlinks
nodejs-hide-symlinks init /home/user/src/milahu/nur-packages
nodejs-hide-symlinks stat result/
nodejs-hide-symlinks open result/opt/cowsay/package.json
nodejs-hide-symlinks open result/opt/cowsay/cli.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/yargs/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/yargs.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/yargs.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/command.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/common-types.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/is-promise.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/middleware.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/argsert.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/yerror.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/parse-command.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/require-directory/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/require-directory/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/require-directory/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/require-directory/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/which-module/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/which-module/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/which-module/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/which-module/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/parser/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs-parser/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs-parser/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs-parser/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/camelcase/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/camelcase/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/camelcase/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/camelcase/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/decamelize/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/decamelize/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/decamelize/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/decamelize/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs-parser/lib/tokenize-arg-string.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs-parser/lib/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/usage.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/obj-filter.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/decamelize/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/set-blocking/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/set-blocking/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/set-blocking/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/set-blocking/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/string-width/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/string-width/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/string-width/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/string-width/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/strip-ansi/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/strip-ansi/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/strip-ansi/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/strip-ansi/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/ansi-regex/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/ansi-regex/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/ansi-regex/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/ansi-regex/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/is-fullwidth-code-point/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/is-fullwidth-code-point/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/is-fullwidth-code-point/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/is-fullwidth-code-point/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/emoji-regex/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/emoji-regex/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/emoji-regex/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/emoji-regex/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/completion.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/completion-templates.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/validation.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/levenshtein.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/apply-extends.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/yargs/build/lib/process-argv.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/y18n/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/y18n/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/y18n/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/y18n/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/find-up/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/find-up/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/find-up/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/find-up/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/locate-path/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/locate-path/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/locate-path/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/locate-path/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-locate/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-locate/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-locate/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-locate/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-limit/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-limit/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-limit/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-limit/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-try/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-try/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-try/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/p-try/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/path-exists/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/path-exists/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/path-exists/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/path-exists/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/require-main-filename/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/require-main-filename/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/require-main-filename/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/require-main-filename/package.json
nodejs-hide-symlinks open result/opt/cowsay/package.json
nodejs-hide-symlinks open result/opt/cowsay/index.js
nodejs-hide-symlinks open result/opt/cowsay/lib/balloon.js
nodejs-hide-symlinks open result/opt/cowsay/lib/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/string-width/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/string-width/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/string-width/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/string-width/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/strip-ansi/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/strip-ansi/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/strip-ansi/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/strip-ansi/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/ansi-regex/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/ansi-regex/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/ansi-regex/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/ansi-regex/package.json
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/is-fullwidth-code-point/package.json
nodejs-hide-symlinks stat result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/is-fullwidth-code-point/
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/is-fullwidth-code-point/index.js
nodejs-hide-symlinks open result/opt/cowsay/node_modules/.pnpm/[email protected]/node_modules/is-fullwidth-code-point/package.json
nodejs-hide-symlinks open result/opt/cowsay/lib/cows.js
nodejs-hide-symlinks open result/opt/cowsay/lib/replacer.js
nodejs-hide-symlinks open result/opt/cowsay/lib/faces.js
nodejs-hide-symlinks open result/opt/cowsay/cows/default.cow
______
< yeah >
------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
result/bin/cowsay has the shebang line
#!/nix/store/mlk58f365w12lbl6rrlfzwhxv6x123cq-nodejs-hide-symlinks-18.16.1/bin/node
nodejs-hide-symlinks-18.16.1/bin/node is a wrapper for node
#!/nix/store/mh1c3p23xby3chc3q0c0g78fa1nn65yw-bash-5.2-p15/bin/sh
LD_PRELOAD=/nix/store/nk08975n3wawpn5q37wnxiirpsbjjjh1-libnodejs-hide-symlinks-unstable-2021-09-29/lib/libnodejs_hide_symlinks.so \
exec /nix/store/p0f8i04zwf1dd66n2qkazk5x0fbsy7mp-nodejs-18.16.1/bin/node "$@"
node_modules is a symlink
$ readlink result/opt/cowsay/node_modules
/nix/store/ajnv4hcqhgqqllg5rsvvh3grdnb8bmzr-cowsay-1.5.0-node-modules/node_modules
node modules are symlinked to .pnpm
$ ls -lA /nix/store/ajnv4hcqhgqqllg5rsvvh3grdnb8bmzr-cowsay-1.5.0-node-modules/node_modules
total 20
dr-xr-xr-x 2 root root 4096 1. Jan 1970 .bin
lrwxrwxrwx 1 root root 36 1. Jan 1970 execa -> .pnpm/[email protected]/node_modules/execa
lrwxrwxrwx 1 root root 44 1. Jan 1970 get-stdin -> .pnpm/[email protected]/node_modules/get-stdin
dr-xr-xr-x 150 root root 4096 1. Jan 1970 .pnpm
dr-xr-xr-x 2 root root 4096 1. Jan 1970 @rollup
lrwxrwxrwx 1 root root 39 1. Jan 1970 rollup -> .pnpm/[email protected]/node_modules/rollup
lrwxrwxrwx 1 root root 66 1. Jan 1970 rollup-plugin-string -> .pnpm/[email protected]/node_modules/rollup-plugin-string
lrwxrwxrwx 1 root root 50 1. Jan 1970 string-width -> .pnpm/[email protected]/node_modules/string-width
lrwxrwxrwx 1 root root 64 1. Jan 1970 strip-final-newline -> .pnpm/[email protected]/node_modules/strip-final-newline
lrwxrwxrwx 1 root root 40 1. Jan 1970 tap-dot -> .pnpm/[email protected]/node_modules/tap-dot
lrwxrwxrwx 1 root root 34 1. Jan 1970 tape -> .pnpm/[email protected]/node_modules/tape
lrwxrwxrwx 1 root root 37 1. Jan 1970 yargs -> .pnpm/[email protected]/node_modules/yargs
modules in .pnpm are symlinked to the nix store.
these are the symlinks that are hidden by nodejs-hide-symlinks, so they appear as regular directories
$ readlink /nix/store/ajnv4hcqhgqqllg5rsvvh3grdnb8bmzr-cowsay-1.5.0-node-modules/node_modules/.pnpm/[email protected]/node_modules/rollup
/nix/store/i4hvjsqggcf3rvdy9hx8bcyilxylfs8h-rollup-2.26.5
executables in node_modules/.bin are wrapper scripts
because the original executables are read-only, so we cannot patch shebang lines
example: node_modules/.bin/rollup
#!/nix/store/mh1c3p23xby3chc3q0c0g78fa1nn65yw-bash-5.2-p15/bin/sh
set -e
b="$(readlink -f "$(dirname "$0")")"
p="$(dirname "$b")/.pnpm"
n="$p/[email protected]/node_modules"
export NODE_PATH="\
$n/rollup/dist/bin/node_modules:\
$n/rollup/dist/node_modules:\
$n/rollup/node_modules:\
$n:\
$p/node_modules:\
$NODE_PATH"
[ -x "$b/node" ] &&
exec "$b/node" "$n/rollup/dist/bin/rollup" "$@"
exec "/nix/store/mlk58f365w12lbl6rrlfzwhxv6x123cq-nodejs-hide-symlinks-18.16.1/bin/node" "$n/rollup/dist/bin/rollup" "$@"
nix expressions in my nur-packages:
instead of writing rust with unsafe
code everywhere, it should be cleaner/easier to write this in C code
sample project: https://github.com/abba23/spotify-adblock-linux
currently, the rust version compiles to 450 KB, better would be like 20 to 50 KB for such a simple program
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.