# nix-plugin-pijul
This [Nix](https://nixos.org/) 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:
- pijul+https
- pijul+http
- pijul+ssh
- pijul+file
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.
**Requires Nix 2.25+.** The plugin executes pijul to actually fetch
repositories, make sure that is available in the PATH.
## Installing
Build from the NUR:
```
nix-build -A nix-plugin-pijul https://github.com/DzmingLi/nur-packages/archive/master.tar.gz
```
Or build from source:
```
pijul clone https://nest.pijul.com/DzmingLi/nix-plugin-pijul
cd nix-plugin-pijul
nix build
```
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
```nix
{pkgs, config, ...}:
let
nur = import (builtins.fetchTarball "https://github.com/DzmingLi/nur-packages/archive/master.tar.gz") { inherit pkgs; };
in {
environment.systemPackages = [pkgs.pijul];
nix.settings.plugin-files = "${nur.nix-plugin-pijul}/lib/nix/plugins/pijul.so";
}
```
## Examples
- `nix build pijul+https://nest.pijul.com/pijul/pijul`
- `nix build pijul+https://nest.pijul.com/pijul/pijul?channel=main&state=PNJL5TPZLQ3VXAASTLUX7462RCRPO7TV3GKOTTHDZABDQCBMXPRQC`
- ```nix
{
inputs = {
nix-plugin-pijul.url = "pijul+https://nest.pijul.com/DzmingLi/nix-plugin-pijul";
};
outputs = { self, nix-plugin-pijul }: {
# ...
};
}
```
## Acknowledgements
- [dblsaiko](https://git.sr.ht/~dblsaiko) — original author
- Code based on the [pijul fetcher
PR](https://github.com/NixOS/nix/pull/8730) by Nikodem Rabuliński.