Copying Nix Flake inputs to a different machine

Simple one-liner to avoid re-downloading inputs on a different machine on your LAN

November 2, 2025 · 1 min

`lib.catAttrs` in Nixpkgs

In Nix it is possible to replace a call to builtins.map with lib.catAttrs if the transformation is just pulling out a field. For example: builtins.map (item: item.field) list can instead just be catAttrs "field" list.

June 30, 2025 · 1 min

`nix flake info`

Nix CLI’s flake info subcommand is great to find duplicate inputs, nix-melt is too much manual labor.

June 30, 2025 · 1 min

Building derivations in the Nix REPL

In a Nix REPL you can run :bl inputs.nixpkgs.legacyPackages.aarch64-linux.pkgs.attic-server to build the derivation and create a result link. Can also run :bl nixosConfigurations.ryzenbox.pkgs.attic-client.

June 30, 2025 · 1 min

Initial setup for Nix remote builds

Nix remote builds are run through the daemon (obviously) so they are executed as root on the host delegating builds. To prevent issues, nix store ping needs to be run as root first to verify the host key before Nix can start using the remote host to do builds.

June 30, 2025 · 1 min

Nix `builtins.toString` behaves in a surprising manner

Nix’s builtins.toString doesn’t stringify a Boolean directly but instead returns an empty string for false and "1" for true. The reason for this is apparently that the result is optimized for use in shell pipelines, so the result is expected to go into a [ -z $result ] on the result of calling the function. Lost entirely too much time to this.

June 30, 2025 · 1 min

Quick way to spin up a Nix binary cache on your filesystem

Nixpkgs has a pkgs.mkBinaryCache helper that lets you create a flat-file binary cache suitable for moving around without needing a server component.

June 30, 2025 · 1 min

Tutorial for the NixOS module system

Found this awesome reference for the NixOS module system: https://nix.dev/tutorials/module-system/index.html

June 30, 2025 · 1 min

Updating Fixed Output Derivations in Nix packages

Nix vendors Golang dependencies in a fixed-output derivation (FOD) which will give confusing errors if the contents change but you don’t update the hash or name. Concrete example: refreshing the update-tailscale.patch file for caddy-tailscale will fail with mysterious “this module is using a different version” until you change either pname or vendorHash to force a rebuild of the FOD and reveal any real errors.

June 30, 2025 · 1 min

Updating unstable packages in Nix

The nix-update CLI allows updating unstable packages to Git commits via --version=branch

June 30, 2025 · 1 min