Skip to main content
Nur Nix provides a collection of utility libraries that simplify common patterns in Nix flakes and streamline cross-compilation workflows for various programming languages.

Available Libraries

Flake Utilities

mkFlake

Simplify multi-system flake outputs (like flake-utils)

mkChecks

Transform check definitions into flake checks

mkApps

Convert script definitions into flake apps

Language-Specific Utilities

Go

Cross-compile Go applications to any platform

Rust

Cross-compile Rust using cargo-zigbuild

Deno

Compile TypeScript/JavaScript to standalone binaries

Gleam

Build Gleam projects for Erlang or JavaScript targets

Protocol Buffers

Buf

Fetch and manage Buf dependencies in Nix builds

Usage Pattern

All libraries are available through the Nur Nix flake:
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nur.url = "github:your-org/nur-nix";
  };

  outputs = { self, nixpkgs, nur }:
    nur.lib.mkFlake { } (system:
      let
        pkgs = nixpkgs.legacyPackages.${system};
        lib = nur.lib.${system};
      in
      {
        # Use any library function
        packages.my-app = lib.go.compile {
          package = pkgs.buildGoModule { ... };
          goos = "windows";
          goarch = "amd64";
        };
      }
    );
}

Design Philosophy

Pure Nix Functions

All utilities in the libs/ directory are pure Nix functions that don’t depend on pkgs. This makes them:
  • Reusable across different nixpkgs versions
  • Easy to test and reason about
  • Suitable for use in flake schemas

Override-Friendly

Most functions use lib.makeOverridable so you can customize behavior:
lib.go.compile.override {
  goos = "darwin";
} {
  package = myGoApp;
}

Minimal Boilerplate

These libraries eliminate repetitive patterns:
  • Without mkFlake: Manually map over systems, merge attrsets
  • With mkFlake: Single function call handles all systems
  • Without mkApps: Write derivations with install phases
  • With mkApps: Just provide a script

Next Steps

Flake Utilities

Start with mkFlake to simplify your flake structure

Cross-Compilation

Learn how to cross-compile applications

Build docs developers (and LLMs) love