From dc7d4dece5b16e2ea9f2524dd2a14eb88d17a88d Mon Sep 17 00:00:00 2001 From: x10an14 Date: Tue, 6 Jun 2023 22:37:42 +0200 Subject: [PATCH] Document how to use packages with extensions. (#145011) Co-authored-by: Artturi Co-authored-by: Sandro Co-authored-by: Valentin Gagarin --- .../customizing-packages.section.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/nixos/doc/manual/configuration/customizing-packages.section.md b/nixos/doc/manual/configuration/customizing-packages.section.md index bceeeb2d7a16..709a07b09cea 100644 --- a/nixos/doc/manual/configuration/customizing-packages.section.md +++ b/nixos/doc/manual/configuration/customizing-packages.section.md @@ -12,6 +12,29 @@ Unfortunately, Nixpkgs currently lacks a way to query available configuration options. ::: +::: {.note} +Alternatively, many packages come with extensions one might add. +Examples include: +- [`passExtensions.pass-otp`](https://search.nixos.org/packages/query=passExtensions.pass-otp) +- [`python310Packages.requests`](https://search.nixos.org/packages/query=python310Packages.requests) + +You can use them like this: +```nix +environment.systemPackages = with pkgs; [ + sl + (pass.withExtensions (subpkgs: with subpkgs; [ + pass-audit + pass-otp + pass-genphrase + ])) + (python3.withPackages (subpkgs: with subpkgs; [ + requests + ])) + cowsay +]; +``` +::: + Apart from high-level options, it's possible to tweak a package in almost arbitrary ways, such as changing or disabling dependencies of a package. For instance, the Emacs package in Nixpkgs by default has a