1# Maintainer scripts 2 3This folder contains various executable scripts for nixpkgs maintainers, and supporting data or nixlang files as needed. 4These scripts generally aren't a stable interface and may changed or be removed. 5 6What follows is a (very incomplete) overview of available scripts. 7 8## Metadata 9 10### `get-maintainer.sh` 11 12`get-maintainer.sh [selector] value` returns a JSON object describing a given nixpkgs maintainer, equivalent to `lib.maintainers.${x} // { handle = x; }`. 13 14This allows looking up a maintainer's attrset (including GitHub and Matrix handles, email address etc.) based on any of their handles, more correctly and 15robustly than text search through `maintainer-list.nix`. 16 17``` 18❯ ./get-maintainer.sh nicoo 19{ 20 "email": "nicoo@debian.org", 21 "github": "nicoonoclaste", 22 "githubId": 1155801, 23 "keys": [ 24 { 25 "fingerprint": "E44E 9EA5 4B8E 256A FB73 49D3 EC9D 3708 72BC 7A8C" 26 } 27 ], 28 "name": "nicoo", 29 "handle": "nicoo" 30} 31 32❯ ./get-maintainer.sh name 'Silvan Mosberger' 33{ 34 "email": "contact@infinisil.com", 35 "github": "infinisil", 36 "githubId": 20525370, 37 "keys": [ 38 { 39 "fingerprint": "6C2B 55D4 4E04 8266 6B7D DA1A 422E 9EDA E015 7170" 40 } 41 ], 42 "matrix": "@infinisil:matrix.org", 43 "name": "Silvan Mosberger", 44 "handle": "infinisil" 45} 46``` 47 48The maintainer is designated by a `selector` which must be one of: 49- `handle` (default): the maintainer's attribute name in `lib.maintainers`; 50- `email`, `name`, `github`, `githubId`, `matrix`, `name`: 51 attributes of the maintainer's object, matched exactly; see [`maintainer-list.nix`] for the fields' definition. 52 53[`maintainer-list.nix`]: ../maintainer-list.nix 54 55### `get-maintainer-pings-between.sh` 56 57Gets which maintainers would be pinged between two Nixpkgs revisions. 58Outputs a JSON object on stdout mapping GitHub usernames to the attributes that they would be getting pinged for. 59 60Example: 61 62```sh 63maintainers/scripts/get-maintainer-pings-between.sh HEAD^ HEAD 64``` 65 66## Conventions 67 68### `sha-to-sri.py` 69 70`sha-to-sri.py path ...` (atomically) rewrites hash attributes (named `hash` or `sha(1|256|512)`) into the SRI format: `hash = "{hash name}-{base64 encoded value}"`. 71 72`path` must point to either a nix file, or a directory which will be automatically traversed. 73 74`sha-to-sri.py` automatically skips files whose first non-empty line contains `generated by` or `do not edit`. 75Moreover, when walking a directory tree, the script will skip files whose name is `yarn.nix` or contains `generated`.