Rebuild the World: The Nix Ecosystem
This talk explores the Nix ecosystem as a mechanism for reproducible software builds and dependency management. It discusses how Nix addresses fundamental challenges in software distribution and environment configuration by providing a reliable, declarative approach to system builds. The speakers highlight the benefits of Nix for managing complex dependencies and ensuring consistency across different development and production environments.
Why Your Build System Is the Biggest Blind Spot in Your Supply Chain
TLDR: Modern software development relies on complex, opaque build systems that often lack reproducibility, creating massive blind spots for security teams. This talk breaks down how the Nix ecosystem provides a declarative, immutable approach to dependency management that eliminates the "it works on my machine" problem. By treating build artifacts as immutable, researchers can finally audit the entire supply chain from source code to binary, effectively neutralizing many common supply chain attack vectors.
Software supply chain security is currently dominated by discussions about SBOMs and signing commits, but these are often just band-aids on a broken foundation. Most developers have no idea what actually goes into their production binaries. They rely on mutable environments, hidden system dependencies, and build scripts that haven't been audited in years. If you are a pentester, you know that the easiest way to compromise a target is to poison the build pipeline. If you are a developer, you know that debugging a build failure in a non-reproducible environment is a special kind of hell.
The Nix ecosystem changes this by moving away from imperative package management toward a purely functional, declarative model. Instead of installing packages into a global state, Nix builds packages in isolated environments based on a complete graph of dependencies. Every input, from the compiler version to the specific library headers, is hashed. If the inputs are the same, the output is guaranteed to be identical. This is not just a convenience for developers; it is a fundamental security primitive.
The Problem with Mutable Build Environments
Traditional package managers like apt or npm are inherently stateful. When you run a build, the environment is polluted by whatever happens to be installed on the host system. This creates a massive attack surface. A malicious actor doesn't need to compromise your source code if they can compromise a shared library on your build server or manipulate a global configuration file.
Nix solves this by forcing every dependency to be explicitly defined and isolated. When you define a project in Nix, you are creating a sandbox where the build process cannot reach out to the internet or access files outside of its declared inputs. For a security researcher, this means you can finally perform a truly reproducible build. You can take a project, run the build, and verify that the resulting binary matches the one currently running in production. If it does not match, you have found a potential point of compromise in the supply chain.
Auditing the Supply Chain with Nix
One of the most powerful aspects of this approach is the ability to inspect the entire dependency graph. In a standard environment, tracking down the provenance of a specific binary is a nightmare of recursive dependency trees. In Nix, you can query the derivation of any package to see exactly how it was built.
If you are performing a red team engagement, look for build systems that rely on curl | bash patterns or unpinned dependencies. These are prime targets for T1199-supply-chain-compromise. By contrast, a system built with Nix is significantly harder to poison because the build process will fail if the hash of any dependency changes.
To get started with auditing these environments, you can use the nix-store command to inspect the contents of the store and verify the integrity of your build artifacts:
# List all dependencies for a specific package
nix-store -qR /nix/store/your-package-hash-here
# Verify the integrity of a path in the store
nix-store --verify --check-contents
Moving Beyond Containers
Many teams use Docker to achieve consistency, but Docker is not a build system. It is a packaging format that often hides the same mutable sins as a standard Linux installation. A Dockerfile that runs apt-get update && apt-get install -y ... is not reproducible. It will produce different results depending on when it is run, because the underlying package repositories change constantly.
Nix provides a much stronger guarantee. You can use Nix to build your container images, ensuring that the image is a direct, deterministic result of your source code and configuration. This is the difference between hoping your build is secure and mathematically proving it. When you use NixOS, the entire operating system configuration is managed in the same declarative way. This means you can roll back to a known-good state instantly if you detect a compromise.
The Path Forward for Security Teams
Defenders need to stop treating the build pipeline as a black box. If you cannot reproduce your build, you cannot secure it. The shift toward declarative, immutable infrastructure is not just a trend for DevOps engineers; it is a necessary evolution for anyone who cares about the integrity of the software they ship.
Start by auditing your current build process. Identify where you are pulling dependencies from and whether those sources are pinned to specific hashes. If you are using a language like Rust, look at how Cargo handles dependencies and see if you can wrap those builds in a Nix environment to enforce stricter isolation.
The goal is to reach a state where the entire system is auditable. When you can verify every single component of your stack, you stop chasing ghosts and start building systems that are actually resilient to supply chain attacks. Stop relying on the hope that your build server is clean and start enforcing it through your tooling.
Target Technologies
Attack Techniques
Up Next From This Conference
Similar Talks

Unmasking the Snitch Puck: The Creepy IoT Surveillance Tech in the School Bathroom

Google First-Party Secrets Disclosure




