Help!

Someone told me about this Nix thing and now I have even more questions than before!

Don' t worry, you are not alone. Many people have the same questions when they first encounter Nix. This page is here to help you get started and to answer some of the most common questions that people have when they first encounter Nix.

So your probably ask yourself

What is Nix?

When getting in touch with Nix for the first time, many people have many questions and that is for good reason. Nix is a powerful tool that can be used in many different ways.

Nix is a project that encompasses a variety of tools and concepts aimed at improving software development, deployment, and system management. At its core, Nix is a package manager that uses a unique approach to handle software packages and their dependencies. It is built around the Nix language, a functional programming language designed for describing package builds and system configurations.

In general we will refer to Nix as the whole ecosystem on this page. This covers the Nix language, the Nix package manager, NixOS as an operating system built around Nix and other tools using Nix.

Examples are great, so

You may already know

If you are already familiar with modern build and infrasctructure tools, the following table highlights how Nix's declarative and functional approach aligns with concepts you may already know, while also showcasing the unique benefits that Nix brings to the table.

OCI-Containers
  • Docker
  • Podman
  • Buildah
Specify build steps to reach the desired state Declare the desired state as a evaluatable expression
  • Productivity
  • Reproducibility
  • Auditability
Languages
  • YAML/JSON
  • HCL
  • CUE
Descriptive but often limited in abstraction Use functional programming for powerful abstractions
  • Composability
  • Reusability
  • Maintainability
Build-Software
  • Bazel
  • Buck
Focus on the build process, often limited to specific ecosystems Manage entire software environment including dependencies across ecosystems
  • Reproducibility
  • Flexibility
  • Integration
Package Managers
  • homebrew
  • apt/rpm
  • choco/winget
Install and manage software packages imperatively Declaratively define the desired system state in a functional programming expression
  • Atomic upgrades
  • Rollbacks
  • Consistency

It is important to note that while this table positions Nix as an alternative to these tools, Nix can also complement and integrate with them, enhancing their capabilities through its unique approach to package and environment management. The strength of Nix lies in its ability to provide a consistent and reliable foundation, regardless of the specific tools or ecosystems in use.

That's all great, but

How well does it integrate with

... My Codebase?

Due to its functional nature and large package ecosystem, Nix can handle many different types of environments. From small bash scripts to large monorepos with multiple languages and frameworks, Nix can manage the dependencies and build processes effectively. Allowing for easy packaging of your application. The build instructions are called "derivations" in Nix terminology.

Integrate with Cloud

... My Operating System?

Multiple packages in place can form an environment that may be used in terms of a specific project or in a broader user- or os-wide context. In addition nix offers many tools for "trivial" packaging, covering things like simple files, shell-scripts etc. Nixpkgs, the main package repository for Nix, contains thousands of packages for Linux and MacOS, targeting either x86_64 or aarch64 architectures.

Integrate with Cloud

... My Hardware?

This combination of packages and environments can be used to define entire system configurations, including services, users, and system settings. NixOS, a Linux distribution built on top of Nix, allows for declarative configuration of the entire operating system, making it easy to manage and reproduce system setups across different machines.

Integrate with Cloud
And what about

The costs?

Nix as a tool is free and open source software, but there are costs associated with using it. These costs can be divided into two categories:

Training

Being a functional language with a large standard library and serving many usecases, Nix can overwhealming, especially for beginners. This may slow down the adoptoin process and require additional training for team members. However, once the initial learning curve is overcome, the benefits of using Nix often outweigh the initial investment in training.

Storage/CI time costs

Nix stores all its dependencies and outputs in (so called derivations) in the nix-store. This may grow over time when not garbage-collected regulary and may increase storage needs.

In addition, every nix derivation has to load all of its dependencies before starting the build process, this may increase CI runtimes in comparison to using prebuilt OCI images or the CI servers global packages.

But as with any tool

There are some Risks

Talent pool

Due to its steep learning curve and niche popularity in comparison to other package managers, finding experienced Nix users may be more challenging. However, the Nix community is active and growing, with many resources available for learning and support. Investing in training and development can help build a skilled team over time.

Supply chain security

While Nix's declarative and reproducible nature enhances security, it also introduces some supply chain risks. E.g. while most of nixpkgs is built from source, some packages rely on pre-compiled binaries or external sources, which, as well as binary caches, could potentially be compromised. It's important to vet and monitor these sources to ensure the integrity of your software supply chain.

Packaging overhead

Creating and maintaining Nix expressions for packages can require additional effort. Projects with many different dependencies, multiple build tools or build processes that require an active internet connection may require significant initial setup and ongoing maintenance.

But once you are in it

There are many benefits

Long-term savings

While there may be initial costs associated with adopting Nix, the long-term savings can be significant. By reducing the time and effort required for managing dependencies, environments, and deployments, Nix can lead to increased productivity and reduced operational costs over time.

Job security

By adopting Nix, organizations can reduce their reliance on specific individuals or teams for managing environments and deployments. The declarative nature of Nix allows for easier knowledge transfer and reduces the risk of key personnel leaving the organization.

Availability

Nix's declarative nature and ability to roll back changes can enhance the availability of systems and applications. In the event of a failure or misconfiguration, Nix allows for quick recovery to a known good state, minimizing downtime and ensuring continuous availability.

Uniformity

Nix provides a consistent and uniform way of managing environments and deployments across different projects, languages and tools within an organization. This uniformity can lead to reduced complexity, easier collaboration, and improved overall efficiency.

Control

Nix allows you to have full control over your environments and dependencies. You can specify exact versions of packages, control build processes, and control how your developent shell or machine is set up and optionally isolate everything.

Customisation

Nix's flexibility allows for extensive customization of environments and deployments. You can tailor your setups to meet specific requirements, ensuring that your systems are optimized for your unique use cases and fit your teams and projects requirements.

Auditability

Due to everything being declarative and versioned, you can easily track changes to your environments and deployments over time. This not only allows for easier debugging and troubleshooting, but also provides a clear audit trail for compliance and security purposes.

With all that said, let's show some

Use Cases

Dev Environments

Nix allows developers to create isolated and reproducible development environments using so called "nix shells". These environments can be defined declaratively, specifying the exact versions of tools, libraries, and dependencies needed for a project.

Reproducable Builds

Nix ensures that software builds are reproducible by capturing all dependencies and build instructions in a declarative manner. This allows you to recreate the same build environment consistently, reducing issues related to dependency conflicts or version mismatches.

Reproducible Infrastructure

Nix can be used to define and manage entire system configurations declaratively, enabling reproducible infrastructure setups. The NixOS Linux distribution allows you to specify system services, users, and settings in a single configuration file, making it easy to reproduce and manage system setups across different machines.

In the end

We are a global community

While many projects would just talk about the technical aspects of Nix, we want to put our community efforts front and center. This is the part you will be working with most of the time. The Nix community is a diverse group of people from all over the world, with different backgrounds, experiences, and perspectives. We are united by our passion for declarativity and reproducability and our desire to make it better for everyone. We are a welcoming and inclusive community, and we encourage you to get involved!

A globe with a nix logo in the center A line of people with different skin tones and hair colors

Are you interested?

You may have further questions or want to discuss your specific use case. Our foundation representatives are here to help.

Scroll to top