Skip to content

Conversation

@devin-ai-integration
Copy link

@devin-ai-integration devin-ai-integration bot commented Dec 24, 2025

Why are the changes needed?

The hardcoded path /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh doesn't exist in all Nix installations. Specifically, Depot build containers with single-user Nix installs fail with:

/bin/sh: 1: .: cannot open /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh: No such file

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_TEMPLATE with a robust approach to ensure nix is available:

  1. Explicit PATH export: Adds /nix/var/nix/profiles/default/bin to PATH upfront, guaranteeing nix is available even if no profile scripts exist
  2. Profile sourcing fallback: Tries multiple possible Nix profile locations in order:
    • /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)
  3. Early failure check: Uses command -v nix to fail with a clear error message if nix is still not found after all attempts

Updates since last revision

  • Added explicit export PATH="/nix/var/nix/profiles/default/bin:$PATH" to guarantee nix availability
  • Added command -v nix check 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

  • Verify the shell command syntax is correct for Dockerfile RUN commands (chained with && and ;)
  • Verify the $$PATH escaping is correct for Python string templates used in Dockerfiles
  • Confirm the command -v nix check properly fails the build if nix is not found

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

Related PRs

  • exa-labs/monorepo#11738 - Companion PR fixing the same issue in monorepo Docker files and updating the flytekit pin

Link to Devin run: https://app.devin.ai/sessions/3d935666f79d41a18baa4f71ad74689c
Requested by: Samuel Mitchell (@sammiphone6)

…_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>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

devin-ai-integration bot and others added 2 commits December 24, 2025 11:55
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant