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

WIP: Add nix backend #20873

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

WIP: Add nix backend #20873

wants to merge 1 commit into from

Conversation

grihabor
Copy link
Contributor

@grihabor grihabor commented May 5, 2024

Nix takes the reproducible builds to the next level. This pr introduces nix_binary target that allows to install a binary via nix and use it in pants with pants run.

How to use

  1. Install nix
  2. Define a nix_binary, for example, dot binary from graphviz nix package:
nix_binary(
    name="dot",
    expr='(import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/06278c77b5d162e62df170fec307e83f1812d94b.tar.gz") {}).graphviz',
    rel_path="bin/dot",
)
  1. Create a graph.dot: digraph g { a -> b}
  2. Run pants run :dot -- graph.dot

In this example the version of nixpkgs is pinned to a specific commit which guarantees reproducible dot binary.

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

Successfully merging this pull request may close these issues.

None yet

1 participant