Nix: An idea whose time has come

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

CodeRabbit: AI Code Reviews for Developers
Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
coderabbit.ai
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • nix

    Nix, the purely functional package manager

    Try NixOS with the new redesigned command line. It's much simpler. No idea why this is not getting advertised more widely, as it's been worked on for a few years already: https://github.com/NixOS/nix/issues/779

    For example, opening a temporary shell with, say, GIMP, is as simple as: nix run nixpkgs.gimp

    If you want to check what packages are available for GIMP, because you are not sure what to run: nix search gimp

    I tend to forget very convoluted commands, and I find the new nix much simpler than pacman or apt.

  • CodeRabbit

    CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.

    CodeRabbit logo
  • nixpkgs

    Nix Packages collection & NixOS

    It's still Nix.

    To be clear: I have extremely high praise for nix, and I'm getting nix-darwin going at work for engineer onboarding. That being said, it feels more like a research project. It pioneers some extremely important ideas and, by necessity, some of those ideas are "bolt-ons" and truly just feel like a proof of concept. Guix, for example, has home-manager built right in and doesn't suffer from the error message issues that home-manager does.

    I used Arch, btw, and AUR was truly a thing of beauty. PPAs (of Ubuntu) are, in theory, even better. Have you seen the sheer amount of effort it takes to keep nixpkgs going?[1]

    Home-manager, amazing thing that it is, has several issues. From their own documentation:

    > Unfortunately, it is quite possible to get difficult to understand errors when working with Home Manager, such as infinite loops with no clear source reference. You should therefore be comfortable using the Nix language and the various tools in the Nix ecosystem.

    Flakes? Experimental:

    > Nix Flakes are an upcoming feature of the Nix package manager.

    I also think it should be possible for the mainline (e.g. nixpkgs) to import a flake: the nixpkgs maintenance nightmare has to end. Dhall can do that, and will even verify it with a hash[2].

    They came up with extremely important ideas, but the same ideas taken as a whole (instead of iteratively) could be combined into something far greater.

    [1]: https://github.com/NixOS/nixpkgs/commits/master

  • rfcs

    The Nix community RFCs (by NixOS)

    I am not so sure about that. Nixpkgs is a big ball because it is the final integration point. And I do in fact find myself refactoring individual packages and the infra at the same time.

    https://github.com/NixOS/rfcs/pull/109/ I wrote to hopefully make the lang2nix packages work with Nixpkgs. I think this would achieve most of the benefits of what you propose: cleaner separation of infra vs vs ad-hoc per-package stuff, while still retaining the flexibility of the monorepo.

    The goal is to work with upstream developers so less and less ad-hoc crap is needed. Then the one repo ends up "all stdlib no packages", because the packages are basically autogenerated!

  • dhall

    Maintainable configuration files

    I haven't tried it but apparently you can compile to Nix from Dhall:

    > You can use this compiler to program Nix using the Dhall language. This package targets people who wish Nix had a type system.

    https://github.com/dhall-lang/dhall-haskell/tree/master/dhal...

  • dhall-lang

    Maintainable configuration files

  • winget-cli

    WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).

    Windows now has a first-party package manager: https://github.com/microsoft/winget-cli

    It positively surprised me when I did `sudo winget upgrade` (I first did `winget install gerardog.gsudo` in an admin prompt) and it detected and upgraded the majority of the already installed OSS on my Windows workstation.

  • purenix

    Nix backend for PureScript. Transpile PureScript code to Nix.

    There’s also the PureNix project that lets you go from PureScript→Nix. Caveats in the docs.

    https://github.com/purenix-org/purenix

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  • nix-fpga-tools

    I would be surprised if there are any binaries that are outright impossible to run under Nix. I spent a weekend getting Xilinx ISE to run in Nix [0], that is a binary behemoth. It uses bubblewrap (already used in Nixpkgs) to setup a bunch of bind mounts so that the binaries see a standard FHS Linux layout.

    [0] - https://github.com/benpye/nix-fpga-tools

  • nickel

    Better configuration for less

  • Home Manager using Nix

    Manage a user environment using Nix [maintainer=@rycee]

    I used Arch for a long time but I always find that I couldn't keep a consistent configuration across multiple machines. The machine I used most often would quickly grow numerous augmentations and changes that I would be missing on my laptop and desktop. There are tools like etckeeper and numerous dotfile managers but most lacked the capability to recognize the machine's state/hardware (e.g. laptop, desktop, server, etc.) or only managed dotfiles but not /etc.

    Overtime the best configuration tended to be just using the defaults because getting used to a tmux.conf on one machine would just become an annoyance one I was on a machine without it. (Plus now you need to use about 12 different configuration languages :))

    A huge advantage Nix has over any other configuration tool is that is a single source of truth. A normal dotfiles repo doesn't know anything about the actual programs or OS so it's very easy for it to become incompatible with a machine's actual state.

    On Nix, tools like home-manager [1] especially when used in a flake-template like devos [2] just solves this problem really well. It's very easy to make a change, switch to the new configuration, and then commit the change. Managing bespoke services and scripts is very easy because one file in Nix can create a service with a script's contents, create a user, install necessary packages, etc.

    I think (desktop) Linux is partly a niche market because the management can be very complex. Nix is certainly very complex itself but its structured enough that it can create very simple systems. There are already several NixOS based OS's that are basically just configuration templates. I could certainly see a more user-friendly distro being released using Nix as the foundation.

    [1] https://github.com/nix-community/home-manager

  • digga

    A flake utility library to craft shell-, home-, and hosts- environments.

  • devshell

    Per project developer environments

    For simple devshell environments, you probably don't need to write much Nix at all. You can use a tool like numtide/devshell [1] to create a flake from a template which lets you define packages and commands you want to expose via a TOML config file.

    [1] https://github.com/numtide/devshell/blob/master/docs/getting...

    The reason to use the Flake based version is that then it will automatically create a flake.lock file which should be added to version control so every user will use the same nixpkgs version.

    While you can build normal Dockerfiles using some Nix tools it would be the same as building the image from Docker directly. If you want the same package-pinning guarantees in Docker images, then you need to build a NixOS based image which will let you add Nix packages. The pkgs.dockerTools.buildLayeredImage and it's counterpart function pkgs.dockerTools.streamLayeredImage, are interesting in that they will build a layered docker image so that packages can be shared between containers which makes rebuilding images much faster. [2]

    At some point you will probably want to manage the project's Go and Node dependencies themselves from Nix and that involve writing Nix. Essentially the process is to use a tool that convert's the go.mod and node/yarn lock file into a .nix file [3,4]. This can be a bit more involved as some dependencies especially nodejs ones will want to download additional resources at build time which breaks the Nix model.

    The best way to use Nix is gradually; just start with a simple devshell. There are some oddities when using Nix on Mac so it's best to get those figured out before trying to do too much.

    [2] https://nixos.org/manual/nixpkgs/stable/#ssec-pkgs-dockerToo...

  • homies

    My configuration files (.screenrc, .vimrc, .weechat, .bashrc, .gitconfig, etc)

    Yeah, I think its things like this that make it hard to adopt nix. All I want is a way to say "I want jq, kubectl, and terraform installed" and have it available globally. Not for specific projects or anything like that.

    Right now I maintain a makefile that installs everything for me using `nix profile`:

    https://github.com/sontek/homies/blob/master/justfile#L14-L2...

    Which almost exactly like I want. Only issue is sometimes a new hash is generated (which I don't understand.. maybe a config update in the repos?) and the makefile can't run anymore:

        error: packages '/nix/store/y65pp5hipid0fzxl1z7xjxdk4h9jwfw7-exa-0.10.1/bin/exa' and '/nix/store/gy0bqcs9mcan8af47wakdylhal67dpy4-exa-0.10.1/bin/exa' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Why isn't Nix more popular?

    3 projects | /r/NixOS | 8 Nov 2022
  • Does the Nix language limit NixOS?

    2 projects | /r/NixOS | 25 Jun 2022
  • Nix: An idea whose time has come

    6 projects | /r/programming | 19 Feb 2022
  • How to Learn Nix

    11 projects | news.ycombinator.com | 22 Nov 2021
  • Nix-GUI: Make NixOS usable for non-technical users through settings / GUI

    14 projects | news.ycombinator.com | 10 Oct 2021

Did you konow that Nix is
the 28th most popular programming language
based on number of metions?