Hacker News new | ask | show | jobs
by ayushnix 1707 days ago
Can I install packages not present in the official NixOS repositories without learning the Nix DSL?
1 comments

You can, if your repository of choice provides a Nix channel[1]. However, the community effort is currently concentrated in the official Nixpkgs repository. So while there are numerous projects based on Nix run outside of the NixOS organization, there aren't any "major" unofficial package repository that I'm aware of. For packaging work, people just tend to contribute directly to the official repository. In fact, the volume of PRs in the official repository is so high I'm surprised at how they manage to keep going in spite of that.

It's also worth noting that many of the benefits of Nix are directly driven from being able to write custom Nix expressions. So if you want to reap all of its benefits, it's definitely worth learning. The core language is small and the experience is not so far off from writing JSON, so that part is relatively easy to pick up. The actual work lies in learning how packaging is done in Nixpkgs. This is best done by grepping around the Nixpkgs repository for examples. Nixpkgs' policy of having all packages in a single repository really shines here.

[1]: https://nixos.wiki/wiki/Nix_channels

I tried using NixOS a few years ago but found it too esoteric. Learning the Nix DSL and the NixOS way of doing things might be rewarding but it has a significant threshold that I'd need to cross before I'm comfortable using it.

One of the things I really appreciate about Arch is the flexibility it offers. I'm not forced to use GRUB if I don't want to, unlike Fedora and Debian. I'm also not forced to see dm-crypt UUIDs on mounted disks like Dracut does. I can choose what I want. This latter issue was present in NixOS as well the last time I tried it.

Oh, I'm also not a fan of how unbearably slow the nix package manager is compared to pacman.

I do recognize the advantages of declarative configuration of your entire operating system though.

> Oh, I'm also not a fan of how unbearably slow the nix package manager is compared to pacman.

Building a declared environment takes quite a while and switching a NixOS or home-manager generation takes even longer. It was my main complaint about NixOS when I was starting out.

The thing I realised though is that the main scenario where you actually need the speed is when you want to try things out and for that, Nix' ad-hoc environments are much better suited.

When I want to try a new program (btop for example), I simply run `nix-shell -p btop` rather than adding it to my declared environment and sitting through a `nixos-rebuild test`. That's usually faster and, more importantly, cleaner than installing the package to a global environment with a regular package manager.