-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tclPackages: init #344716
Merged
Merged
tclPackages: init #344716
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Tcl {#sec-language-tcl} | ||
|
||
## User guide {#sec-language-tcl-user-guide} | ||
|
||
Tcl interpreters are available under the `tcl` and `tcl-X_Y` attributes, where `X_Y` is the Tcl version. | ||
|
||
Tcl libraries are available in the `tclPackages` attribute set. | ||
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). | ||
|
||
## Packaging guide {#sec-language-tcl-packaging} | ||
|
||
Tcl packages are typically built with `tclPackages.mkTclDerivation`. | ||
Tcl dependencies go in `buildInputs`/`nativeBuildInputs`/... like other packages. | ||
For more complex package definitions, such as packages with mixed languages, use `tcl.tclPackageHook`. | ||
|
||
Where possible, make sure to enable stubs for maximum compatibility, usually with the `--enable-stubs` configure flag. | ||
|
||
Here is a simple package example to be called with `tclPackages.callPackage`. | ||
|
||
``` | ||
{ lib, fetchzip, mkTclDerivation, openssl }: | ||
|
||
mkTclDerivation rec { | ||
pname = "tcltls"; | ||
version = "1.7.22"; | ||
|
||
src = fetchzip { | ||
url = "https://core.tcl-lang.org/tcltls/uv/tcltls-${version}.tar.gz"; | ||
hash = "sha256-TOouWcQc3MNyJtaAGUGbaQoaCWVe6g3BPERct/V65vk="; | ||
}; | ||
|
||
buildInputs = [ openssl ]; | ||
|
||
configureFlags = [ | ||
"--with-ssl-dir=${openssl.dev}" | ||
"--enable-stubs" | ||
]; | ||
|
||
meta = { | ||
homepage = "https://core.tcl-lang.org/tcltls/index"; | ||
description = "OpenSSL / RSA-bsafe Tcl extension"; | ||
maintainers = [ lib.maintainers.agbrooks ]; | ||
license = lib.licenses.tcltk; | ||
platforms = lib.platforms.unix; | ||
}; | ||
} | ||
``` | ||
|
||
All Tcl libraries are declared in `pkgs/top-level/tcl-packages.nix` and are defined in `pkgs/development/tcl-modules/`. | ||
If possible, prefer the by-name hierarchy in `pkgs/development/tcl-modules/by-name/`. | ||
Its use is documented in `pkgs/development/tcl-modules/by-name/README.md`. | ||
|
||
All Tcl applications reside elsewhere. | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Name-based Tcl package directories | ||
|
||
The structure of this directory is identical to the one described in | ||
[/pkgs/by-name/README.md](../../../by-name/README.md). | ||
The only difference is the scope: | ||
|
||
```nix | ||
{ lib | ||
# You can get tclPackages attributes directly | ||
, mkTclDerivation | ||
, tcllib | ||
}: | ||
|
||
mkTclDerivation { | ||
# ... | ||
} | ||
``` |
4 changes: 2 additions & 2 deletions
4
...development/libraries/bwidget/default.nix → ...cl-modules/by-name/bw/bwidget/package.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...development/libraries/incrtcl/default.nix → ...cl-modules/by-name/in/incrtcl/package.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../development/libraries/itktcl/default.nix → ...tcl-modules/by-name/it/itktcl/package.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not default to this in mkTclDerivation and make an option to disable it for the few things that don't support it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually plan to do this in a later PR so this one stays at 0 actual rebuilds