Automated packaging with dream2nix

Hello, my Name is David, I’m the creator of the dream2nix project and I’m here together with @yusdacra to support you guys in using dream2nix for your packaging problems at the Summer of Nix and to help you contributing to dream2nix itself.

NLNet funding

This project was funded through the NGI Assure Fund, a fund established by NLnet with financial support from the European Commission’s Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 957073. Applications are still open, you can apply today.

History of the project

As a participant of the last Summer of Nix, I started the dream2nix project after a series of unpleasant packaging experiences with nodejs.

There were already more than a handful of nodejs 2nix tools out there, but somehow those often seemed to not fit well for whatever packaging problems I was working on. I felt the need for a new tool.

But how could I prevent myself from inventing yet another tool, with an architecture biased by our current use cases, likely driving others into the same frustration where I have found myself.

The tool had to be flexible, in order to extend support to different lock file formats and ensure the possibility to add features demanded by the community in the future.

I quickly realized, that the only way of creating a tool with that kind of flexibility, was to develop a framework that is completely language and ecosystem agnostic. To support all of nodejs, I had to reject the idea of making a tool for nodejs.

So here we are, nearly one year later supporting automated nix packaging for potentially any language or ecosystem with dream2nix.

The idea of dream2nix is to provide a consitent nix packaging workflow and UI for any kind of software project out there.

Why we are here

We now want to feed our work back into the Summer of Nix, providing you with active support to use dream2nix for your packaging problems. We hope we can improve your overall experience.

At the same time we are interested in improving the framework together with you, by receiving your feedback, learning form your experiences, finding and fixing bugs, and inventing amazing new features together.

The current status

Currently, dream2nix suports automated packaging for:

  • nodejs

  • rust

  • python

  • (unfinished) haskell

  • (unfinished) go

How you can get involved

Get a taste of dream2nix

The best way to start getting involved, is to experience dream2nix as a user. You can use dream2nix for some packaging problem at the Summer of Nix for example. Just pick a package of one of the supported languages above and follow the examples in on the github readme or any of the guides from our docs.

After this, you should have a rough idea of how dream2nix works and what it is about.

Share your experience

We would be very happy to learn about your dream2nix packaging experience. You could do this, for example, via a blog post or by adding your packaging story to our own ./docs. If you ran into any issues, big or small while packaging, please open an issue on github. That will be our first source of tasks we can work on.

If you tried any other package automation tool for nix, let us know how they compare to dream2nix. Are there any things which are missing from dream2nix? Are there any features that we should add? We want to incorporate the best of all worlds and therefore are looking forward to your input either here in this thread or on github.

Add support for more ecosystems

It would be great to extend to the list of supported ecosystems.

dream2nix is a modular framework, and support for more ecosystems can be added by extending dream2nix with a so called translator and a builder for the specific ecosystem.

Read more about the architecture in our docs.

If you intend to do so, it would probably be good to have a little discussion upfront in one the channels about the approach taken, as there are often different strategies of how things can be translated to nix.

If you just want to add support for a new lock file format of an ecosystem that dream2nix already supports, you’ll have an easier job. Only a translator for that new format has to be implemented. The existing builder can be re-used.

Write guides on how to hack on dream2nix

Helping other contributors is also very important. If you find yourself extending dream2nix or hacking on it in any other way, it would be great if you could write down a little guide to help others to do the same.

Check out the issues on github

People might have shared their problems or ideas on github. You can take a look there and see if you find something which you are interested in working on.

Communication

20 Likes

If you don’t mind, I’ll leave a recent (2022-09-07) tutorial link here: Building Typescript Node Apps With Nix.

5 Likes

Also, notice these lines in package.json from the blog’s repo. I needed them for a CLI version of json2md

2 Likes

I wanted to shout out a big Thank You to all participants from the summer of nix.
I’m still astonished by the number of high quality contributions dream2nix got during this time.
If I counted correctly, participants contributed:

The changes done by you, included:

  • additions and improvements on the docs
  • added support for PHP
  • added support for Racket
  • added support for debian packages (apt-get)
  • added support for more metadata formats:
    • cabal.project.freeze for haskell
    • comoser.json for php
    • composer.lock for php
    • info.rkt for racket
  • better jsonschema validation of dream2nix lock files
  • improvements on existing subsystems, like haskell and nodejs
  • integration tests
  • other important improvements

Thanks again to all of you helping to get this project moving forward.
I hope you enjoyed the Summer of Nix as much as we did and got some valuable experiences out of it.

11 Likes