-
-
Notifications
You must be signed in to change notification settings - Fork 10
feat: make use of Nix files to set up dev env #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aduh95
wants to merge
11
commits into
main
Choose a base branch
from
nix-env
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+91
−70
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
f6543b1
feat: make use of Nix files to set up dev env
aduh95 3a89bf6
Update Dockerfile
aduh95 7534642
Use the same Nix version as the one tested by GHA
aduh95 885db6b
fix PATH
aduh95 cfde596
add `direnv` and `USE_SHARED_LIBS` arg
aduh95 b7b5eed
fixup! move ARG down to avoid needlesly invalidate cache
aduh95 a8c190f
squash! also use vendored ICU
aduh95 6b487ff
Add comments
aduh95 5686fcf
fixup! Add comments
aduh95 7f78042
fix quoting in `install-node`
aduh95 17b2b04
add `IMAGE_VARIANT` build var
aduh95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Image variants using Nix and direnv | ||
|
|
||
| `.envrc` files are consumed by [nix-direnv][], and will install software and | ||
| environment variables defined in the [`shell.nix`][] in the nodejs/node repository. | ||
|
|
||
| To add an image variant, add a new file starting with `use nix` with the flags such as: | ||
|
|
||
| - [`--impure`][]: to make sure user can still access non-Nix software. | ||
| - [`-I nixpkgs=/home/developer/nodejs/node/tools/nix/pkgs.nix`][`-I`]: | ||
| that defines which version of the [NixOS/nixpkgs][] repository it should load. | ||
| - [`--arg <key> <nix-value>`][`--arg`]: Override the default values defines in the | ||
| [`shell.nix`][] with some custom value. | ||
| - [`--argstr <key> <string-value>`][`--argstr`]: Useful to avoid the double quoting, | ||
| e.g. instead of `--arg icu '"small"'`, it is equivalent to pass `--argstr icu small`. | ||
|
|
||
| It is possible to add custom environment variables, or to override Nix-defined ones by | ||
| adding `export NAME_OF_THE_VAR=value` lines at the end of the file, however it is | ||
| preferred to keep all environment variable definitions in one place. | ||
|
|
||
| [nix-direnv]: https://github.com/nix-community/nix-direnv | ||
| [`shell.nix`]: https://github.com/nodejs/node/blob/HEAD/shell.nix | ||
| [NixOS/nixpkgs]: https://github.com/NixOS/nixpkgs | ||
| [`--impure`]: https://nix.dev/manual/nix/2.33/command-ref/nix-shell.html#opt-impure | ||
| [`-I`]: https://nix.dev/manual/nix/2.33/command-ref/nix-shell.html#opt-I | ||
| [`--arg`]: https://nix.dev/manual/nix/2.33/command-ref/nix-shell.html#opt-arg | ||
| [`--argstr`]: https://nix.dev/manual/nix/2.33/command-ref/nix-shell.html#opt-argstr |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| use nix --impure -I nixpkgs=/home/developer/nodejs/node/tools/nix/pkgs.nix |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| use nix --impure -I nixpkgs=/home/developer/nodejs/node/tools/nix/pkgs.nix \ | ||
| --arg sharedLibDeps '{}' \ | ||
| --argstr icu full |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e # Exit with nonzero exit code if anything fails | ||
| set -xe | ||
|
|
||
| /home/developer/nodejs/node/configure --ninja && make -C /home/developer/nodejs/node | ||
| cd /home/developer/nodejs/node | ||
| eval "$(direnv export bash)" | ||
|
|
||
| # Build tools and env variables (including e.g. BUILD_WITH=ninja) are | ||
| # defined in https://github.com/nodejs/node/blob/HEAD/shell.nix | ||
| make -C /home/developer/nodejs/node build-ci | ||
aduh95 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e # Exit with nonzero exit code if anything fails | ||
| set -xe | ||
|
|
||
| mkdir -p /home/developer/nodejs | ||
| cd /home/developer/nodejs | ||
| git clone https://github.com/nodejs/node.git --single-branch --branch main --depth 1 | ||
| cd /home/developer/nodejs/node | ||
| git remote add upstream https://github.com/nodejs/node.git | ||
| git restore-mtime # Restore file modification times to commit times for build cache to match. | ||
| git clone https://github.com/nodejs/node.git --depth 1 /home/developer/nodejs/node | ||
| ( | ||
| cd /home/developer/nodejs/node | ||
| git remote add upstream https://github.com/nodejs/node.git | ||
| git restore-mtime # Restore file modification times to commit times for build cache to match. | ||
| ) |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,13 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e # Exit with nonzero exit code if anything fails | ||
| set -xe | ||
|
|
||
| cd /home/developer/nodejs/node | ||
| eval "$(direnv export bash)" | ||
|
|
||
| make install PREFIX=/home/developer/.local -C /home/developer/nodejs/node | ||
| echo '' >> /home/developer/.bashrc | ||
| echo 'export PATH=/home/developer/.local/bin:$PATH' >> /home/developer/.bashrc | ||
| { | ||
| echo '' | ||
| # Expose the PATH generated by Nix + the recently built `node` installation | ||
| echo 'export PATH=/home/developer/.local/bin:$PATH' | ||
| } >> /home/developer/.bashrc |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -e # Exit with nonzero exit code if anything fails | ||
| set -xe | ||
|
|
||
| npm install -g @node-core/utils | ||
| cd /home/developer/nodejs/node | ||
| eval "$(direnv export bash)" | ||
|
|
||
| ncu-config set upstream upstream | ||
| ncu-config set branch main |
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.