So, in order to avoid typing “flatpak run”, every time I need to run a flatpak program from the terminal, to have gui programs installed using nix appear in my applications menu(rofi, in this case), and to avoid typing the entire path to my .local/bin, I had added the following lines to my .profile:

set PATH so it includes user’s private bin if it exists

if [ -d “$HOME/bin” ] ; then export PATH=“$HOME/bin:$PATH” fi

set PATH so it includes user’s private bin if it exists

if [ -d “$HOME/.local/bin” ] ; then export PATH=“$HOME/.local/bin:$PATH” fi

for desktop entries for packages installed using Nix

export XDG_DATA_DIRS=“/home/guest/.nix-profile/share:$XDG_DATA_DIRS”

set PATH so it includes user’s private bin if it exists

if [ -d “/var/lib/flatpak/exports/bin” ] ; then export PATH=“/var/lib/flatpak/exports/bin:$PATH” fi

if [ -d “~/.local/share/flatpak/exports/bin” ] ; then export PATH=“~/.local/share/flatpak/exports/bin:$PATH” fi

However, for some weird reason, I cannot take advantage of the above lines unless I am in a tmux session or I explicitly type the following command:

source .profile

Any ideas on how to fix this?

EDIT: Adding the following line to .xsessionrc fixed the issue (haven’t checked for wayland sessions though).

. $HOME/.profile

#Debian #Debian11 #foss #floss #libre_software #applications #desktop #gui #nix #flatpak #flatpaks #gnu #linux #opensource #open_source #tmux #bash #profile #shell #terminal

    • Ann Onymous@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      3
      ·
      11 months ago

      Does your .bashrc actually source .bash_profile? Add [ ! -f "~/.bash_profile" ] || . "~/.bash_profile" (.bash_profile doesn’t exist or source it) to the end if not.

      • aebletrae [she/her]@hexbear.net
        link
        fedilink
        English
        arrow-up
        1
        ·
        11 months ago

        Since .bashrc is executed for all non-login shells, it shouldn’t really source .profile, which is only meant for login shells, and might trigger expensive activity. (.profile might source .bashrc, but that`s fine.)

    • bahmanm@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      11 months ago

      You’ve probably already checked it out but make sure you’ve got only one of .profile, .bash_profile, .bashprofile. bash will only execute one of them in case there’s more than one (not sure which one off the top of my head.)

      • Libre Extremist@lemmy.mlOP
        link
        fedilink
        English
        arrow-up
        2
        arrow-down
        1
        ·
        11 months ago

        I only have .profile. Actually adding those lines as to .bashrc as suggested by @palordrolap@kbin.social helped for the flatpak commands. But the issue with .desktop files for programs installed using nix still persists.