unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Tropin <andrew@trop.in>
To: Nick Zalutskiy <nick@const.fun>, 52808@debbugs.gnu.org
Subject: bug#52808: Guix home should not assume that all targets are dot files
Date: Fri, 28 Jan 2022 18:22:03 +0300	[thread overview]
Message-ID: <875yq33mxw.fsf@trop.in> (raw)
In-Reply-To: <5f2cd1dd-c91d-4fed-8b45-3261e53d92a5@www.fastmail.com>

[-- Attachment #1: Type: text/plain, Size: 4467 bytes --]

On 2022-01-28 08:33, Nick Zalutskiy wrote:

> Hi Andrew,
>
> I have files that I consider my "home configuration" that do not go
> into .config or any other dot dir. For example, I place an executable
> shell script to automate some tasks in the home dir of every
> machine. The script is called `run` all I want to do is place it as
> ~/run Placing this file in PATH is not appropriate in my case.
>
> The current design makes this impossible to achieve it seems. I just
> live with `~/.run` now, but it is ergonomically cumbersome for reasons
> that are too obscure to go into.

You can extend activation home service with a script, which will symlink
a necessary executable to ~/run.

>
> Why not, just as an example:
>
> `("$XDG_CONFIG_DIR/guix/channels.scm" ,(local-file "./chans.scm"))`

The $XDG_CONFIG_DIR is not know at build-time, so it won't work.
Creating a literal files/$XDG_CONFIG_DIR directory is possible, but also
not ideal.  However the idea sounds not that bad.

>
> Which is explicit and sets the right expectation without any other
> context. The implicit heuristics around how the input is interpreted
> are an unfortunate design decision in my opinion, they make a simple
> tool more difficult to use.

It's partially intentional to force users to stick to XDG specification
for config files and minimize the usage of dotfiles in $HOME.  The
binaries are inteded to go to profile/bin or other directory on the
path. But it always possible to bypass this decision by directly
extending home-service-type or home-activation-service-type.

I see what you mean about implicit heuristics and mostly agree.

>
> Having said all that, the documentation helps a lot. Thank you for the
> patch!

Sure ;)

>
> Best,
>
> -Nick
>
> On Fri, Jan 28, 2022, at 5:51 AM, Andrew Tropin wrote:
>> On 2021-12-26 12:17, Nick Zalutskiy wrote:
>>
>>> The following configuration results in a `~/.run` symlink being
>>> created. My expectation is that a `~/run` symlink is created
>>> instead. (ie. not a dotfile)
>>
>> Some how I missed it and not documented home-files-service-type in the
>> manual, I'll add it soon.  Thank you for mentioning it.  It should break
>> this expectation :)
>>
>>>> (home-environment
>>>>   (services
>>>>     (list (service
>>>>             home-bash-service-type
>>>>             (home-bash-configuration
>>>>           (guix-defaults? #t)))
>>>>       (simple-service 'my-files
>>>>               home-files-service-type
>>>>               `(("run" ,(local-file "run")))))))
>>>
>>> This applies to all other targets. My expectation is that the
>>> configuration should expect the exact target and not make an
>>> assumption that all targets are hidden files, since that allows for
>>> more utility:
>>>
>>>> (home-environment
>>>>   (services
>>>>     (list (service
>>>>             home-bash-service-type
>>>>             (home-bash-configuration
>>>>               (guix-defaults? #t)))
>>>>           (simple-service 'config-files
>>>>               home-files-service-type
>>>>               `(("run" ,(local-file "run"))
>>>>                 ("README.txt" ,(local-file "README.txt"))
>>>>                 (".config/guix/channels.scm" ,(local-file "config/guix
>>>>                 (".emacs.d/init.el" ,(local-file "emacs.d/init.el"))
>>>>                 (".vimrc" ,(local-file "vimrc"))
>>>>                 (".gitconfig" ,(local-file "gitconfig")))))))
>>>
>>> Thank you,
>>>
>>> -Nick
>>
>> It's intentional and is a part of a design decision:
>>
>> For example for ("config/guix/channels.scm" ,(local-file "./chans.scm"))
>> chans.scm goes not to ~/.config/guix/channels.scm, but to
>> $XDG_CONFIG_DIR/guix/channels.scm, which can be a different location
>> from ~/.config, absent dot should partially break this expectation.
>>
>> It's a bad practice to use something without "config/..."  prefix and
>> generally it should be avoided, it still possible to use something
>> different in rare use-cases, for example for zsh: ("zshenv"
>> ,zshenv-file-like-here), because it's hard to implement the lookup for
>> initial configuration file other way for shells.
>>
>> You can elaborate more on what you try to achieve and I can try to give
>> you a recommendation how to implement it.
>>
>> -- 
>> Best regards,
>> Andrew Tropin
>>
>> Attachments:
>> * signature.asc

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 853 bytes --]

  reply	other threads:[~2022-01-28 15:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-26 17:17 bug#52808: Guix home should not assume that all targets are dot files Nick Zalutskiy
2022-01-28 10:51 ` Andrew Tropin
2022-01-28 13:33   ` Nick Zalutskiy
2022-01-28 15:22     ` Andrew Tropin [this message]
2022-01-30 17:13   ` Ludovic Courtès
2022-02-02  8:10     ` Andrew Tropin
2022-02-08  9:46       ` Ludovic Courtès
2022-02-11 15:52         ` Andrew Tropin
2022-02-26  7:13           ` Andrew Tropin
2022-03-05 22:44           ` Ludovic Courtès
2022-03-09  4:26             ` Andrew Tropin
2022-03-10 10:56               ` Ludovic Courtès
2022-03-11  7:41             ` Andrew Tropin
2022-03-20 18:07               ` Ludovic Courtès
2022-02-08 12:58     ` Xinglu Chen
2022-02-10 20:32       ` Ludovic Courtès
     [not found] ` <handler.52808.D52808.16477996643062.notifdone@debbugs.gnu.org>
2022-03-20 21:00   ` Ludovic Courtès
2022-03-28  9:17     ` Andrew Tropin
2022-03-29  9:51     ` Andrew Tropin
2022-04-10 20:52       ` Ludovic Courtès
2022-03-29 10:24     ` Andrew Tropin
2022-03-30 19:51       ` Ludovic Courtès
2022-04-08 18:18       ` Ludovic Courtès
2022-04-09 14:28         ` Andrew Tropin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yq33mxw.fsf@trop.in \
    --to=andrew@trop.in \
    --cc=52808@debbugs.gnu.org \
    --cc=nick@const.fun \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).