Nix on the AT protocol#
This is still very WIP.
The idea for this project originally started with wanting to have nix flakes be entirely inside AT protocol infrastructure.1 Your flake's metadata lives inside your own repo on your PDS as a record of the following lexicon: space.stau.nix.release.
Lexicon#
The most important part here is to have a unified lexicon that most of if not all Nix users can agree with. For this, the initial lexicon implementation at space.stau.nix.release han been purposefully made to be as minimal as possible while still remaining functional. Here are the properties that every record must have:
"properties": {
"rev": {
"description": "A Git or Mercurial commit hash",
"minLength": 40,
"maxLength": 40,
"minGraphemes": 40,
"maxGraphemes": 40,
"type": "string"
},
"narHash": {
"description": "The hash of the Nix Archive (NAR) serialization (in SRI format) of the contents of the flake",
"minLength": 51,
"maxLength": 51,
"minGraphemes": 51,
"maxGraphemes": 51,
"type": "string"
},
"source": {
"description": "The git URL from which the flake's source can be fetched",
"type": "string",
"format": "uri",
"maxLength": 2048,
"maxGraphemes": 2048
},
"publishedAt": {
"format": "datetime",
"type": "string"
}
}
You can optionally add a description to each release:
"description": {
"maxGraphemes": 300,
"maxLength": 3000,
"type": "string"
}
Status#
Currently, Nix infrastructure is missing a fetcher that is able to resolve AT URIs. This is not surprising considering they have not had any use to do this before. A fetcher is needed in order to be able to declare an AT URI as an input for a flake.
For this, the utility nixat resolve was created.
As of now, you can publish flakes to your repo and you can resolve and build flakes directly from an AT URI. The closest you can get to being able to use an AT URI to fetch a git input would be to resolve the AT URI and then use that URL as an input.
Usage#
nixat build at://did:your:didHere/space.stau.nix.release/v1.0.0
nixat resolve at://did:your:didHere/space.stau.nix.release/v1.0.0
nixat publish path/to/flake/ v3.1.4
Building#
As of now, the main deliverable in this project is a Bash script. The build is then done through nix, wrapping the Bash script in a way that lets it access its dependencies:
jqatproto-goatgit
Simply execute the following in your preferred shell:
nix build
-
This is technically, but not feasible long-term. You can upload blobs of source code to your PDS, but these blobs are usually capped by a max size. The closest one can get to emulating this is similar to what Tangled does: knots. This means that the source code for the flake lives inside a knot while the rest of the project lives inside your actual PDS. ↩︎