Skip to content

Packages outside nixpkgs

Some programs installed by the framework do not exist in nixpkgs 🡕. Their build recipes live in dnf/pkgs/, and are exposed to all hosts like any other package, under pkgs.<name>.

Three locations exist for a package that is out of the ordinary, with three different intents.

LocationPurposeLifetime
dnf/pkgs/Not in nixpkgs, installed by hosts or users.Until published in nixpkgs.
dnf/lib/overlays/Patch on an existing nixpkgs package (broken build, pending PR).Temporary, removed as soon as the upstream fix lands.
inputs of dnf/flake.nixWhat the framework machinery needs (dnf-generator, colmena).Permanent.
dnf/pkgs/
├── default.nix <-- package set, discovered from subdirectories
├── overlay.nix <-- the same set as an overlay -> pkgs.<name>
└── <name>/package.nix <-- the derivation

One folder = one package. default.nix scans subdirectories, so there is no registry to maintain. The overlay, on the other hand, is applied once and for all by dnf/lib/mk-configuration.nix, on every host.

  1. Create dnf/pkgs/<name>/package.nix using the classic callPackage form, with a complete meta block (description, homepage, license, mainProgram, platforms). Pin the stable version, not a branch.

  2. git add the folder: flakes ignore untracked files.

  3. Build once to freeze the hashes, which Nix displays in its error message :

    Fenêtre de terminal
    nix build .#<name>
  4. just clean then commit.

Nothing else to wire up. The package is now usable in any NixOS module or Home Manager module, just like a nixpkgs package :

dnf/home/modules/advanced.nix
(lib.mkIf cfg.enableEssentials rename-simple)

Run it in dnf/ or at the root of a co-development project : a dnf/ linked to the Nix store is read-only.

Fenêtre de terminal
just pkg-update <nom>

nix-update 🡕 looks up the latest release published upstream, then rewrites the version and the hashes in package.nix. Then check the upstream changelog, rebuild, and commit.

The end goal, for every package of general interest :

  1. Move the folder into a nixpkgs clone, under the two-letter shard of the name (pkgs/by-name/re/rename-simple/).
  2. Add the maintainers entry, open the pull request.
  3. Once the PR is merged and made it into nixos-unstable, remove the folder from dnf/pkgs/.

pkgs.<name> keeps resolving, this time from nixpkgs: no module needs to be updated.