Files
nixpkgs/doc/languages-frameworks/hy.section.md
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

1.2 KiB

Hy

Installation

Installation without packages

You can install hy via nix-env or by adding it to configuration.nix by referring to it as a hy attribute. This kind of installation adds hy to your environment and it successfully works with python3.

::: {.caution} Packages that are installed with your python derivation, are not accessible by hy this way. :::

Installation with packages

Creating a hy derivation with custom python packages is really simple and similar to the way that python does it. The attribute hy provides the function withPackages that creates a custom hy derivation with specified packages.

For example, if you want to create a shell with matplotlib and numpy, you can do it like so:

$ nix-shell -p "hy.withPackages (ps: with ps; [ numpy matplotlib ])"

Or if you want to extend your configuration.nix:

{
  # ...

  environment.systemPackages = with pkgs; [
    (hy.withPackages (
      py-packages: with py-packages; [
        numpy
        matplotlib
      ]
    ))
  ];
}