This Nix plugin adds Pijul support to Nix
in the form of a fetcher. This means that builtins.fetchTree
,
builtins.getFlake
and the nix3 CLI tools now support Pijul
repositories.
The following new URL schemes are supported:
Right now, the first three support specifying channel and state for pure fetching, pijul+file right now only fetches from the worktree and doesn't support these yet.
NB: The fetcher from this plugin does not automatically get used when running
nix commands (e.g. nix build
) in a Pijul repository, since this is hardcoded
for Git and Mercurial in Nix. For this, I have a patch that adds the relevant
code for Pijul, it's available as
nix-pijul
in my nix-extras flake. It replaces the normal Nix installation and can be
used in addition to this plugin.
The package is available as part of my nix-extras flake:
% nix build sourcehut:~dblsaiko/nix-extras#nix-plugin-pijul
Add the built pijul.so module to plugin-files in nix.conf. Make sure it is built for the Nix version you are using it with.
NixOS (with the nix-extras overlay):
{pkgs, config, ...}: {
nix.settings.plugin-files = "${pkgs.nix-plugin-pijul.override { nix = config.nix.package; }}/lib/nix/plugins/pijul.so";
# Optional: Use the patched Nix to automatically use Pijul fetcher in local
# repositories
nix.package = pkgs.nix-pijul;
}
nix build pijul+https://nest.pijul.com/pijul/pijul
nix build pijul+https://nest.pijul.com/pijul/pijul?channel=main&state=PNJL5TPZLQ3VXAASTLUX7462RCRPO7TV3GKOTTHDZABDQCBMXPRQC
{
inputs = {
nix-plugin-pijul.url = "pijul+https://nest.pijul.com/dblsaiko/nix-plugin-pijul";
};
outputs = { self, nix-plugin-pijul }: {
# ...
};
}
Code based on the pijul fetcher PR by Nikodem Rabuliński.