←back to thread

538 points todsacerdoti | 1 comments | | HN request time: 0.308s | source
Show context
huimang ◴[] No.44365380[source]
Hi Jyn.

"i don't use Nix partly because all my friends who use Nix have even weirder bugs than they already had and partly because i don't like the philosophy of not being able to install things at runtime."

The first part is mostly true. Nix installs things in a readonly store (/nix/store) so regular dynamically linked binaries don't work. Packaging takes a different approach and when things break, it can be difficult to work around. That said, I've run NixOS for over a year now and I find the benefits are far preferable to these downsides. It's not often I run into bugs, let alone show-stopping ones. What is annoying is how many tools are distributed without the source, so I have to run patchelf on them or use something like nix-ld.

As for the latter part, I think that using Nix will change that mentality. (Note that you can do `nix-env -iA $pkg` but it's not recommended). See, I don't even install things like rust at a global level anymore. I can always do `nix-shell -p $pkg` for an ephemeral shell if I need that, or I encode that dependency directly in the project's flake.nix. If I end up using that program a lot I will make the effort to add it to my NixOS config.

replies(2): >>44366480 #>>44366626 #
jynelson ◴[] No.44366626[source]
"at runtime" is not the same as "globally". i would love to install things locally at runtime, but the nix evaluator can't manage things that aren't packaged through a nix derivation, and i don't want to have to figure out how to package a random tool on the internet just to be able to run it at all.
replies(1): >>44367123 #
1. huimang ◴[] No.44367123[source]
Ah I misunderstood. Yes that's a bit more complex. Your options boil down to a) using pkgs.autoPatchelfHook [0], b) learning some nix and writing a derivation yourself, c) using nix-ld [1]. There's also pkgs.steam-run which provides a typical environment expected for games.

A great deal of things are already packaged, but for the most part I find it pretty fast to package something. Once you write a derivation [2] or two, it's not that bad. I never packaged for other distros because they all seemed quite tedious, but the nixpkgs reference [3] lists most things and I can look at the source of similar packages in nixpkgs. It is a time commitment though to learn so it's understandable that it's not really appealing.

[0]: https://github.com/svanderburg/nix-patchtools

[1]: https://blog.thalheim.io/2022/12/31/nix-ld-a-clean-solution-...

[2]: https://ayats.org/blog/nix-tuto-2

[3]: https://nixos.org/manual/nixpkgs/stable/