depot/third_party/nixpkgs/doc/languages-frameworks/hy.section.md
Default email a3d4720129 Project import generated by Copybara.
GitOrigin-RevId: e182da8622a354d44c39b3d7a542dc12cd7baa5f
2022-12-28 22:21:41 +01:00

1.1 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 hy derivation with custom python packages is really simple and similar to the way that python does it. Attribute hy provides function withPackages that creates custom hy derivation with specified packages.

For example if you want to create 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 ]))
  ];
}