bug#54354: [BUG] guix home: on foreign distro, ~/.bash_profile is not initialized

2022-10-18 Thread Andrew Tropin
On 2022-03-20 14:09, florhizome wrote:

> Hi Liliana,
>
> Hm, well it doesn't seem like the exact same issue, but that thread is
> helpful. Could systemd/logind be made to use bash for login?

Login shell is usually controlled by /etc/passwd, so it shouldn't
inerfer with systemd, elogind.

> For now I thought maybe I can just write shepherd services to do
> that stuff for me, to stay in guix homes framework. But shepherd seems
> to have a problem starting up:
>
> /gnu/store/y85vzni5yc6lcb7qqhmlkifis9nzmm5l-shepherd.conf wird geladen.
> herd: Ausnahmefehler während der Ausführung von »load« mit dem Dienst »root«:
> In procedure fport_write: Eingabe-/Ausgabefehler
>
> If you don't speak german, that roughly translates to:
>
> loading /gnu/store/...-shepherd.conf
> herd: exception error during the execution of <> with the service
> <>:
> In procedure fport_write: i/o error
>
> I got the same error when reconfiguring with two differing simple
> service configurations (just start a program from a package) passed to 
> shepherd.
> In anyway I think it would be good to add to guix home's documentation that 
> some features might not work
> due to the login system of a foreign distro if we are sure of that?
>

There were a few fixes related to shepherd service, which probably fixes
it.  Can you confirm this?  Or issue is still valid?

Is the whole issue 54354 still valid?

-- 
Best regards,
Andrew Tropin


signature.asc
Description: PGP signature


bug#54354: [BUG] guix home: on foreign distro, ~/.bash_profile is not initialized

2022-03-20 Thread florhizome


Hi Liliana,

Hm, well it doesn't seem like the exact same issue, but that thread is
helpful. Could systemd/logind be made to use bash for login? For now I thought 
maybe I can just write shepherd services to do
that stuff for me, to stay in guix homes framework. But shepherd seems
to have a problem starting up:

/gnu/store/y85vzni5yc6lcb7qqhmlkifis9nzmm5l-shepherd.conf wird geladen.
herd: Ausnahmefehler während der Ausführung von »load« mit dem Dienst »root«:
In procedure fport_write: Eingabe-/Ausgabefehler

If you don't speak german, that roughly translates to:

loading /gnu/store/...-shepherd.conf
herd: exception error during the execution of <> with the service
<>:
In procedure fport_write: i/o error

I got the same error when reconfiguring with two differing simple
service configurations (just start a program from a package) passed to shepherd.
In anyway I think it would be good to add to guix home's documentation that 
some features might not work
due to the login system of a foreign distro if we are sure of that?

cheers


Liliana Marie Prikler  writes:

> Hi Florian
>
> Am Samstag, dem 12.03.2022 um 13:07 + schrieb florhizome:
>> 
>> Hi guix' !
>> I have been trying to use guix home on my foreign distro partition
>> (manjaro); especially in order to set up additional profiles from
>> there, but my .bash_profile generated by guix doesn't seem to be
>> evaluated at all.
>> 
>> To describe the actual issue finally: None of the things that should
>> happen through .bash_profile seem to happen at the moment (it's just
>> about different environment variables that will not be set up.), but
>> after running bash --login in my terminal-emulator everything is as
>> anticipated so my guess is that .bash_profile actually isn't evaluated
>> at all after login.  I'm happy to hear other suggestions and especially
>> solutions.
> This looks vaguely like a problem others (myself included) have
> experienced/are experiencing on Ubuntu.  See [1] among others.
>
> Given that bash is not used for login, your environment-variables block
> has not effect.  Now if you were to define that inside a variable, you
> could also write up a service that generates systemd unit overrides and
> add those definitions to it.  I'm not sure how well-received such a
> service would be upstream given that we don't use systemd in Guix, but
> it's a point to start.
>
> Cheers
>
> [1] https://issues.guix.gnu.org/48300#7





bug#54354: [BUG] guix home: on foreign distro, ~/.bash_profile is not initialized

2022-03-12 Thread Liliana Marie Prikler
Hi Florian

Am Samstag, dem 12.03.2022 um 13:07 + schrieb florhizome:
> 
> Hi guix' !
> I have been trying to use guix home on my foreign distro partition
> (manjaro); especially in order to set up additional profiles from
> there, but my .bash_profile generated by guix doesn't seem to be
> evaluated at all.
> 
> To describe the actual issue finally: None of the things that should
> happen through .bash_profile seem to happen at the moment (it's just
> about different environment variables that will not be set up.), but
> after running bash --login in my terminal-emulator everything is as
> anticipated so my guess is that .bash_profile actually isn't evaluated
> at all after login.  I'm happy to hear other suggestions and especially
> solutions.
This looks vaguely like a problem others (myself included) have
experienced/are experiencing on Ubuntu.  See [1] among others.

Given that bash is not used for login, your environment-variables block
has not effect.  Now if you were to define that inside a variable, you
could also write up a service that generates systemd unit overrides and
add those definitions to it.  I'm not sure how well-received such a
service would be upstream given that we don't use systemd in Guix, but
it's a point to start.

