News for hackers. Stuff that matters.
Re:Our Roadmap for Nix by Cosi1125 on Sunday August 07, 2022 @04:30AM (#32374887)
After yesterday's post about Nix I tried to install it on my Arch+fish machine. I couldn't.

Somewhat naively, I assumed that installing it from the official channel would do the job. It didnt't. I then searched the Internet and found a very "creative" workaround for Arch users that didn't work either.

My own problems aside, I would expect from a tool marketed as something that helps you keep your environment clean to not litter my disk with a ton of hidden files and directories spread all over the filesystem.

I hope it doesn't sound too harsh. I'm keeping my fingers crossed for the development of this amazing project!

Re:Our Roadmap for Nix by rgoulter on Sunday August 07, 2022 @05:12AM (#32375067)
> My own problems aside, I would expect from a tool marketed as something that helps you keep your environment clean to not litter my disk with a ton of hidden files and directories spread all over the filesystem.

On non-nixOS, I think the changes Nix makes are:

1. puts the majority of its stuff under /nix 2. in the user directory, puts some files under ~/.nix-channels, ~/.nix-defexpr and ~/.nix-profile 3. modifies the default shell script /etc/bashrc or so, with some stuff under /etc/nix. 4. adds multiple users nixbuild1 ... nixbuildN.

The uninstall command given in the manual is a one-line:

``` sudo rm -rf /etc/profile/nix.sh /etc/nix /nix ~root/.nix-profile ~root/.nix-defexpr ~root/.nix-channels ~/.nix-profile ~/.nix-defexpr ~/.nix-channels ```

Re:Our Roadmap for Nix by SuperSandro2000 on Sunday August 07, 2022 @01:56PM (#32378281)
The files in the user directory are mostly symlinks and there are only multiple because it was designed without xdg in mind years ago. There is an open RFC to change those directories to xdg compliant ones.
Re:Our Roadmap for Nix by Thorentis on Sunday August 07, 2022 @06:20AM (#32375330)
Obscene.
Re:Our Roadmap for Nix by slurpmaker on Sunday August 07, 2022 @03:59PM (#32379337)
Don't worry after you install it it doesn't exactly get any better. Take this as a sign :P
Re:Our Roadmap for Nix by forgotpwd16 on Sunday August 07, 2022 @04:48AM (#32374951)
> I couldn't.

Did you tried the method shown in Nix's site?

https://nixos.org/download.html

>I assumed that installing it from the official channel would do the job. It didnt't.

"Official channel" you mean from repos? That's a problem of your distro's package then, isn't it?

Re:Our Roadmap for Nix by Cosi1125 on Sunday August 07, 2022 @05:41AM (#32375154)
As I said, I've tried installing it from the Arch repo and using Nix's installer (+ the adjustments described here [1]).

[1] https://github.com/NixOS/nix/issues/879#issuecomment-4109043...

Re:Our Roadmap for Nix by SuperSandro2000 on Sunday August 07, 2022 @01:57PM (#32378288)
The rsync requirement got recently removed.
Re:Our Roadmap for Nix by pxc on Sunday August 07, 2022 @05:01PM (#32379851)
> naively, I assumed that installing it from the official channel would do the job.

Years ago, I submitted a PR that added this exact behavior. But it depended on interpolating a Nix-internal variable into a config file in the Fish package which at the time was undocumented (@NIX_STATE_DIR@) and upon the layout of profiles within it, so there was concern that it might break on future Nix releases. There were a few other issues, too, and at the time I don't think there was a great way to add tests, either. (That's important because if you screw this up, you can break login for Nix users— I know because I did it once, and that was awful.) Anyway, I felt discouraged and didn't know where to go with it next, so I got lazy and dropped the PR.

At any rate, I don't think your expectation there was unreasonable. I think that would be a good and sensible UX, and your intuition was reasonable.

> After yesterday's post about Nix I tried to install it on my Arch+fish machine. I couldn't.

So the problem is this: the official Nix installer leverages an initialization script, to be sourced at shell init time, which is written in POSIX shell. Fish can't just source it because it's not compatible with POSIX shell.

> I then searched the Internet and found a very "creative" workaround for Arch users that didn't work either.

Arch users shouldn't need anything special here.

You can use fenv¹ to source it, you can translate it to bash using babelfish, or you can exec into fish after running bash to log in (make sure to set $SHELL after if you choose that option). Just make sure you do it as early as possible if you want to use things installed by Nix in your other Fish config snippets.

I think Home Manager will also take care of this for you. (The other module systems, Nix-Darwin and NixOS, both do.)

If you wanna do it like NixOS does, you can install Fish via Nix and then create your own preinit environment script in /etc/fish. This has the advantage of setting up your Nix environment variables before any other config is sourced. You can take a look at it here, which also explains some of the Fish initialization process: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/p...

and here's where the hooks go in the Fish package, where the comments describe the Fish initialization process in detail as well as why things are done this way on NixOS: https://github.com/NixOS/nixpkgs/blob/master/pkgs/shells/fis...

—

1: https://github.com/oh-my-fish/plugin-foreign-env

2: https://github.com/bouk/babelfish

Re:Our Roadmap for Nix by Cosi1125 on Monday August 08, 2022 @08:35AM (#32384717)
Thanks for the advice! I'll probably give Nix another try, rather sooner than later :-)