nixpkgs/pkgs/by-name
2023-09-20 00:09:45 -03:00
..
_4/_4th _4th: refactor 2023-09-14 10:00:10 +00:00
ai/airscan
al/algol68g algol68g: 2.8.4 -> 3.3.22 2023-09-16 13:22:03 +00:00
ar/arrpc arrpc: init at 3.2.0 2023-09-17 18:28:16 -04:00
as/asciiquarium-transparent
bo boogie: 2.15.7 -> 3.0.4 2023-09-16 16:00:34 +02:00
ca/cargo-rdme cargo-rdme: init at 1.4.2 2023-09-12 12:47:05 +03:00
cd/cdwe
ce/celluloid celluloid: refactor 2023-09-17 15:47:03 -03:00
de/debianutils debianutils: 5.8 -> 5.13 2023-09-15 23:52:13 -03:00
dj/djent djent: init at 1.0 2023-09-14 13:05:29 +02:00
ec/ecmtools ecmtools: refactor 2023-09-15 14:12:15 +00:00
el/elvish elvish: refactor 2023-09-19 00:02:22 -03:00
en/engage engage: 0.1.2 -> 0.1.3 2023-09-10 15:37:05 -07:00
es/esbuild-config esbuild-config: init at 1.0.1 2023-09-10 20:12:51 -04:00
fl/fleng fleng: 16 -> 17 2023-09-16 21:15:31 +00:00
ga
gh/ghunt ghunt: init at 2.0.1 2023-09-10 17:56:56 +02:00
he Merge pull request from bobvanderlinden/pr-hello-mainprogram 2023-09-16 14:12:22 +02:00
hy hyperlink: init at 0.1.31 2023-09-16 15:21:08 -04:00
if/ifrextractor-rs
ir/ironbar
ji/jinja2-cli
ka/katriawm katriawm: 23.06 -> 23.08 2023-09-17 18:47:10 -03:00
le/less less: 633 -> 643 2023-09-18 23:56:22 -03:00
li/liana
ma/matrix-hook matrix-hook: init at 1.0.0 2023-09-12 07:04:22 +02:00
mf/mfoc-hardnested mfoc-hardnested: unstable-2021-08-14 -> unstable-2023-03-27 2023-09-13 23:24:14 +08:00
mk/mksh mksh: migrate to by-name 2023-09-19 00:02:22 -03:00
na/nawk nawk: 20230909 -> 20230911 2023-09-20 00:09:45 -03:00
ni/nixos-anywhere nixos-anywhere: init at 1.0.0 2023-09-17 09:53:17 +02:00
ou/outputcheck outputcheck: init at 0.4.2 2023-09-19 22:23:55 +08:00
pa/passes
pd/pdepend pdepend: Build from source 2023-09-17 18:09:25 +02:00
ph/phpdocumentor phpdocumentor: init at 3.4.1 2023-09-16 17:23:32 +02:00
pl/platformsh platformsh: 3.79.2 -> 4.10.0 2023-09-17 15:07:02 +02:00
pr/prettier-d-slim prettier-d-slim: use buildNpmPackage 2023-09-14 08:16:43 -07:00
qu/quicktype
rc/rc rc: migrate to by-name 2023-09-19 00:02:22 -03:00
re/replxx replxx: init at 0.0.4 2023-09-17 10:59:07 -03:00
ri/ripsecrets ripsecrets: 0.1.6 -> 0.1.7 2023-09-11 16:16:33 -04:00
ro robo: init at 4.0.4 2023-09-16 17:24:30 +02:00
ru/rusti-cal
sc/screentest
sl/sleek-grub-theme sleek-grub-theme: init at unstable-2022-06-04 2023-09-12 16:28:44 +08:00
ss/sssnake
sy/symbolicator symbolicator: init at 23.8.0 2023-09-10 19:47:31 -04:00
tc/tcsh
th/the-legend-of-edgar the-legend-of-edgar: migrate to by-name 2023-09-11 18:40:42 +00:00
tr/trealla trealla: 2.26.9 -> 2.27.15 2023-09-13 10:43:38 +00:00
uc/ucg ucg: cleanup 2023-09-13 15:31:38 +00:00
un/unimap unimap: init at 0.6.0 2023-09-11 11:10:46 -04:00
up/upiano
ux/uxn uxn: unstable-2023-08-30 -> unstable-2023-09-06 2023-09-17 18:58:49 -03:00
wa/wayland-logout
wi/windowmaker
wo/wonderdraft
zc/zcfan
zp/zpaqfranz zpaqfranz: init at 58.9 2023-09-18 21:25:32 -03:00
zx/zxpy
README.md pkgs/by-name: Add manual migration guidelines 2023-09-12 00:18:24 +02:00

Name-based package directories

The structure of this directory maps almost directly to top-level package attributes. This is the recommended way to add new top-level packages to Nixpkgs when possible.

Example

The top-level package pkgs.some-package may be declared by setting up this file structure:

pkgs
└── by-name
   ├── so
   ┊  ├── some-package
      ┊  └── package.nix

Where some-package is the package name and so is the lowercased 2-letter prefix of the package name.

The package.nix may look like this:

# A function taking an attribute set as an argument
{
  # Get access to top-level attributes for use as dependencies
  lib,
  stdenv,
  libbar,

  # Make this derivation configurable using `.override { enableBar = true }`
  enableBar ? false,
}:

# The return value must be a derivation
stdenv.mkDerivation {
  # ...
  buildInputs =
    lib.optional enableBar libbar;
}

You can also split up the package definition into more files in the same directory if necessary.

Once defined, the package can be built from the Nixpkgs root directory using:

nix-build -A some-package

See the general package conventions for more information on package definitions.

Changing implicit attribute defaults

The above expression is called using these arguments by default:

{
  lib = pkgs.lib;
  stdenv = pkgs.stdenv;
  libbar = pkgs.libbar;
}

But the package might need pkgs.libbar_2 instead. While the function could be changed to take libbar_2 directly as an argument, this would change the .override interface, breaking code like .override { libbar = ...; }. So instead it is preferable to use the same generic parameter name libbar and override its value in pkgs/top-level/all-packages.nix:

libfoo = callPackage ../by-name/so/some-package/package.nix {
  libbar = libbar_2;
};

Manual migration guidelines

Most packages are still defined in all-packages.nix and the category hierarchy. Please hold off migrating your maintained packages to this directory.

  1. An automated migration for the majority of packages is being worked on. In order to save on contributor and reviewer time, packages should only be migrated manually afterwards if they couldn't be migrated automatically.

  2. Manual migrations should only be lightly encouraged if the relevant code is being worked on anyways. For example with a package update or refactoring.

  3. Manual migrations should not remove definitions from all-packages.nix with custom arguments. That is a backwards-incompatible change because it changes the .override interface. Such packages may still be moved to pkgs/by-name however, while keeping the definition in all-packages.nix. See also changing implicit attribute defaults.

Limitations

There's some limitations as to which packages can be defined using this structure:

  • Only packages defined using pkgs.callPackage. This excludes packages defined using pkgs.python3Packages.callPackage ....

    Instead use the category hierarchy for such attributes.

  • Only top-level packages. This excludes packages for other package sets like pkgs.pythonPackages.*.

    Refer to the definition and documentation of the respective package set to figure out how such packages can be declared.

Validation

CI performs certain checks on the pkgs/by-name structure. This is done using the nixpkgs-check-by-name tool. The version of this tool used is the one that corresponds to the NixOS channel of the PR base branch. See here for details.

The tool can be run locally using

nix-build -A tests.nixpkgs-check-by-name
result/bin/nixpkgs-check-by-name .