fix(nix): Use fallback pattern for nix profile sourcing #19
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)