Skip to content
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

Add support for nix flakes #1300

Open
jezcope opened this issue Jul 17, 2023 · 1 comment
Open

Add support for nix flakes #1300

jezcope opened this issue Jul 17, 2023 · 1 comment

Comments

@jezcope
Copy link

jezcope commented Jul 17, 2023

Proposed change

"Flakes" is an upcoming feature of the nix package manager that allows you to declaratively specify the dependencies for a nix environment as "inputs" and automatically handle pinning inputs with a flake.lock file in the repository, as well as declaratively specifying the configuration of packages as in traditional nix. The environment and its dependencies are defined in flake.nix using a documented schema. Flake inputs can be updated all at once using nix flake update or individually using nix flake lock --update-input <input-name>.

I would like repo2docker to detect the presence of a flake.nix and flake.lock, and automatically build a container using the locked dependencies specified. This will make it easier to manage dependencies in a nix-based binder (currently it's necessary to manually pin dependencies to a specific git commit hash per this example).

Alternative options

It's already possible to use a flake.nix with repo2docker by using the flake-compat library in your default.nix: see https://codeberg.org/jezcope/binder-nix-flakes. However, this:

  1. Requires adding boilerplate to both default.nix and flake.nix for full reproducibility; and
  2. Adds a dependency on flake-compat

A dedicated buildpack would allow any nix flake with a devShell output to be immediately used as a binder.

Who would use this feature?

MyBinder/JupyterHub users who also use nix for reproducibility (there was interest on the Nix Data Science matrix room when I mentioned it). Flakes is described as "experimental" but has been in that state for several years in a stable condition and is increasingly used in production.

How much effort will adding it take?

Not sure about this part! Should be a case of adapting the existing NixBuildPack to install a flakes-compatible version of nix and enable the flakes feature.

Who can do this work?

Python developer familiar with repo2docker internals and nix flakes. I am currently working on adding this feature, to gain a bit more familiarity with the codebase (and because I want it!).

@welcome
Copy link

welcome bot commented Jul 17, 2023

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively.
welcome
You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! 👋

Welcome to the Jupyter community! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant