Andy Wingo <wi...@igalia.com> skribis:

> I think GuixSD should follow NixOS's lead and provide /usr/bin/env.  The
> reason is to support scripts that can run either on GuixSD or on some
> other system.  For example instead of:
>
>   #!/bin/bash
>
> we can do
>
>   #!/usr/bin/env bash
>
> So we just need /usr/bin/env in the root and nothing else.

In ~8 years of NixOS and then GuixSD, I’ve lived without /usr/bin/env.
I use #!/bin/sh in scripts I write, which is known to be Bash on GuixSD.
But I don’t write so many throwaway scripts, and when I do, it’s either
Guile or Bash.

On IRC, Mark pointed out that, if /usr/bin/env were available by
default, then scripts or generated scripts may more often end up relying
on /usr/bin/env rather that precisely specify what interpreter they
need, which would partly defeat the point of all this.

My current inclination would be to not provide /usr/bin/env by default,
and instead let users add it if they want to, either using the
sledgehammer Ricardo suggests ;-), or simply with:

  ln -s /run/current-system/profile/bin/env /usr/bin/env

We could document it, and/or even add a switch in ‘operating-system’ to
do that.

How does that sound?

> Alternately, I am not sure if this would work but we could make a form
> of "guix environment" which populates a profile that is mounted at /usr
> in a container.  That would allow many more non-Guix tools to run.

Technically ‘guix environment --container’ could create /usr, just like
it creates /bin/sh.  Not sure if it’s a good idea, though.

Thanks,
Ludo’.

Reply via email to