help-guix
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help-Guix Digest, Vol 88, Issue 4


From: Gary Johnson
Subject: Re: Help-Guix Digest, Vol 88, Issue 4
Date: Tue, 21 Mar 2023 10:42:56 -0400

Gottfried <gottfried@posteo.de> writes:

> I have got now 3 profiles: EmacsManifest, Musescore, Musik
> in:  home/gfp/Projekte/
>
> Now I want them to be activated at login time.
>
> I still am not sure how to do that.

To activate multiple profiles at login time, I created a shell script
called `~/sys/scripts/activate-profiles.sh`, containing the following code:

```
#!/bin/sh

GUIX_PROFILES=/home/gjohnson/sys/guix/profiles

for dir in $GUIX_PROFILES/*
do
    name=$(basename "$dir")
    profile=$dir/$name
    if [ -f "$profile"/etc/profile ]
    then
        GUIX_PROFILE="$profile"
        . "$GUIX_PROFILE"/etc/profile
        export MANPATH="$GUIX_PROFILE/share/man${MANPATH:+:}$MANPATH"
        export INFOPATH="$GUIX_PROFILE/share/info${INFOPATH:+:}$INFOPATH"
    fi
    unset profile
    unset name
done
```

Next, I added a `source` line to my `~/.bash_profile` file, which loads
the `activate-profiles.sh` script when I enter a login shell. This
script is also run when you log in to your graphical desktop session in
Guix.

```
# Activate all of my Guix profiles
source ~/sys/scripts/activate-profiles.sh
```

For you to use this approach, you should do the following:

1. Replace `GUIX_PROFILES=/home/gjohnson/sys/guix/profiles` in my
   `activate-profiles.sh` script with your profile directory, which
   seems to be this:

   `GUIX_PROFILES=/home/gfp/Projekte`

2. Place the `activate-profiles.sh` script somewhere in your home
   directory.

3. Replace `~/sys/scripts/activate-profiles.sh` in `~/.bash_profile`
   with the path to `activate-profiles.sh` on your system.

If you use `guix home`, you can certainly add the `source` line to
`~/.bash_profile` that way.

> 2. after that, could I uninstall the package emacs in my main profile?
> Will my Emacs-manifest profile still be usable/is it independent, or
> it will suffer through uninstalling emacs in my main profile?

With this code in place, whenever you log in to your machine, you will
have access to all the packages in your main user profile as well as all
the packages in your /home/gfp/Projekte profiles. Note that this may
lead to unpredictable behavior if you have the same package installed
into multiple profiles that are all activated simultaneously. My
recommendation is that you install each package into only one profile
when using this approach.

> My aim was to uninstall packages in my main profile and put them in
> separate profiles, so in updating my main profile with less packages
> it doesn’t take so much time.

Yes, that is precisely the purpose of this approach.

Happy hacking!
  Gary

-- 
Protect yourself from surveillance: https://emailselfdefense.fsf.org
=======================================================================
()  ascii ribbon campaign - against html e-mail
/\  www.asciiribbon.org   - against proprietary attachments

Why is HTML email a security nightmare? See https://useplaintext.email/

Please avoid sending me MS-Office attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]