A NUR (Nix User Repository) package set
for the auto-patcher org. Package definitions are generated automatically by
an external auto-patcher, one derivation per <package> <version>.
Packages are named <pkg>_<major>_<minor> (e.g. foo_1_2) and live in a flat
namespace. Consumers reach them as nur.repos.auto-patcher.<pkg>_<major>_<minor>.
Build results are pushed to the public Cachix
cache auto-patcher by CI, so consumers fetch binaries instead of rebuilding
from source (NUR is evaluated by the community infra but not built by Hydra).
Add it as a substituter:
nix.settings = {
substituters = [ "https://auto-patcher.cachix.org" ];
trusted-public-keys = [ "auto-patcher.cachix.org-1:<public-key-from-app.cachix.org>" ];
};or ad hoc: cachix use auto-patcher. The public key is shown on the cache page.
Once this repo is registered with NUR, add NUR as usual and reference packages by their flat name:
{ pkgs ? import <nixpkgs> { } }:
let
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/main.tar.gz") {
inherit pkgs;
};
in
nur.repos.auto-patcher.foo_1_2Or wire it in as an overlay / packageOverrides per the
NUR installation docs.
This repo is a self-contained flake, so you can depend on it directly without pulling in NUR:
{
inputs.auto-patcher.url = "github:auto-patcher/nur-packages";
outputs = { self, nixpkgs, auto-patcher }: {
# the package set for your system
# auto-patcher.packages.${system}.foo_1_2
# or merge everything into nixpkgs via the overlay
# nixpkgs.legacyPackages.${system} extended with auto-patcher.overlays.default
};
}Flake outputs:
packages.<system>.<pkg>_<major>_<minor>— each package as a derivation.packages.<system>.default— builds the entire set at once.overlays.default— merges the package set into an existing nixpkgs.legacyPackages.<system>— mirrorsdefault.nix(the NUR evaluation entry point).
default.nix # flat namespace consumers see (GENERATED — do not hand-edit)
flake.nix # flake wrapper: packages / overlay / legacyPackages
pkgs/<name>/build.nix # version-agnostic recipe (written once, never overwritten)
pkgs/<name>/<major>_<minor>.nix # generated thin file: version + rev + hash
pkgs/auto-packager/ # "meta" package: the generator, built with nix
tools/auto-packager/{go.mod,*.go,…} # the generator's Go source
Every package sets meta (description + license, optionally platforms) so it is
indexed by NUR search. Packages that cannot build are kept with
meta.broken = true rather than deleted.
The NUR's own tooling is itself packaged and exposed in the namespace as a "meta" package, so it is built and verified by CI like everything else:
auto-packager— the generator (nur.repos.auto-patcher.auto-packager,nix run .#auto-packager). Source:tools/auto-packager/, built bypkgs/auto-packager/default.nixviabuildGoModule.
Meta packages are declared in a small static list in the generator
(metaPackages in tools/auto-packager/generate.go); everything else in
default.nix is discovered by scanning pkgs/.
Packages are generated and updated by auto-packager, a small Go program that
renders Nix from text/template — no LLM in the update loop. There are two
entry points and two ways they fire.
nix run .#auto-packager -- set --repo <name> --tag <tag> # one package
nix run .#auto-packager -- sync-all # every org repo -> latest tag
nix run .#auto-packager -- regen # re-derive default.nix from pkgs/
# or, from source: cd tools/auto-packager && go run . <cmd>
set parses the tag (v1.2.3 → 1.2.3, major 1, minor 2), prefetches the
source hash with nix-prefetch-url --unpack, and renders the version file from
a Go template. sync-all walks every repo in the org (via gh), resolves each
one's latest numeric tag, and updates them all. Both are idempotent.
default.nix is fully generated by scanning pkgs/ — the filesystem is the
source of truth. After writing version files, the generator re-renders
default.nix from the discovered <major>_<minor>.nix files plus the static
meta packages, sorted. Don't hand-edit default.nix; run regen instead.
Each package owns a version-agnostic recipe at pkgs/<name>/build.nix, written
once when the repo is onboarded and never overwritten by the generator. The
generator only writes the thin, per-version pkgs/<name>/<major>_<minor>.nix
(which passes version + rev + hash into build.nix). Customize a
package's real build by editing its build.nix; the default template is a
passthrough that installs the source.
- On a new tag (event-driven). A source repo adds the init template
templates/source-repo/on-tag.yml(→ its.github/workflows/on-tag.yml). On every tag push it calls this repo's reusablenotify-nur.yml, which sends apackage-taggedrepository_dispatchto nur-packages. That triggersupdate.ymlhere, which regenerates the package, verifies it builds, and commits to the default branch. - On a schedule (reconcile).
sync.ymlrunssync-alldaily (and on demand) to catch anything a dispatch missed.
source repo (tag push)
└─ on-tag.yml ──uses──▶ nur-packages/notify-nur.yml ──dispatch──▶ nur-packages/update.yml
└─ auto-packager set → build → commit
nur-packages/sync.yml (cron) ─────────────────────────────────────▶ auto-packager sync-all → build → commit
- Add
templates/source-repo/on-tag.ymlto the repo as.github/workflows/on-tag.yml. - Ensure the org
AUTO_PATCHER_APP_IDvariable andAUTO_PATCHER_APP_KEYsecret (the GitHub App credentials) are available to it, and that nur-packages allows its reusable workflows to be called by org repos. The workflow mints a short-lived App token at runtime — no long-lived secret in the repo. - Tag a release — or run the
sync all/update packageworkflow here manually with the repo + tag. The first run createspkgs/<name>/build.nix; edit it to add the real build and license.
- Attribute names are flat:
<pkg>_<major>_<minor>(e.g.foo_1_2). Meta packages keep their plain name (e.g.auto-packager). - A version's derivation lives at
pkgs/<pkg>/<major>_<minor>.nixand is acallPackage-style function. The generator writes it from a template as a thin wrapper that callspkgs/<pkg>/build.nixwithversion/rev/hash. default.nixis generated, not hand-written: it is the sorted union of the static meta packages and every<major>_<minor>.nixdiscovered underpkgs/, each emitted asattr = pkgs.callPackage <path> { };. Add/remove a version file (or runset/sync-all) and re-runregento update it.- Always set
meta.descriptionandmeta.license. Mark unbuildable packagesmeta.broken = trueinstead of removing them.
Until source repos are onboarded, the only entry is the auto-packager meta
package; the auto-patched packages appear here as repos get tagged.