Is it a package manager? A build system? An operating system? A container platform? A sandbox? An automation tool?
Which widely used, existing software tools is it analogous to?
Is it a package manager? A build system? An operating system? A container platform? A sandbox? An automation tool?
Which widely used, existing software tools is it analogous to?
- Nix is a tool for building and installing software.
- Nix is a language for expressing how to build a package. Nix-the-tool reads expressions defined in Nix-the-language to know what to do. At the end of the day, this translates into normal commands that run in a sandboxed build environment.
- Nixpkgs is a monolithic repository of 80000+ packages, defined literally as one giant expression in the Nix language (this works fine because Nix is an extremely lazy language). This also includes lots of helpers and abstractions for building packages that can be handy in your own projects. It is possible to use Nix-the-tool without Nixpkgs, but nobody does.
- NixOS is a Linux distribution built on these foundations. Everything under /etc is built from nix expressions. You can not directly edit these. Mostly NixOS is about building systemd unit files from Nix expressions - viewed through that lens it's not really all that exotic of an OS. NixOS has modules that make it very easy to configure and run lots of software.
Previously I ran Debian across my setup (with a homemade configuration templating/distribution tool) but it feels like Nix really bundles up the accidental complexity of installing/deploying most software in a contained way, much more than a traditional distro.
I'll be much happier when Nix gains full reproducibility and functionality like Guix's `challenge`. But even now it feels like one of the closest implementations to the Free Software dream.
But if you mean distinct computers, then that's just three distinct configs. And it's easy to factor out common bits and use it in all three configs, since you configure things using Nix-the-language.
And if you mean all three at the same time on one PC, that's exactly what I do with my home server.
I thought that `sudo nixos-rebuild switch` was supposed to do exactly that; swap from whatever "state" your PC is on to the result of the nix expresison on "/etc/nixos/configuration.nix"
But it would be very unusual to constantly switch between two long-lived configs. I don't see why it wouldn't work, though.
But if, say, you want to compile a random C program you found on the web then it is up to your to now set up the build environment and provide all the libraries and deps to be able to compile and then run the program. Just running make or ./configure or cmake . isn't going to do it because those configuration setups won't have a system lib environment to check against. It seems like a really weird distro to chose as your desktop but makes fine sense in commercial enterprises we're you're going to re-build the world for all your software anyway.
Ironically, this further emphasizes how confusing the project is (projects are?).
Agree that the documentation for all of this could be a lot better and more discoverable. It's good once you get over the initial hump though.
It's not containerization - containerization means something very specific (user namespaces + chroot). It may attack some of the same problems, but it is not a container.
The sandbox that nix builds run within is more or less a container, however.
Nixpkg is a package manager, which uses the Nix programming language to describe dependencies and build steps. Like all package managers, it has components that could be called a "build system", but that's not its main focus.
> An operating system?
There's NixOS which is a Linux distro built on nixpkg. But you can also use Nix under other distros.
> A container platform? A sandbox?
Because nix is based on an underlying immutable store of installed packages (and doesn't rely on global system state), it is trivial to spin up a shell environment in which specific combinations of package versions are available without affecting any other shell.
This property allows it to be used as a lightweight alternative to containers, what people usually use Docker for: setting up an environment with well-known package versions that are the dependencies of your project.
As a very simple example, I've written a simple setup for running a chosen PostgreSQL version inside a directory: https://code.more-magic.net/ppq/about/. You could easily build this out by adding additional software, for example if you add Python and Django from Nixpkgs to this, you'd have a complete self-contained (or "sandboxed") dev environment.
When you're done developing on the project, you simple remove the repo and the entire environment is dropped too.
At work we use something like the above, with Java and Clojure and a whole bunch of other software, all completely self-contained. I never had to install any of it globally and didn't have to mess around with $JAVA_HOME etc.
*Nix
AFAIK It's each of those things, each unfortunately named the same.
It starts with a language that lets you declare the desired state of your environment, including which packages are present and the configuration of those packages. The packages are installed and managed through the Nix package manager. The end result is an 'environment' that reflects the desired state you expressed. That environment can be a Docker image, an ISO, or it could be a running system you're booted into (in the case of NixOS). Or it can even be an ephemeral environment that exists on the filesystem of whatever distribution you're using (in the case of nix-shell). Each of these options offers different levels of isolation and reproducibility, depending on the requirements of your project or system.
There's lots of clever components that make something like this possible, and they're all wrapped up in the Nix umbrella.
Yes
It's kinda like Docker, but without the images/containers.
Docker solves two problems: distributing the same program everywhere, and running those programs using containers.
Nix solves the former problem. But, since it doesn't use containers, you can run the Nix packages without needing to worry about mounting into VMs or containers.
Yes
> A build system?
No
> An operating system?
Thats NixOS
> A container platform?
nixpkgs has functions to build them
> A sandbox?
No
> An automation tool?
Yes and no
> Which widely used, existing software tools is it analogous to?
Arch Linux plus Haskell plus Ansible plus better