unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Configuring aliases in bashrc with guix home
@ 2024-10-04 15:26 Brennan Vincent
  2024-10-13 21:07 ` Richard Sent
  0 siblings, 1 reply; 2+ messages in thread
From: Brennan Vincent @ 2024-10-04 15:26 UTC (permalink / raw)
  To: guix-devel

Hello,

By default, the `home-bash-service-type` creates a .bashrc with the
default bashrc (defined in %default-bashrc in gnu/system/shadow.scm),
followed by user-defined aliases, followed by a user-defined bashrc
file.

The problem is that %default-bashrc already contains some aliases:

alias ls='ls -p --color=auto'
alias ll='ls -l'
alias grep='grep --color=auto'
alias ip='ip -color=auto'

which makes it difficult for the user to manage her own set of
aliases. If the user wants to remove all the aliases from
%default-bashrc and set her own, she can run `unalias -a` in her own
bashrc first. But then she can't use the user-defined aliases mechanism
from home-bash-configuration, since that is added to the file before the
user-defined bashrc.

My suggestion is that when aliases is set in home-bash-configuration, we
remove the predefined default aliases from %default-bashrc. Or at least
provide an option to do so.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Configuring aliases in bashrc with guix home
  2024-10-04 15:26 Configuring aliases in bashrc with guix home Brennan Vincent
@ 2024-10-13 21:07 ` Richard Sent
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Sent @ 2024-10-13 21:07 UTC (permalink / raw)
  To: Brennan Vincent; +Cc: guix-devel

Hi Brennan,

> If the user wants to remove all the aliases from %default-bashrc and
> set her own, she can run `unalias -a` in her own bashrc first. But
> then she can't use the user-defined aliases mechanism from
> home-bash-configuration, since that is added to the file before the
> user-defined bashrc.

Correct me if I'm wrong, but aliases can be overwritten, no? A user who
wants %default-bashrc but without aliases can redefine any aliases they
prefer in the aliases section and unalias the rest individually at the
end. A bit unwieldy perhaps, but not unreasonable in my opinion when
there's only 4 aliases.

> My suggestion is that when aliases is set in home-bash-configuration,
> we remove the predefined default aliases from %default-bashrc. Or at
> least provide an option to do so.

I'm not a fan of removing it by default, among other reasons because it
would silently break existing setups and the current behavior is
documented.

Perhaps instead %default-bashrc can be broken down into sections and
users can enable/disable parts of it piecemeal, e.g.

--8<---------------cut here---------------start------------->8---
(guix-bashrc-defaults
 ;; default #t for most fields
 (aliases? #f)
 ;; (source-system? #t)
 ;; (sane-ssh? #t)
 (prompt? #f))
--8<---------------cut here---------------end--------------->8---

This could allow for a more comprehensive and opinionated default bashrc
to be packaged with Guix while still maintaining user control.

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-13 21:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-04 15:26 Configuring aliases in bashrc with guix home Brennan Vincent
2024-10-13 21:07 ` Richard Sent

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).