1 # Tcl {#sec-language-tcl}
3 ## User guide {#sec-language-tcl-user-guide}
5 Tcl interpreters are available under the `tcl` and `tcl-X_Y` attributes, where `X_Y` is the Tcl version.
7 Tcl libraries are available in the `tclPackages` attribute set.
8 They are only guaranteed to work with the default Tcl version, but will probably also work with others thanks to the [stubs mechanism](https://wiki.tcl-lang.org/page/Stubs).
10 ## Packaging guide {#sec-language-tcl-packaging}
12 Tcl packages are typically built with `tclPackages.mkTclDerivation`.
13 Tcl dependencies go in `buildInputs`/`nativeBuildInputs`/... like other packages.
14 For more complex package definitions, such as packages with mixed languages, use `tcl.tclPackageHook`.
16 Where possible, make sure to enable stubs for maximum compatibility, usually with the `--enable-stubs` configure flag.
18 Here is a simple package example to be called with `tclPackages.callPackage`.
21 { lib, fetchzip, mkTclDerivation, openssl }:
28 url = "https://core.tcl-lang.org/tcltls/uv/tcltls-${version}.tar.gz";
29 hash = "sha256-TOouWcQc3MNyJtaAGUGbaQoaCWVe6g3BPERct/V65vk=";
32 buildInputs = [ openssl ];
35 "--with-ssl-dir=${openssl.dev}"
40 homepage = "https://core.tcl-lang.org/tcltls/index";
41 description = "OpenSSL / RSA-bsafe Tcl extension";
42 maintainers = [ lib.maintainers.agbrooks ];
43 license = lib.licenses.tcltk;
44 platforms = lib.platforms.unix;
49 All Tcl libraries are declared in `pkgs/top-level/tcl-packages.nix` and are defined in `pkgs/development/tcl-modules/`.
50 If possible, prefer the by-name hierarchy in `pkgs/development/tcl-modules/by-name/`.
51 Its use is documented in `pkgs/development/tcl-modules/by-name/README.md`.
53 All Tcl applications reside elsewhere.
54 In case a package is used as both a library and an application (for example `expect`), it should be defined in `tcl-packages.nix`, with an alias elsewhere.