Skip to content

Commit 8edaf64

Browse files
Add parallel dependency compilation env variable (#13)
Projects using this Feature will benefit from the recommended setting of this new environment variable to half the available CPUs. https://elixir-lang.org/blog/2025/10/16/elixir-v1-19-0-released/#parallel-compilation-of-dependencies
2 parents d83f4f5 + d493ae2 commit 8edaf64

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/elixir-project/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "elixir-project",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"name": "elixir-project",
55
"description": "An opinionated, batteries-included Dev Container Feature for Elixir projects.",
66
"documentationURL": "https://github.com/CargoSense/devcontainer-features/tree/main/src/elixir-project",

src/elixir-project/scripts/onCreateCommand.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ BASHRC_DIR="${HOME}/.bashrc.d"
1111
mkdir -p "${BASHRC_DIR}"
1212
chmod 700 "${BASHRC_DIR}"
1313

14-
# Configure environment variables that rely on `CONTAINER_WORKSPACE_FOLDER`
14+
# Configure environment variables that rely on `CONTAINER_WORKSPACE_FOLDER` and
15+
# set dependency compilation parallelism (new in Elixir v1.19)
1516
cat << EOF > "${BASHRC_DIR}/elixir-project.bashrc"
1617
export HISTFILE="${CONTAINER_WORKSPACE_FOLDER}/.bash_history"
1718
export ERL_AFLAGS="-kernel shell_history enabled -kernel shell_history_path '\\"${CONTAINER_WORKSPACE_FOLDER}/.iex_history\\"'"
19+
export MIX_OS_DEPS_COMPILE_PARTITION_COUNT="\$(( "\$(nproc --all)" / 2 ))"
1820
EOF
1921

2022
chmod +x "${BASHRC_DIR}/elixir-project.bashrc"

test/elixir-project/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -e
77
source dev-container-features-test-lib
88

99
# Feature-specific tests
10-
check "environment" bash -c "env | grep ERL_AFLAGS"
10+
check "environment" bash -c "env | grep ERL_AFLAGS && env | grep MIX_OS_DEPS_COMPILE_PARTITION_COUNT"
1111
check "gitignore" grep -xF .bash_history .gitignore
1212

1313
# Report result

0 commit comments

Comments
 (0)