Nix never uses host dependencies, it always builds with exactly precise dependencies every time, and will always refer to them from then on.
Nix lets you roll back changes atomically.
nix-shell lets you make build environments that are totally reproducible across machines, and don’t interfere with each other. You can freely mix any number of libraries of versions or software on the same machine and they don’t conflict.
With Ubuntu, every time you want to fix something with your car, you roll it into the garage, pop open the hood and get to work. It's intensive labour, results will vary, and undoing a change can be difficult.
With NixOS, it's like 3D printing a new car every time. You'll design a model, press a button, and the car gets built from scratch. If you don't like it, tweak the design a bit, and print a new car. If the new car breaks, just go back to the previous known-good one, which is already in your garage. You can even take the design documents to your friend and generate an exactly identical model.
sudo
command sets the wrong $HOME
, have to use sudo -i
for nix commands that need sudo.
Nix is Turing complete language used for configuration and building packages.
Can use nox, nix search, nix-repl, nixOS packages to search for packages.
Think of Nix (the language) as an expression-based programming language where every program evaluates to a single (possibly complex) value; that resulting value is what is used as eg. the configuration of your system or a package, but it means that you can generate that value based on arbitrary logic and abstractions like you would with a regular programming language.
As for domain-specific package managers, It Depends; it's possible with varying degrees of hackiness (and I definitely use eg. npm for development), but for a 'real' deployment - whether as a service on a server or as a local application - you'd want to convert your project's metadata to a Nix expression and let Nix handle the dependency management.
Overlay adds/overrides something in the global package set.
In general, you should only install things with nix, and not use any other package managers.
The main idea of the Nix approach is to store software components in isolation from each other in a central component store, under path names that contain cryptographic hashes of all inputs involved in building the component, such as /nix/store/rwmfbhb2znwp...-firefox1.0.4
.
Don't install libraries with Nix.
Derivations are variables + build script.
Docs are in .xml
files in /docs
To build derivation in nixpkgs, at root of nixpkgs
, run nix build -f . <pkg-name>
(ie nix build -f . wifi-password
)
To find out the SHA256, run nix-prefetch-url -A <pkg-name>.src
(ie nix-prefetch-url -A wifi-password.src
). nix-prefetch-url
works with GitHub. This gives you the SHA256 you can copy.
Nix, the purely functional build system - Great intro article.
hnix - Haskell re-implementation of the Nix expression language.
example-nix - A way to develop software with Nix.
Hercules CI - Hosted CI for building Nix projects on your infrastructure.
Dysnomia - Tool and plug-in system that can be used to automatically deploy mutable components.
Disnix - Nix-based distributed service deployment tool.
NUR - Nix User Repository: User contributed nix packages.
Eris - Binary cache for Nix.
pypi2nix - Generate Nix expressions for Python packages.
hnix-store - Haskell implementation of the nix store API.
Nix RFCs
nix-linter - Linter for the Nix expression language.
Install Nix docs by Mozilla - Pretty good.
niv - Painless dependencies for Nix projects.
Cachix - Build Nix packages once and share them for good.
Alternative Haskell Infrastructure for Nixpkgs - Works by automatically translating your Cabal or Stack project and its dependencies into Nix code.
nix-bundle - Bundle Nix derivations to run anywhere.
lorri - nix-shell replacement for project development.
nixfmt - Formatter for Nix code.
Nix for devs - Collection of recipes focused on nix-shell to make setting up project environments easy.
nixpkgs-fmt - Nix code formatter for nixpkgs.
hnix-lsp - Language Server Protocol for Nix.
Nixery - Container registry which transparently builds images using the Nix package manager.
wharfix - Minimal stateless+readonly docker registry based on nix expressions. Heavily inspired by Nixery.
Nix - A One Pager - A (more or less) one page introduction to Nix, the language.
yants - Tiny type-checker for data in Nix, written in Nix.
nix-shorts - Collection of short notes about Nix, down to what is immediately needed for users.
rnix-parser - Nix parser written in Rust.
Naersk - Nix support for building cargo crates.
nix-diff - Explain why two Nix derivations differ.
nix-du - Visualise which gc-roots to delete to free some space in your nix store.
format-nix - Simple formatter for Nix using tree-sitter-nix.
go-nix - Nix language parser and Nix-compatible file hasher in Go.
nix-dns - Nix DSL for DNS zone files.
nix-index - Quickly locate nix packages with specific files.
Nix-bisect - Bisect Nix Builds.
Grafanix - Visualize your Nix dependencies.
Built with Nix - Build software only once. (Code)
rnix-lsp - WIP Language Server for Nix.
nixpkgs - Nix Packages collection.
Nixology (2020) - Series of videos I've been releasing within Shopify to help promote and educate about Nix.
What Is Nix (2020) (HN) (Lobsters)
comma - Runs software without installing it. Wraps together nix run and nix-index.
nix-derivation - Parse and render *.drv files.
nix-build-uncached - CI friendly wrapper around nix-build.
nix-tests - Scratchpad for small experimental things I am doing with Nix.
flake-utils - Pure Nix flake utility functions.
nixdu - Interactively browse the dependency graph of your Nix derivations.
Nix Package Versions - Search for old versions of Nix packages. (Code) (Reddit)
Opinionated Nix repository template - Based on nix.dev tutorials, repository template to get you started with Nix.
Bramble - Functional build system inspired by nix.
Nix Monorepo - How you might use Nix in a larger, multi-language project.
nixbuild.net - Cloud service that runs your Nix builds. It takes away the effort of maintaining and scaling build clusters, and integrates easily with any setup that uses Nix. (Docs) (Tweet)
Manix - Fast CLI documentation searcher for Nix.
Nix Quick Install Action - GitHub Action installs Nix in single-user mode, and adds almost no time at all to your workflow's running time. (Web)
sorri - Simple, lightweight implementation of Tweag's lorri.
nix-buildkite - Take a Nix job description and turn it into separate Buildkite steps with dependencies. (Tweet)
pre-commit-hooks.nix - Seamless integration of pre-commit git hooks with Nix.
nix-direnv - Fast, persistent use_nix implementation for direnv.
NixCon 2020 (Stream) (Code) (HN)
Nickel - Lightweight configuration language. Its purpose is to automate the generation of static configuration files. (Nickel: better configuration for less)
Local Nix Cache - Poor and hacky attempt at re-serving local nix packages that came from trusted sources.
update-nix-fetchgit - Program to automatically update fetchgit values in Nix expressions.
Cache install Nix packages - Use the GitHub Actions cache for Nix packages.
nixbuild.net Action - GitHub Action for using the nixbuild.net service.
fromElisp - Emacs Lisp reader in Nix.
deploy-rs - Simple, multi-profile Nix-flake deploy tool.
TodoMVC-Nix - One-stop reference to build TodoMVC application inside the Nix world.