this post was submitted on 18 Feb 2024
128 points (93.8% liked)

Linux

48413 readers
1106 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Distro agnostic packages like flatpaks and appimages have become extremely popular over the past few years, yet they seem to get a lot of dirt thrown on them because they are super bloated (since they bring all their dependencies with them).

NixPkgs are also distro agnostic, but they are about as light as regular system packages (.deb/.rpm/.PKG) all the while having an impressive 80 000 packages in their repos.

I don't get why more people aren't using them, sure they do need some tweaking but so do flatpaks, my main theory is that there are no graphical installer for them and the CLI installer is lacking (no progress bar, no ETA, strange syntax) I'm also scared that there is a downside to them I dont know about.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 9 points 9 months ago (16 children)

You're not exactly comparing apples to apples here.

Flatpak and appimages tend to be used in any distro because they can just be downloaded in a one off manner and installed then you're running the application (for the most part). They offer a manager of sorts but you don't need it to use the packages.

For nixpkgs, whike I'm sure I can get a package from the sounds of the sizes the package covers only the application or the library, meaning I still need the dependencies.

So what exactly would make me the user trade my built in tools (apt/pacman/dnf) for nix? Keep in mind no matter how great you feel it is, you need to provide reasoning that motivates me to install and learn this new tool instead of the old ones I have.

[–] [email protected] 7 points 9 months ago* (last edited 9 months ago) (13 children)

For nixpkgs, whike I’m sure I can get a package from the sounds of the sizes the package covers only the application or the library, meaning I still need the dependencies.

When you download/build a nix package, nix will absolutely also download all necessary dependencies.

So what exactly would make me the user trade my built in tools (apt/pacman/dnf) for nix?

Getting a shell with a specific package as a one off. Want ffmpeg? nix-shell -p ffmpeg opens a shell with ffmpeg in its path, and only that shell has it.

Along with that, that means users can install packages for themselves. Limited use for single-user systems, but nonetheless it's possible.

Per-project dependencies. Pretty much the same as above, but the dependencies are declared in a file which is part of the project. In many cases that same file can also be used as a nix package itself, like any other in nixpkgs. Very useful if you write software yourself. Here's an example.

Being a source-based package manager with a cache means that you get all the benefits of prebuilt packages but can easily patch or use other versions of a package, with no difference in use (other than that it will build it locally instead of downloading from the cache).

On a distro with a different main package manager I would probably mainly use it for per-project dependencies though.

[–] [email protected] 3 points 9 months ago (3 children)

I often stumble on this example of nix usage - a one-off shell with a a specific package. This is such a niche and seemingly unimportant use case, that it’s really strange to have it mentioned so often.

Like literally what’s the point of having a shell with ffmpeg? Why not simply install it? Even if you need something just once, just install it and then uninstall it, takes like 10 seconds.

The other use case that is often brought up is for managing dev environments, but for a lot of popular languages (Python, Node, Java, Rust, etc. ) there are proven environment management options already (pyenv and poetry, nvm, jenv, rustup). Not to mention Docker. In the corporate setting I haven’t seen nix replacing any of these.

From my limited experience using home manager under Linux and macOS:

  • GUI app shortcuts work in neither of the OSs
  • error messages are about as readable as the ones you get for C++ templates
  • a lot of troubleshooting searches to unsolved GitHub issues

All in all nix seems like a pretty concept but not too practical at the moment.

[–] sneakyninjapants 3 points 9 months ago

Even if you need something just once, just install it and then uninstall it, takes like 10 seconds.

apt install foo && apt remove foo

That's essentially what nix-shell -p does. Not a special feature of nix, just nix's way of doing the above.

Actually using it though is pretty convenient; it disappears on its own when I exit the shell. I used it just the other day with nix-shell -p ventoy to install ventoy onto an ssd, I may not need that program again for years. Just used it with audible-cli to download my library and strip the DRM with ffmpeg. Probably won't be needing that for a while either.

The other thing to keep in mind is that since Nix is meant to be declarative, everything goes in a config file, which screams semi-permenant. Having to do that with ventoy and audible-cli would just be pretty inconvenient. That's why it exists; due to how Nix is, you need a subcommand for temporary one-off operations.

load more comments (2 replies)
load more comments (11 replies)
load more comments (13 replies)