7 ms·
I'm going to take this opportunity to plug my favourite open source project - the Nix package manager[1]. It can work as a universal homebrew replacement (work
by vomitcuddle 9y ago
I'm going to take this opportunity to plug my favourite open source project - the Nix package manager[1].
It can work as a universal homebrew replacement (works on MacOS, Linux, WSL and can be easily ported to most BSD variants), comes with a huge collection of packages[2] and produces its own reproducible source builds. Like homebrew, it's a hybrid source and binary based package manager (if you haven't done anything to modify the build, it will likely be downloaded from a cache of pre-built binaries[3]). Unlike something like homebrew-cask, it will never download the pre-built .dmg file from the developer's website - with the obvious exception of proprietary software.
It can also work as a great AUR/ports replacement on Linux systems. Fedora doesn't provide FFmpeg or an up-to-date version of a package you need? No problem, just get it from Nix! All the advantages of a rolling release distro, without actually having to use one.
Due to its functional nature, it comes with a wealth of advantages over homebrew and other traditional package managers[4]. Once you get past the learning curve, creating your own packages or modifying existing ones is a breeze. It can create disposable development environments with dependencies of whatever project you're working on, without having to install them in your system or user profile! Check out the Nix manual[5] for more information.
It's so flexible that people have built a Linux distribution where your entire system configuration is a Nix derivation (package) - with atomic upgrades, rollbacks, reproducible configuration and much more! [6]
[1] https://nixos.org/nix/ https://nixos.org/nix/
[2] https://nixos.org/nixos/packages.html https://nixos.org/nixos/packages.html
[3] https://hydra.nixos.org/ https://hydra.nixos.org/
[4] https://nixos.org/nix/about.html https://nixos.org/nix/about.html
[5] https://nixos.org/nix/manual/ https://nixos.org/nix/manual/
[6] https://nixos.org/nixos/about.html https://nixos.org/nixos/about.html
- skybrian 9y agoIt looks like you can search the nix package list but not browse it? Based on clicking on the first few packages listed, most Nix packages are apparently for Linux. Is there some way to see which packages are available for Macs?
- nagvx 9y agoIf we're plugging functional package management, we may as well mention the other significant project in this space - Guix: https://www.gnu.org/software/guix/download/ https://www.gnu.org/software/guix/download/ Essentially, all the benefits touted above apply here, but it is worth noting that Guix is a younger project. The author was originally a Nix dev, but found the DSL to be too awkward to use in practice, and opted to use Scheme through and through. Yes, Emacs bindings are available. Also, Guix can now produce Dockerfiles, if that floats your boat: https://www.gnu.org/software/guix/news/creating-bundles-with-guix-pack.html https://www.gnu.org/software/guix/news/creating-bundles-with...
- type0 9y agoSo Haskell users use NixOS and Scheme users use Guix?
- drawnwren 9y agoIt's not Haskell, strictly speaking. There are some weird global state mutations in NixOS (I.e. the pkgs object) that aren't as intuitive as you'd like. Also, the novel file structure makes composing packages that aren't already built to do so quite difficult. Trying to get eclimd to work with emacs and eclipse was a giant pain.
- Profpatsch 9y agoThere are no global state mutations in `pkgs`. All immutable parts are in `impure.nix`, which already has a complete `pkgs`. Maybe you are confusing state mutations with fixed points, which are used extensively (thankfully).
- drawnwren 9y agoThere are no global state mutations in pkgs until you need a custom package, and then you're overriding the global state with your own custom state.
- fleg 9y ago> Fedora doesn't provide FFmpeg or an up-to-date version of a package you need? No problem, just get it from Nix! Will it add the packages installed this way to rpmdb?
- zzzcpan 9y agoNo, it won't, it is isolated from the rest of the system and only does things in /nix directory.
- zzzcpan 9y agoAlso for newcomers - install nox right away (it's a tool to install packages into nix), nix-env is just too user hostile, you might give up quickly.
- deleted 9y ago[deleted]
- i336_ 9y agoHere's my problem. I breezed through your explanation with great interest and became more curious than ever to try Nix out at some point - I've heard tidbits about it over the past few months and found it to be a fascinating project. Then I read some of the other comments in this subthread, about Nix being Haskell and Guix being Scheme, and how the internals don't conform to the principle of least surprise within their development domains - and became sad. On the one hand, there are going to be teething problems, that's fine. On the other hand, if I'm learning a new package manager, I ONLY want to learn package management. My brain gets really confused if I don't stay highly domain-specific when learning new things. So if you present me with "you need to learn B to grasp and work with A" you'll just get a duck trying repeatedly to jump up over the curb and failing. Looks hilarious, maybe, but very impractical. I don't know Haskell or Scheme yet, which puts a great dampener on me using Nix for a bit. As another practical example, emacs and vi do greatly interest me (particularly emacs' flexibility), but I'm not interested in having to learn Lisp or memorize a Nethack labyrinth of single-character keyboard commands (and the scopes for what works with what and where). I suspect I might pick up emacs at some point after I've played with Lisp/Scheme/et al for a while, but that's not right now. TL;DR: It's a strain for me to learn new things (basically do anything that requires focus and can't be done with passive autonomy) if my mental stack already has anything in it. AKA, I have a monumentally stupid variant of ADHD that gives me learning difficulties.
- thomastjeffery 9y agoTo be clear, Nix isn't haskell. It has its own domain-specific language. The documentation is a total mess, and months into using NixOS, I still don't really understand it. That being said, NixOS is the best damn OS I have ever used. Period. Installing NixOS is a total breeze. It's magical. 1. Boot live CD 2. Mount partitions 3. Write a simple configuration.nix 4. nixos-install 5. Boot a complete system, and log in with the user you defined in your configuration.nix (with a hashed password and everything). nix-env lets you install packages in your home directory (without root). nix-shell lets you create a special environment with specific packages, etc. and run a shell in that environment. nixos-rebuild [switch test boot] (as root) creates a new system according to your modified configuration.nix. If you use switch, it (re)starts updated/new services all on its own. If you broke your system, just reboot, and pick the second most recent boot entry, and you will be back where you started. TL;DR NixOS is well worth the effort. The benefits far far outweigh the headaches, and there is only room for improvement. You will start with a system that you cannot break!
- thomastjeffery 9y agoUnfortunately with Nix, documentation is a total mess. I have been using NixOS for a couple of months now, and still don't really understand how to write nix expressions.