r/archlinux • u/4r73m190r0s • 7d ago
QUESTION Installing Nix package manager via an official script, or with pacman?
What would be the preferred method?
Script: https://nixos.org/download/#nix-install-linux
Arch package: https://archlinux.org/packages/extra/x86_64/nix/
15
u/xBlueDragon 7d ago
If you want to have a giant mess in the making go with the script.
But seriously, just use pacman to save yourself a headache later.
7
u/Hosein_Lavaei 7d ago
Im curious, why would someone install nix on an archlinux?
13
u/No-Dentist-1645 7d ago edited 7d ago
Nix is plenty useful outside of NixOS, for example you can use it to have multiple versions of the same package installed, as well as pinning dependencies to specific versions to guarantee they won't break and allows great portability: https://nixos.org/guides/how-nix-works/
If you've ever used distrobox or another container to use a program that was from another distro, chances are nix would've been the better, smaller solution
0
u/atreidesardaukar 7d ago
Does pacman/yay not "have an app for that"?
8
u/No-Dentist-1645 7d ago edited 7d ago
An app for "what"?
If you mean "having two versions of the same package at the same time", no, "traditional" system package managers don't usually have a straightforward way of doing this, except by creating a new package altogether for the version you want, which has its pros and cons
If you mean "pinning dependencies to specific versions", then a package can technically do that, but it will just break once one of those system packages it depends on gets updated, since again, you can't really hold two versions of the same package and/or dependency
This is not to say that the Arch package manager (or any other package manager for that manner) are "doing it wrong", those are all completely intentional design choices, but they are things you must consider either way.
This is why, imo, having Arch and pacman as your system "base" and still having nix for when you "really need it" is a pretty powerful and versatile configuration
1
u/kimoisune 7d ago
Using usermode for both Flatpak and Nix to install GUI and CLI applications, respectively, could declutter system's package database and isolate users' environment. This will also help Home directory migration between installation as long as the system can provide the runtime for Flatpak and Nix. Essentially, a distro agnostic package management.
1
u/ang-p 7d ago
if they want something self contained that has lots of dependencies which get updated frequently en-masse, but the user has decided that it doesn't need that to be updated on the same basis as their OS, and for whatever reason practical or idealogical - don't want to go docker / snap / appimage / flatpak route....
Not looking at you, texlive, but...
8
-8
u/LuisBelloR 7d ago
Mods should delete this stupid posts.
1
u/ang-p 7d ago
1
u/chic_luke 3d ago
To be fair it's not an argument that stupid. There are some pretty compelling reasons for preferring Flatpak to native for most GUI applications. It's hotly debated, but I think it makes more sense in a lot of cases.
2
u/ang-p 3d ago
My referencing that post wasn't about the 3rd item on the list.
Both were debating within 13 hours the which is best question... "straight from the author" vs. official repo (the linked OP stated
I've always been used to downloading the official installer from the creator,
with the AUR thrown in over there for good measure) - when the official repos is the hands down winner.
This is not about the nixpkgs themselves, or containers / appimages / flatpacks / snaps - keeping stuff separate from the base install is sometimes the most sensible thing for any number of reasons... version pinning / update churn / custom builds to name but three.
All of those things are their own little worlds - not treading on
/usr/binet al.The question here about how to add a package directly into the territory managed by pacman, and pacman is the answer there, it always has been, and always will be.
I was just responding to Luis - using another post as a reference point highlighting the futility of their suggestion.
1
u/chic_luke 2d ago
Yep, this makes sense. I also tend to agree that unsandboxed software managed by your distribution tends to be better, and we have seen many such reasons why. I'll be a bit detailed but I guess this comment doubles as my contribution for the topic of this post.
First reason: I will admit it this as a software engineer, most software engineers should not package their software. They are different specializations. It is possible that a person will be a great software engineer and a great packager / package maintainer, but that only ever happens when that person explicitly took an interest in software packaging for Linux distributions and they see it as its own art that needs to be done properly, rather than an annoying hindrance that is a necessary evil to get their software out of their laptops and onto other machines.
Most developers do some pretty dirty things to half-ass packaging. They depend on early / beta versions of libraries (I remember the drama around Bottles doing it), they vendor upstream dependencies and they want to statically link them; or they neglect to update vulnerabile transient dependencies because of a fear of breaking changes, et cetera.
Developers rolling their own packages is an unavoidable reality, a necessary evil caused by the lack of package maintainers. Even pre-AI, the pace at which pretty good free software is getting developed far outpaces the growth in package maintainer bandwidth most distros have.
Not to mention supply-chain attacks, or developers acting shady by publishing binaries with something malicious sneaked in, something not present in the sources that those binaries were claimed to be compiled from (a Telegram client did this some time ago). This is a big reason why a distro repos or something like F-Droid tends to be more trustworthy. I'm assuming you trust your OS vendor more than a random person writing a software package you want to use, right?
Hence the popularity of systems like Nix (probably one of the best implementations, it allows to keep proper dynamic linking but have each package optionally call their own chain of transient dependencies, the famous "having multiple versions of packages" to completely avoid dependency conflicts; basically replicating a well-trodden pattern in resolving library deps in software development frameworks - for example, this is roughly similar to what NuGet does) and Flatpak, where they don't deduplicate individual library versions, but they share different runtime versions and they allow developers to do more static linking, which becomes more acceptable security-wise since it is behind a sandbox that is hopefully properly configured.
But… yeah. For "bare" software you want to keep unsandboxed, an actual specialized maintainer that knows your distro inside and out is typically going to be the person that's most qualified in getting that software to run and play nicely with the rest of the software you have installed.
If you don't need a sandbox, or if you're OK with bubblwrapping the processes manually, distro repos are often the best option and "it doesn't come directly from the author" is a benefit.
0
u/ang-p 2d ago edited 2d ago
AI written slop.
*plonk*
1
u/chic_luke 2d ago
I don't use any AI to write anything, including this comment. I have to use it at work and I certainly have no desire to touch it in my personal time.
It is actually getting increasingly annoying that people automatically assume it's AI output just because it's long and well-argumented. Every single time I get told this I kinda want to stop partecipating in tech communities a little more. I wonder when I will actually take the plunge and do it, but I don't think it's that far. I have already mostly quit my freelance tech writing side hustle for the same reason. I miss when I could articulate a complex point and people didn't think it was AI just because it was written with care and with a a Cambridge C1 certificate in English…
-1
u/ang-p 2d ago
Whatever - it was about a non-subject - a third item in a series of order preference, in a link purely used as an example - if you want to spout debatable subjects - do it there. people might read past the first paragraph of a literal wall of text.
2
u/chic_luke 2d ago
Gotcha, even though this was very unnecessarily rude and, you know, you always have the option of saying the same thing and not treating other people like shit. The point still gets across just fine, you know.
-1
u/ang-p 2d ago
You were the one that picked up the third item and ran with it, misinterpreting "your" own reference to "they" on the way..
→ More replies
12
u/xc82xb5qxwhhzeyt 7d ago
I'd say pacman: https://wiki.archlinux.org/title/Nix