Skip to content

Allowing the configure_shell_profile function to make directories #13119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Frizzus
Copy link

@Frizzus Frizzus commented Apr 30, 2025

Motivation

After installing Nix using the recommended method, I noticed that nix commands were not available in my shell.

Context

Similar to this issue i'm using Solus linux ( Solus-Budgie-Release-2025-01-26 ).
When configuring shells the configure_shell_profile() function will try to configure nix at several places :

  • /etc/bashrc
  • /etc/profile.d/nix.sh
  • /etc/zshrc
  • /etc/bash.bashrc
  • /etc/zsh/zshrc

This has been added in the following commit by @abathur.
However, the code does not create directories if it's missing, it's assuming that /etc/ /etc/profile.d/ and /etc/zsh/ exists.

Unfortunately in Solus linux the /etc/profile.d/ directory does not exist.
It becomes a problem because solus linux's user .bashrc only source the /etc/profile file.

default ~/.bashrc

source /usr/share/defaults/etc/profile

The sourced file will source the /etc/profile.d/ directory if it exists.

/usr/share/defaults/etc/profile

if [ -d /usr/share/defaults/etc/profile.d ] ; then
    for script in /usr/share/defaults/etc/profile.d/*.sh; do
        if [ -r $script ] ; then
            source $script
        fi
    done
    unset script
fi

if [ -d /etc/profile.d ] ; then
    for script in /etc/profile.d/*.sh; do
        if [ -r $script ] ; then
            source $script
        fi
    done
    unset script
fi

So to set up the shell of solus linux's user, the install script must create at least the profile.d directory.

PS : I'm struggling to find a way to make test for this.
The test tool seems to automatically create /outputs/out/etc/profile.d before testing the install script.

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