NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.63k stars 1.51k forks source link

Installer support for Nushell #9813

Open Eternahl opened 9 months ago

Eternahl commented 9 months ago

Is your feature request related to a problem? Please describe. The installation process fails if run from a nu shell. Nix environment initialization is not defined for nu as login shell.

Describe the solution you'd like Make the installation work in the same way as for a fish shell.

Describe alternatives you've considered Manually add environment variables for nushell.

Additional context I've already added a few installation scripts to this fork

Nushell is becoming increasingly popular. I can work on this, but I need a little guidance. How does the nix installation process work ?

abathur commented 9 months ago

Can you clarify how "the installation process fails"? Does it succeed, but just not set up any init for nushell, or is there an actual error during the install? If the latter, can you include a log?

Ideally in a details element, like:

<details><summary>install log</summary>

```
... paste here ...
```

</details>
yusuphgammut commented 9 months ago

Great work @Eternahl ! I'm not using nushell as login shell, but I did set it up as the default shell in my Alacritty config. I was just thinking about creating the nushell version of nix-daemon.sh but I see that you've done just that.

It will add to the awesomeness of your work if you can add the completions for nushell that are stored in /nix/var/nix/profiles/default/share as well, and of course if you can finally make it work for nushell as a login shell and merge your fork.

Eternahl commented 9 months ago

The context: nushell installed as a login shell

Running the nix installation command (sh <(curl -L https://nixos.org/nix/install) --daemon) directly from nushell produce an error, but that is not really the point of this issue since we can use a sh shell as an alternative.

The main problem is that nushell is not handled by the installation script, so nix commands are not sourced.

~> nix-shell
Error: nu::shell::external_command

  × External command failed
   ╭─[entry #1:1:1]
 1 │ nix-shell
   · ────┬────
   ·     ╰── executable was not found
   ╰────
  help: No such file or directory (os error 2)
dougg0k commented 7 months ago

You might need to take a look at scripts/local.mk, It's being used by some package files like Makefile and package.nix. They execute those scripts nix-profile and nix-profile-daemon.


But then they output other sh files, which are read by other sh files, not sure, but they could need a nushell version also.


Makefile seem to work with nushell https://github.com/nushell/nushell/discussions/6243#discussioncomment-3339200