Skip to content

Conversation

gcurtis
Copy link
Collaborator

@gcurtis gcurtis commented Oct 6, 2022

Summary

When launching a devbox shell, we filter out any Nix user profiles from the PATH (i.e., ~/.nix-profile). This fixes a couple of bugs with how we determine if a PATH directory matches a Nix profile:

  1. The strings.HasPrefix("/Users", profileDir) call is backwards.
  2. Checking for /Users is macOS-specific and won't work on Linux. Instead, check if the directory starts with /nix to determine if it's the default system profile.

How was it tested?

Added a test.

When launching a devbox shell, we filter out any Nix user profiles from
the PATH (i.e., ~/.nix-profile). This fixes a couple of bugs with how we
determine if a PATH directory matches a Nix profile:

1. The `strings.HasPrefix("/Users", profileDir)` call is backwards.
2. Checking for `/Users` is macOS-specific and won't work on Linux.
   Instead, check if the directory starts with `/nix` to determine if
   it's the default system profile.
@gcurtis gcurtis requested a review from savil October 6, 2022 19:15
Copy link
Collaborator

@savil savil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh 🤦🏾

Thank you!

@gcurtis
Copy link
Collaborator Author

gcurtis commented Oct 6, 2022

This is just waiting on the test fix in #219.

@gcurtis gcurtis merged commit 93d61d0 into main Oct 6, 2022
@gcurtis gcurtis deleted the gcurtis/profile-dirs branch October 6, 2022 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants