dream2nix icon indicating copy to clipboard operation
dream2nix copied to clipboard

integrate dream2nix with pyproject.toml

Open DavHau opened this issue 1 year ago • 2 comments

For single language use-cases it could be interesting to integrate dream2nix with pyproject.toml, so that the following workflow becomes possible:

Workflow

$ pip install dream2nix
$ dream2nix init

which will ensure nix is installed and modify the pyproject.toml to include the following

[build-system]
requires = ["dream2nix"]

Then enter the dev shell via:

dream2nix develop

Or build the project via

dream2nix build

... where the dream2nix executable is a simple wrapper around nix which imagines a flake.nix into existence before executing nix with the given "$@" args.

Customization

Instead of modifying a default.nix template, the nix build can be customized via the pyproject.toml

[tool.dream2nix]
mkDerivation.preBuild = ""
buildPythonPackage.pythonImportsCheck = ["my_tool"]

DavHau avatar Jan 04 '24 04:01 DavHau

Could I propose dream instead of dream2nix as a cli? Having a number in the command name is very un-ergonomic

purepani avatar Jun 09 '24 20:06 purepani

This would be amazing @DavHau

rupurt avatar Jun 12 '24 17:06 rupurt