this post was submitted on 14 Aug 2023
15 points (100.0% liked)

Linux

45573 readers
1086 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

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?

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

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 10 months ago (1 children)

I had a similar issue some time ago, not sure which distro it was. The solution was to rename the .profile to .bash_profile :)

[–] [email protected] 2 points 10 months ago (2 children)

Thanks for the response. But in my case, even that does not work as well.

[–] [email protected] 3 points 10 months ago (2 children)

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.

[–] [email protected] 1 points 10 months ago

Adding those lines to .bashrc helped with flatpaks but not with nix.

[–] [email protected] 1 points 10 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.)

[–] [email protected] 2 points 10 months ago (1 children)

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.)

[–] [email protected] 2 points 10 months ago

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