diff --git a/doc/languages-frameworks/hy.section.md b/doc/languages-frameworks/hy.section.md
new file mode 100644
index 000000000000..a851ff24dfc2
--- /dev/null
+++ b/doc/languages-frameworks/hy.section.md
@@ -0,0 +1,31 @@
+# Hy {#sec-language-hy}
+
+## Installation {#ssec-hy-installation}
+
+### Installation without packages {#installation-without-packages}
+
+You can install `hy` via nix-env or by adding it to `configuration.nix` by reffering to it as a `hy` attribute. This kind of installation adds `hy` to your environment and it succesfully works with `python3`.
+
+::: {.caution}
+Packages that are installed with your python derivation, are not accesible by `hy` this way.
+:::
+
+### Installation with packages {#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:
+
+```ShellSession
+$ nix-shell -p "hy.withPackages (ps: with ps; [ numpy matplotlib ])"
+```
+
+Or if you want to extend your `configuration.nix`:
+```nix
+{ # ...
+
+ environment.systemPackages = with pkgs; [
+ (hy.withPackages (py-packages: with py-packages; [ numpy matplotlib ]))
+ ];
+}
+```
diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml
index 791afce6f5c6..516bddf67fd4 100644
--- a/doc/languages-frameworks/index.xml
+++ b/doc/languages-frameworks/index.xml
@@ -16,6 +16,7 @@
+
diff --git a/pkgs/development/interpreters/hy/builder.nix b/pkgs/development/interpreters/hy/builder.nix
new file mode 100644
index 000000000000..6757f859ac14
--- /dev/null
+++ b/pkgs/development/interpreters/hy/builder.nix
@@ -0,0 +1,40 @@
+{ lib
+, python3Packages
+, hyDefinedPythonPackages /* Packages like with python.withPackages */
+, ...
+}:
+python3Packages.buildPythonApplication rec {
+ pname = "hy";
+ version = "1.0a1";
+
+ src = python3Packages.fetchPypi {
+ inherit pname version;
+ sha256 = "sha256-lCrbvbkeutSNmvvn/eHpTnJwPb5aEH7hWTXYSE+AJmU=";
+ };
+
+ checkInputs = with python3Packages; [ flake8 pytest ];
+
+ propagatedBuildInputs = with python3Packages; [
+ appdirs
+ astor
+ clint
+ colorama
+ fastentrypoints
+ funcparserlib
+ rply
+ pygments
+ ] ++ (hyDefinedPythonPackages python3Packages);
+
+ # Hy does not include tests in the source distribution from PyPI, so only test executable.
+ checkPhase = ''
+ $out/bin/hy --help > /dev/null
+ '';
+
+ meta = with lib; {
+ description = "A LISP dialect embedded in Python";
+ homepage = "https://hylang.org/";
+ license = licenses.mit;
+ maintainers = with maintainers; [ nixy mazurel ];
+ platforms = platforms.all;
+ };
+}
diff --git a/pkgs/development/interpreters/hy/default.nix b/pkgs/development/interpreters/hy/default.nix
index e39bf915cfcf..f5d80c11d711 100644
--- a/pkgs/development/interpreters/hy/default.nix
+++ b/pkgs/development/interpreters/hy/default.nix
@@ -1,37 +1,15 @@
-{ lib, python3Packages }:
-
-python3Packages.buildPythonApplication rec {
- pname = "hy";
- version = "0.19.0";
-
- src = python3Packages.fetchPypi {
- inherit pname version;
- sha256 = "05k05qmiiysiwdc05sxmanwhv1crfwbb3l8swxfisbzbvmv1snis";
- };
-
- checkInputs = with python3Packages; [ flake8 pytest ];
-
- propagatedBuildInputs = with python3Packages; [
- appdirs
- astor
- clint
- colorama
- fastentrypoints
- funcparserlib
- rply
- pygments
- ];
-
- # Hy does not include tests in the source distribution from PyPI, so only test executable.
- checkPhase = ''
- $out/bin/hy --help > /dev/null
- '';
-
- meta = with lib; {
- description = "A LISP dialect embedded in Python";
- homepage = "http://hylang.org/";
- license = licenses.mit;
- maintainers = with maintainers; [ nixy ];
- platforms = platforms.all;
- };
+{ lib
+, callPackage
+, hyDefinedPythonPackages ? python-packages: [] /* Packages like with python.withPackages */
+}:
+let
+ withPackages = (
+ python-packages: callPackage ./builder.nix {
+ hyDefinedPythonPackages = python-packages;
+ }
+ );
+in
+(withPackages hyDefinedPythonPackages) // {
+ # Export withPackages function for hy customization
+ inherit withPackages;
}