Cheers

[1] https://issues.guix.gnu.org/48300#7





bug#54354: [BUG] guix home: on foreign distro, ~/.bash_profile is not initialized

2022-03-12 Thread florhizome

Hi guix' !
I have been trying to use guix home on my foreign distro partition
(manjaro); especially in order to set up additional profiles from
there, but my .bash_profile generated by guix doesn't seem to be
evaluated at all.

To describe the actual issue finally: None of the things that should happen 
through .bash_profile seem to
happen at the moment (it's just about different environment variables that
will not be set up.), but after running bash --login in my
terminal-emulator everything is as anticipated so my guess is that
.bash_profile actually isn't evaluated at all after login. I'm happy to hear
other suggestions and especially solutions.

I will attach the file that I use
for home configuration, as well as the current resulting .bashrc,
.bash_profile and .profile files.
I'm aware that there is duplicated code by the generated aliases in
.bashrc and that the prompt customization  for guix profiles added by
the "guix-defaults?" field does not work due to other related code that comes 
afterwards but I'm not sure it's related to that main issue.
I did the original set up using "guix home import" which seems to have
improved since I tried last in december last year when the generated
file didn't work at all.
Manjaro has a lot of stuff in it's .bashrc that i didn't want to
override, and maybe there are more cases of duplication there that I
don't know about what harm they might introduce.

Greetings, Florian

(use-modules
  (gnu home)
  (gnu packages)
  (gnu packages base)
  (gnu services)
  (guix gexp)
  (gnu home services shells))


(define %enable-extra-profiles
  (plain-file "enable-profiles" 
   "for i in $GUIX_EXTRA_PROFILES/*; do
  profile=$i/$(basename \"$i\")
  if [ -f \"$profile\"/etc/profile ]; then
GUIX_PROFILE=\"$profile\"
   . \"$GUIX_PROFILE\"/etc/profile
  fi
  unset profile
done"))


(home-environment
  (services
(list (service
home-bash-service-type
(home-bash-configuration
 (environment-variables 
  '(("GUIX_EXTRA_PROFILES" . "/home/flo/.extra-profiles")
;;("ALTERNATE_EDITOR" . "\"\"")
("EDITOR" . "\"emacsclient -nw -q\"")
("VISUAL" . "\"emacsclient -c -a \"\"\"")
("GIT_EDITOR" . "\"emacs -nw -q\"")))   
  (aliases
'(("cp" . "cp -i")
  ("df" . "df -h")
  ("egrep='egrep --colour" . "auto")
  ("fgrep='fgrep --colour" . "auto")
  ("free" . "free -m")
  ("grep='grep --colour" . "auto")
  ("ls='ls --color" . "auto")
  ("more" . "less")
  ("np" . "nano -w PKGBUILD")))
  (bashrc
(list (local-file
"/home/flo/.config/guix/home/.bashrc"
"bashrc")))
  (bash-profile
(list %enable-extra-profiles))  
  (bash-logout
   (list (local-file
  "/home/flo/.config/guix/home/.bash_logout"
  "bash_logout"
HOME_ENVIRONMENT=$HOME/.guix-home
. $HOME_ENVIRONMENT/setup-environment
$HOME_ENVIRONMENT/on-first-login
alias cp="cp -i"
alias df="df -h"
alias egrep='egrep --colour="auto"
alias fgrep='fgrep --colour="auto"
alias free="free -m"
alias grep='grep --colour="auto"
alias ls='ls --color="auto"
alias more="less"
alias np="nano -w PKGBUILD"
# Bash initialization for interactive non-login shells and
# for remote shells (info "(bash) Bash Startup Files").

# Export 'SHELL' to child processes.  Programs such as 'screen'
# honor it and otherwise use /bin/sh.
export SHELL

if [[ $- != *i* ]]
then
# We are being invoked from a non-interactive shell.  If this
# is an SSH session (as in "ssh host command"), source
# /etc/profile so we get PATH and other essential variables.
[[ -n "$SSH_CLIENT" ]] && source /etc/profile

# Don't do anything else.
return
fi

# Source the system-wide file.
if [[ -e /etc/bashrc ]]; then
source /etc/bashrc
fi

# Adjust the prompt depending on whether we're in 'guix environment'.
if [ -n "$GUIX_ENVIRONMENT" ]
then
PS1='\u@\h \w [env]\$ '
else
PS1='\u@\h \w\$ '
fi
alias ls='ls -p --color=auto'
alias ll='ls -l'
alias grep='grep --color=auto'
#
# ~/.bashrc
#

[[ $- != *i* ]] && return

colors() {
local fgc bgc vals seq0

printf "Color escapes are %s\n" '\e[${value};...;${value}m'
printf "Values 30..37 are \e[33mforeground colors\e[m\n"
printf "Values 40..47 are \e[43mbackground colors\e[m\n"
printf "Value  1 gives a  \e[1mbold-faced look\e[m\n\n"

# foreground colors
for fgc in {30..37}; do
# background colors
for bgc in {40..47}; do
fgc=${fgc#37} # white
bgc=${bgc#40} # black

vals="${fgc:+$fgc;}${bgc}"
vals=${vals%%;}