Tcl packaging support


I am a software engineer at FlightAware, and recently received approval to release some of the tooling that our internal overlay adds for packaging Tcl projects. I think this PR has the potential to make Nix a very compelling tool for working with Tcl (particularly because Tcl does not currently have any actively-maintained package manager).

I’d love to get some feedback on it if any of you kind folks can spare the time. A summary of the motivation behind this PR, and how exactly it’s implemented, is available in the PR description: tcl: add Tcl packaging support by agbrooks · Pull Request #122472 · NixOS/nixpkgs · GitHub

This is my first PR to nixpkgs, and I have a few stupid questions:

  • Because this adds a nontrivial amount of code to the tcl package, should I add myself as a maintainer?
  • Would it be more appropriate / practical to separately PR the packaging mechanism and the changes to any existing Tcl packages?

Not that long ago I speculated that a tcl.withPackages function might provide some value. I’m not sure if you or your team does any development with tcl though, so that might not be of any value to you.

I’ll mention that it’s been way too long since I’ve touched tcl for me to even remember if a withPackages function would even be a good idea or not…

just when i thought tcl was a bit dead, it’s alive and well and living at FlightAware… :slight_smile:

Again, i’m not sure either what the best approach to add tcl packages to nixos. It maybe be worth looking at how python does in in nix ( there a few ways to do it), mach-nix seems to be flavour of the month.

Maybe your work will cause a resurgence in tcl , you never know :slight_smile:

Actually, that’s exactly how one of the early versions of our internal overlay worked! However, we found we didn’t have much use for it after this work made it possible to “just” package require Tclx inside a shell created by nix-shell -p tcl tclx :wink:

From what I understand, in the Python+Nix world, tools like pip2nix or mach-nix generally take advantage of Python packaging tooling/standards (particularly requirements.txt) to give you a decent first draft of a Nix package. Unfortunately, because Tcl has no package manager, there’s no package description / requirements.txt / etc. that any tool could take advantage of. For now, I don’t think an equivalent tool can exist for Tcl projects.

Nonetheless, there’s still some very good news: the Tcl Extension Architecture seems to be widely-used in the Tcl community, and makes the build process very predictable for most Tcl projects. The tcl.mkTclDerivation function I’ve PR’d is designed with TEA-compliant packages in mind, and can eliminate a lot of tedium. This means that adding new Tcl packages to nixpkgs can be “as easy as it gets” (for example, the tcltls package becomes absolutely trivial with this new function).

1 Like

sounds great… i hope you can get it merged…

1 Like