12 apr 2024
this libnix nlnet application i’ve made is meant to contribute to the nix ecosystem by making nix a generic cross platform backend for language specific package managers.
it consists of two parts:
or in simpler terms, figuring out a way to make nix more attractive for the industry so can be used during development and not only for deployment afterwards.
nix, the purely functional programming language and package manager, has been around since 3. jun 2003 - roughly 20 years. yet there is no vast industry adaption of nix (or nixos). why is that?
in parts:
it is worth to have a look at the global market share held by operating systems for desktop PCs, from january 2013 to february 2024:
taking macOS + Linux together, nix could be used on ~20% of the desktops.
the valve steam statistics for march 2024 show:
the gaming industry is a good early indicator for the general desktop usage with valve being a key driver in linux adaption together with AMD.
the nix-surveys shed some light on how this is perceived by the nix community:
with nix working only on unix like environments, one can’t expect vast adoptions unless the windows reign is over. nix is strongly designed for unix like systems. this might happen due to major macOS market share gains or the linux desktop
nixos, in particular, is strongly tied to a linux kernel and systemd, but we don’t mention this much onwards as the focus is on nix as a package manager.
given the motivation and statistics, the mission is to make software development more about development and less about package management. this will be done by using nix as a generic cross platform backend for language specific package managers.
before we go into a native nix on windows we have to look at nixos-wsl using WSL2.
using nixos-wsl with nixos-vscode-server via ssh is the most convenient way to work with nix on windows today. i’ve been using nixos-wsl a lot and it works for development and is much better compared to VM based development. that said, nixos-wsl is no replacement for a native windows experience, especially in regards to IDE integration and runtime performance.
for historic reasons we should also mention the ternaris report from 2015 which outlines obstacles to overcome: https://ternaris.com/lab/nix-on-windows.html. in parts this has been outdated but it still might be an interesting read.
if you want to join development for a native nix on windows, see these resources:
since nix is c++, bash and perl there are some things to consider:
or maybe start with the rust port of nix?
the next post in the libnix series will cover the current status of nix on windows.
language specific PMs like npm, yarn, cargo, conan, pip, … are the most common way to manage software stacks in the industry. some of them are even cross platform already!
key observations 2024:
the main challenge here is how well these can be integrated with nix!
most PMs are wrapped using nix abstractions, see https://nixos.wiki/wiki/Language-specific_package_helpers and on program updates these need to be redone.
language specific package managers (like cargo, npm) solve these problems:
ideally this only means a manual run of some tool like node2nix but often times it means a manual patching of build scripts.
these two projects have the concept of libnix already implemented:
i will look into these in more detail in the next post about libnix series.
windows nix support matters because then we can share package management concepts between operating systems. ideally we can make nix into a generic backend for PMs making software development great again!