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>.
Where to put what
Section titled “Where to put what”Three locations exist for a package that is out of the ordinary, with three different intentions.
| Location | For what | Lifespan |
|---|---|---|
dnf/pkgs/ | Absent from nixpkgs, installed by hosts or users. | Until published in nixpkgs. |
dnf/lib/overlays/ | Fix for an existing nixpkgs package (broken build, pending PR). | Temporary, listed in the registry. |
inputs of dnf/flake.nix | What the framework machinery needs (dnf-generator, colmena). | Permanent. |
Layout
Section titled “Layout”dnf/pkgs/├── default.nix <-- jeu de paquets, découvert depuis les dossiers├── overlay.nix <-- le même jeu en overlay -> pkgs.<nom>└── <nom>/package.nix <-- la dérivationUn dossier = un paquet. default.nix scanne les dossiers, il n’y a donc aucun
registre à tenir à jour. L’overlay, lui, est appliqué une fois pour toutes par
dnf/lib/flake/mk-configuration.nix, sur tous les hôtes.
Adding a package
Section titled “Adding a package”-
Create
dnf/pkgs/<nom>/package.nix, as a classiccallPackageexpression, with a completemeta(description,homepage,license,mainProgram,platforms). Pin the stable version, not a branch. -
git addthe folder: flakes ignore untracked files. -
Build once to fix the hashes, which Nix displays in its error message :
Fenêtre de terminal nix build .#<nom> -
just cleanthen commit.
Nothing else to wire up. The package can then be used in any NixOS module or Home Manager, like a nixpkgs package :
(lib.mkIf cfg.enableEssentials rename-simple)Updating a package
Section titled “Updating a package”Run it in dnf/ or at the root of a co-development project : a dnf/
linked to the Nix store is read-only.
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.
Publishing to nixpkgs
Section titled “Publishing to nixpkgs”The end goal, for every package of general interest :
- Move the folder into a nixpkgs clone, under the two-letter shard of the
name (
pkgs/by-name/re/rename-simple/). - Add the
maintainersentry, open the pull request. - Once the PR is merged and made it into
nixos-unstable, remove the folder fromdnf/pkgs/.
pkgs.<name> keeps resolving, this time from nixpkgs: no module needs to be
updated.