Website Guide for copy/paste: christitus.com/nix-package-manager/ -------------------------------------- Thanks Internet for its "nicks" not " N-I-X". I've since been using NIX in tandem with apt on a debian system and it is fantastic. No extra repositories and rock solid performance.
I still love how informative nala's front-end is, and how universally supported apt is. I literally just change the word apt to nala when doing installs.
I wonder how badly Debian Stable will break using a powerful package manager like this? I run MX Linux, and being based on stable they are still several versions behind on desktops, etc. Must prepare USB stick for testing....
@@rishirajsaikia1323 Thank you; I haven't had time to try it on a USB stick bootable (I FINALLY learned to stop messing with my daily-driver setup :) ).
@@markh.6687 Not at all, nix's packages are not installed into the system itself at all - they actually live in their own directory-structure and are just PATH'ed. That ist of course only as long as you do not "Override" important system tools (e.g. by installing them from nix besides the original Version) and therefore make them basically shadow debian's versions.
its nice to see nix and nixos gain more attention from the linux community in recent times, hopefully with more exposure the nix repos will get bigger and more well maintained, and documentation will improve. Nixos really is a gamechanger and has fixed many of the problems the community is dealing with right now (immutability and cross distro packaging)
@@AndersHass don't think so but I meant that nix was around before flatpak and snap and by immutability I was also referring to silverblue and steamos since their goals were to have immutable packages
I really wish Nix would've started taking off before Flatpak. It really seems to be a good solution to cross-distro packaging, it's just a bit complex. If Nix was a little more beginner-friendly and had half the corporate funding that Flatpak does I legitimately think it could've won
"nix-env operations such as upgrades (-u) and uninstall (-e) never actually delete packages from the system. All they do (as shown above) is to create a new user environment that no longer contains symlinks to the “deleted” packages. Of course, since disk space is not infinite, unused packages should be removed at some point. You can do this by running the Nix garbage collector. It will remove from the Nix store any package not used (directly or indirectly) by any generation of any profile. Note however that as long as old generations reference a package, it will not be deleted. After all, we wouldn’t be able to do a rollback otherwise." This is what's written on the "Garbage Collection" section of the manual. Am I missing something? I don't think what's showed in this video is the proper way to manage applications via Nix.
The reason upgrades an uninstall does not remove things is to have all the backups available. That's usefull if you break something and want to recover the previous system status. Of course, depending what you use the machine for, that can vary a lot. The workflow of installations, upgrades, garbage collection, etc... Depends on you. For a personal machine, you would probably have very few generations available and run garbage collection after updates, but for a production machine running a server that might be different. So, you aren't missing anything, it all depends on how you use nix
Actually it's closer to "which is better: a car, or a car factory." The car is NixOS; the car factory is Nix. NixOS is really just a single, absolutely large and absurdly customizable, package for Nix.
Within the Nix community, a lot of attention goes toward 'advanced' uses of Nix, like storing and deploying the configuration of a fleet of NixOS machines in a 'GitOps'-y workflow, or writing your own custom packages for your own applications. It's really nice to see content that focuses on what cool stuff Nix can do for people even before they go all the way down the rabbithole!
My understanding of what you're saying is basically something like a configuration file that is capable of reproducing packages and applications on new instances/PCs. I was able to find this stuff for NixOS, but not for Nix package manager. Is there something you could point me towards?
@@varungawande9321 configuring plain nixos seems easy, but dabbling into the nix-pkgs... holly molly, it feels yet another level of newthings. > _"I was able to find this stuff for NixOS, but not for Nix package manager."_
I always heard it pronounced "nicks" so I did a little digging and in the original paper it's stated that the name Nix is derived from the Dutch word niks, meaning nothing, it's not an abbreviation.
@@drishalballaney6590 the only thing i wished to was that NixOS wasn't so dependent on systemd. Don't get me wrong there is nothing wrong with systemd but i would preffer init freedom as personally i preffer runit over systemd for a init system.
@@rahilarious Does Gentoo let you specify all your customizations in source code and then apply them globally to all packages you install, except for a small handful that you decided to use the vanilla versions for? Did Gentoo check for if you actually customized a package and then downloads a binary version if it can prove that you didn't and only compile packages that your actually customized? Does Gentoo let two different packages depend on different versions of the same dependency?
I have joined the Nix train as well, with home-manager, and it IS great. It's not perfect, and it is far more complicated than it needs to be for casual use, but IMHO this is truly the perfect companion to flatpak, especially for CLI stuff. It makes more sense to use Nix over snaps in my opinion, and between Nix, flatpak, and distrobox, the amount of time I need to touch my host package manager can now be counted by hand. They legitimately made immutable a viable path for me.
Nix is not a package manager, it's a build system and a great one at that. It can also handle a build artifact cache and remote building. It is NOT a package manager, because it doesn't do things that apt or homebrew or yum or what have you do. For example, it does not put systemd service files in any location. It does not copy config files. It does not do any setup in any way. It's important for new users to know, that they have to do that kind of setup themselves.
I use none of them, works great, but I only use arch, and never should go for snap or appimage, can't understand why I should install same dependency several times? Love pacman and AUR and never have any problem with that
Nix-shell provides some of that functionality. If all you are using those for is to get apps, then yeah. If you care about the security benefits of these options then look into the details. I haven't, so they may be comparable, but I don't know.
@@fordonmekochgalenskaper5665 what do you do on your pc?. Also Flatpak still share dependencies bro. The main thing flatpak about is sandboxing, it aims a package that behave exactly the same on every distro, flatpak also very useful on something like steam deck when the system is immutable. Nix can also do this but AUR can't.
I installed Nix for my Steam Deck, as pacman was both pain(I used mainly Debian based distros before) and new StemOS updates would wipe everything anyway, and now my newest laptop will run NixOS. Nix is such a good package manager.
Just be prepared to learn Haskell. I loved NixOS but a lot of things are dependent on Haskell However, it's one of the easiest Linux installations to do despite being so different from traditional distributions
Chris, if you search a bit then you can find a scientific paper from the developer of NixOS, a Dutch computer scientists (Utrecht), about the package-manager. How deep are you willing to dive into the rabbit-hole?
Hi Chris, This was an interesting video! Can you say a bit more about your terminal (prompt, config etc) that we see in this video? The mod looks nice. Also can you say a bit more about the pros and cons of using two package managers in a linux system?
when i first switched to nix i was so utterly shocked to see how much configuration you can do in just one file all my packages, kernel, networking, systemd services and drivers, partitions and mount points MY WHOLE FIREFOX CONFIG with custom css and everything (sadly lacking extensions which aren't in nix's repos) MY WHOLE SWAY CONFIG MY WHOLE EMACS CONFIG basically every piece of configuration you could imagine is possible from just your configuration.nix the only downside is its over 1000 lines...
Sometimes I wonder why distros like that r not more popular 🤔 Nice to see Alpine finally gaining popularity in unixporn circles as well. Such a underrated distro
about 20% of apps I install on LMDE via NIX are broken in different ways. They either have broken buttons (that just don't work) or eat too much cpu/ram. what am I doing wrong?
so, trying out nix as a replacement for brew on my apple silicon mac. installed a few apps like inkscape and vscode. Installation successful, but app icons do not show up in the launchpad screen, nor can I launch them via spotlight. Also, many apps are out of date... like Ultimaker Cura 3D. Latest release as of now, 5.3... nix only shows 4.13. If this is the "best" pkg manager, I must be doing something wrong.
Really this incredible minimal interface terminal is BASH? Man I'm a newbie learning Linux and Terminal prior to coding. Do you have any tutorial about this configs? The readability is AMAZING! A big hug from Brazil!
Can you make a video about NixOS? The Gnome version seems to be really lite on ram - half what Fedora is using on a cold boot. I am wondering why and would love to hear your opinion on the os and if it is good for day to day use
@@rahilarious unfortunately I don't know about that stuff, but thank for the answer. I guess that could be a reason. But nearly 50% more ram on a cold boot. Fedora should be able to become more efficient on that side.
@@jehovahnissi1961 It is kinda weird. Of course I was testing in a vm (Gnome Boxes) and NixOS was running with 650mb ram while Fedora used around 1.3GB. But when I tested it on Hardware (live, not installed) both used around 1.05 while NixOS I think had a little bit of a higher average workload. I am now on Fedora and also had problems with the Nvidia gpu and the battery indicator is not working but there is a workaround and it seems to be a Kernel issue. It was not a great start and I am not sure if I am gonna stay on Fedora. The Battery consumption was also through the roof (1h50 while on Zorin I got around 7h). Now with the GPU fixed it is at least around 3 to 4 hours.
Ha, how interesting that you mentioned doing a do over of an awesomewm set up on Debian. Just been trying to do that on Debian testing myself. Got so far, but couldn't work out how to launch apps with a particular screen 😕
Multiple repos for the one and only packagemanager apt is one of the biggest reasons I run Debian SID over Arch. I don't have to juggle both pacman and AUR stuff
Packages in Nix don't just work. The theory and fact are two different things. They have too many individuals responsible for too many packages. Some just aren't keeping up with upgrades, etc. Nope.
sorry for being thick, but I completely failed to understand why nix is better than brew 🤷 yes it's nice and all, but at its core the functionality is basically the same (symlinking packages. oversimplifying things, I know) probably for that local `generations` copies? most likely skipping `brew cleanup` will have the same result
Love the content. Would appreciate if the video titles give a better idea what you are going to talk about, removing some of the baiting character. Subbed your channel to check out more of your content and how often I will know what to expect before I click.
But why do they need to use ugly commands, when it could be as easy as "nix add package" ,"nix update (package)", "nix del[ete]/rem[ove] package" etc? So annoying with dashes and cheat sheets when it could be so simple.
This is an imperative way which is discouraged in Nix community, the real power of nix comes when you do things decoratively by using nix flakes and home-manager
nix on other OSs is nice, but you don't get gpu support on that kind of setup, only on nixOS. You can symlink a nix mesa installation to /run/opengl-driver but other stuff like intel-media-driver/vaapi drivers are messier to deal with
IMO Guix would be much more suited for me. Not only am I then going to learn a package specification language (GNU Guile, based on Scheme), but also a language which is not a DSL (unlike Nixlang) and can thus be used for pretty much everything.
As any of your follower Gurus come across this error Sorry, this storage driver is not supported in kernels for newer releases There will not be any further Ubuntu releases that provide kernel support for the aufs storage driver. Aufs Storage Driver Please ensure that none of your containers are using the aufs storage driver, remove the directory /var/snap/docker/common/var-lib-docker/aufs and try again. Being a ID.10.T Ubuntu 20.04 user with very little Linux abilities... I've done quite a bit of searching this;... but boy the answers overwhelm me... As I'm a dum ass... Can any Guru put me in the right direction or have a sudo script to ease my aching head... A all in one;... where it make these backups replaces aufs with something that will allow the new Ubuntu Upgrade 2 work...
Thanks, Chris! Nice to see you adopting 'new views that are true views' to paraphrase Abraham Lincoln. As for Debian being " a little behind"...they are WAY behind on Stable.
I like this, however some of the critical packages I add (such as Brave browser) are kind of out-of-date in Nix. For instance, the most recent version of Brave today is 1.42.97 however the latest version with Nix is 1.38.115 which is seriously out-of-date. This is a real security issue. So even though I like the idea of not pulling in additional third party deb repos, I think Nix is not a solution for me.
@@JohnSmith-ky2qn Yep most up to date ones are in the unstable branch, and Brave is out of date because Nix uses the latest stable release to date, which is branch release-22.05, not the unstable one
Outdated packages, incredibly unintuitive commands, unnecessarily complex even for simple operations... nope, hard pass for me. It has a purpose and should be used for what is designed for, definitely not the best general purpose package manager.
One of the worst i must say. I run nix-env -qa in terminal, there appeared some lines but the last says "lines 1-23", it's taking too long. It's stacked. There is not even an instruction which to press or which to do. I just wait and nothing happens. A terrible Nix
At the beginning I didn’t understand why NIX is easier than homebrew (mac user here ) but then I read the homebrew cask feature is only available for Mac OS. So that's the reason NIX still necessary
Sorry, but drifting off into Terminal land is where Most will change the channel. Think about how many millions of computers went to the Dump because of what phones offer.
To me, nix is a kind of flatpak but using docker image layers instead of just putting files to separate directories. In both cases, whenever you're trying to "install" something small, they both bring all the dependencies with it, so the software you're "installing" won't be depending on packages of your OS. But there's a limit for this approach for sure. Most obvious is not even the disk space, gigabytes are cheap these days. It's integration to your desktop. Flatpak solves that with using portals. But how does that nix? And unfortunately nix is not ideal. I just tried to "install" retroarchFull and it failed (aarch64) somewhere in the middle while leaving a tonns of garbage behind it
No, nix doesn't duplicate dependencies for every app. If two apps depend on the same lib, it will be installed only once. If two apps depend on a different version of a lib, both versions will naturally be installed side by side. That's the crux of nix.
Did you some how modify or aliased apt to use nala? I'm looking at timestamp 4:28 you typed "sudo apt update" and the output looks a lot like the out of nala. I've also watched your "Stop using APT" and that's how I know that the output looks like nala's output. I have this bad habit defaulting to "apt", regardless of what other package manager is available. Anyway, could you make a video showing us how to set up apt to use nala? Just like your "sudo apt update" at 4:28 and "sudo apt purge github-desktop". I'm looking forward to that video!!
It's stated in other comments but this only just scratches the benefits of nix. Flakes, nix-shell, integration with direnv, configuring your entire system (if running NixOS)
What's weird to me is that NO ONE ever mentioned this powerful aspects of nix package manager when they coverd or reviewed NixOS on YT. Wich is to me is a shame on linux distros YT reviews. I thought it is a normal package manager with small packages number
@@lolololo-cx4dp thanks for the reply. That would make sense although I guess I was referring more to the underlying mechanics of nix: as for example nix-env and nix-shell work very similarly under the hood, in fact you don't even need nix-env at all since nix-shell will install whatever you need as you need it. There's also just a lot of customization you can do and also you can effectively guarantee that a version of your project will always work in all environments with nix installed. (tbh I'm just nix obsessed and hope for the comment section to have some good discussions and get the word out about how awesome nix is)
Chris Titus Tech What OS are you using in this video? The bit where you showed freshfetch, lists your OS as "x86-64"; I don't know of any, by that name.
Every time Chris says, “ less repositories” instead of “ fewer repositories” I cringe. I know it’s dumb. His videos are well put together and he knows far more about Linux than I do. But it still hurts my ears when I hear it.
Nix can be fast and magical all it wants but if it has a shitty interface, nobody is going to want to use it. UX is not just for GUI apps, its also important for CLI and TUI apps. In homebrew, Heres the basic 3 commands everyone is going to do: brew search [package], brew install [package], brew uninstall [package] The same 3 in nix are this crap: nix-env -qaP | grep [package], nix-env -iA nixpkgs.[package], nix-env -e [package]. Subcomamnds > flags. Flags don't communicate anything and aren't inuitive. Inconsistent commands. Why does nix install need nixpkgs but not the delete? This to me looks like a leaky abstraction. nixpkgs is the default package repository, why do I need to state that? Wouldn't it be better to assume that unless specific otherwise? An idiosyncrasy such as this should not be exposed in the default app behavior. Nix's inner workings and phylosophy are super cool, but this isn't a product I would use. It took the bad parts of pacman's CLI and made it worse.
That's because that's the legacy interface. For most uses, installing a package is adding a line to a file and then telling Nix to rebuild, and uninstalling is deleting that same line. In imperative package management, installing requires specifying nixpkgs because you're not naming there program you want to install, but the precise path that it's found at, which includes the repository/"channel"(/"flake") to search for it in. Removing a package doesn't require that because the repository is your user environment, not nixpkgs. This applies to the following system as well. If you still want to do imperative package management, the way to do that is with `nix profile`, specifically `nix profile install` and `nix profile remove`. Searching is also possible with `nix search`, but I usually end up defaulting to the REPL (`nix repl ''`) most of the time.
Also "nixpkgs" is the default local name for the default repository. That said, that's just the local name, not the repository itself. There are multiple versions of nixpkgs including "nixpkgs-small", "nixpkgs-22-11", and "nixpkgs-unstable", along with "nixos" variants of each. You can install multiple if you want under different names and then select which to use. The actual default repository used by most commands is actually $PWD.
Can we get a dive into the install-script? Usually when programs have you pipe a script to sh, it's an os-probe that gets you a traditional package for your OS. Here it gets a tarball with 4 interlinked scripts. I'm sure it's doing what it should, but it's a bit complex to follow what it's actually doing.