fix(nix): Use fallback pattern for nix profile sourcing#19
Open
devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
Open
fix(nix): Use fallback pattern for nix profile sourcing#19devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
devin-ai-integration[bot] wants to merge 3 commits intomasterfrom
Conversation
…_FILE_TEMPLATE The hardcoded path /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh doesn't exist in all Nix installations (e.g., Depot build containers with single-user Nix installs). Updated to try multiple possible locations in order: 1. /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh (multi-user daemon) 2. /nix/var/nix/profiles/default/etc/profile.d/nix.sh (determinate systems) 3. /etc/profile.d/nix.sh (system-wide) 4. /root/.nix-profile/etc/profile.d/nix.sh (single-user install) Co-Authored-By: Samuel Mitchell <sammiphone6@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
The previous fix only tried to source profile scripts, but if none exist (e.g., with --init none), nix would not be on PATH, causing exit code 127. This change: 1. Adds explicit PATH export for /nix/var/nix/profiles/default/bin 2. Keeps the profile sourcing loop as a fallback 3. Adds a command -v check to fail early with a clear error if nix is still not found Co-Authored-By: Samuel Mitchell <sammiphone6@gmail.com>
The previous fix only added /nix/var/nix/profiles/default/bin to PATH, but in single-user installs (--init none), nix might be at different locations. This change: 1. Adds all possible nix bin locations to PATH: - /nix/var/nix/profiles/default/bin - /root/.nix-profile/bin - /nix/var/nix/profiles/per-user/root/profile/bin 2. Makes the build self-healing: if nix is not found (cache eviction), reinstall it in the same RUN step 3. Adds diagnostic output on failure to help debug future issues Co-Authored-By: Samuel Mitchell <sammiphone6@gmail.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why are the changes needed?
The hardcoded path
/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.shdoesn't exist in all Nix installations. Specifically, Depot build containers with single-user Nix installs fail with:This blocks all Flyte workflow submissions that use the
NIX_DOCKER_FILE_TEMPLATE.What changes were proposed in this pull request?
Updated the
NIX_DOCKER_FILE_TEMPLATEwith a robust approach to ensurenixis available:/nix/var/nix/profiles/default/binto PATH upfront, guaranteeingnixis available even if no profile scripts exist/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh(multi-user daemon install)/nix/var/nix/profiles/default/etc/profile.d/nix.sh(determinate systems)/etc/profile.d/nix.sh(system-wide)/root/.nix-profile/etc/profile.d/nix.sh(single-user install)command -v nixto fail with a clear error message if nix is still not found after all attemptsUpdates since last revision
export PATH="/nix/var/nix/profiles/default/bin:$PATH"to guarantee nix availabilitycommand -v nixcheck to fail early with clear error instead of silently continuing (addresses the reviewer note from the previous revision)How was this patch tested?
This change is part of a broader fix across the exa-labs/monorepo (PR #11738) where the same pattern was applied to multiple Docker-related files. The pattern has been validated to work with the Determinate Systems Nix installer.
Human review checklist
&∧)$$PATHescaping is correct for Python string templates used in Dockerfilescommand -v nixcheck properly fails the build if nix is not foundCheck all the applicable boxes
Related PRs
Link to Devin run: https://app.devin.ai/sessions/3d935666f79d41a18baa4f71ad74689c
Requested by: Samuel Mitchell (@sammiphone6)