`update.nix` extracts `passthru.updateScript` attributes in the main repo
and when they are relative paths (e.g. `./update.sh`), Nix will resolve them
to absolute paths in the main repo.
Update scripts can use $(dirname $0) to get the location of files they
should update but that would point to the main repo.
We want them to modify the appropriate git worktree instead
so we replace the prefix accordingly.
`git rev-parse --show-toplevel` will resolve symlinks but, fortunately,
Nix will do that as well, so the path will match:
https://github.com/NixOS/nixpkgs/pull/98304#issuecomment-695761754
Instead of having the updateScript support returning JSON object,
it should be sufficient to specify attrPath in passthru.updateScript.
It is much easier to use.
The former is now considered experimental.
Update scripts can now declare features using
passthru.updateScript = {
command = [ ../../update.sh pname ];
supportedFeatures = [ "commit" ];
};
A `commit` feature means that when the update script finishes successfully,
it will print a JSON list like the following:
[
{
"attrPath": "volume_key",
"oldVersion": "0.3.11",
"newVersion": "0.3.12",
"files": [
"/path/to/nixpkgs/pkgs/development/libraries/volume-key/default.nix"
]
}
]
and data from that will be used when update.nix is run with --argstr commit true
to create commits.
We will create a new git worktree for each thread in the pool and run the update
script there. Then we will commit the change and cherry pick it in the main repo,
releasing the worktree for a next change.
It will really happen after regeneration (no need to hurry, I guess).
Commit b7e6161b4 added me to cyrussasl by a mistake apparently.
In knot-resolver upstream we dropped luaossl and luafilesystem from
closure to ease up maintenance, so I no longer have motivation for them.
The `packagesWith` function expected an attrSet but `packagesWithUpdateScript`
could be passing it a derivation or a list when the attribute path
supplied by user through the `--argstr path` argument pointed to one.
It only worked because derivations are also attrSets and contain their
outputs as attributes, and did not work for lists at all.
Additionally, the improper handling would cause the `src` attribute
to be built in some rare cases (`mkYarnPackage` seems to trigger this).
Rewriting the `packagesWith` function to be inductive with a derivation
as a base case and attrSets and lists as inductive steps is much cleaner
and also fixes the unnecessary build.
It does not make sense to look for derivations within derivations,
not even when `recurseForDerivations` is true. Nix does not do that either:
ebc024df22/src/libexpr/get-drvs.cc (L346-L355)
This commit:
- Moves the update script into the dir, out of the maintainers dir. This makes
it more discoverable in general. It can also be invoked from anywhere to write
to default.nix
- Swaps it to use the standardized `passthru.updateScript`. This means that
eventually bots like `nixpkgs-update` will be able to handle it.
- Runs the script to upgrade to the latest versions
See https://nixos.org/nixpkgs/manual/#ssec-stdenv-attributes
Leave license empty when it is not provided. This prevents packages from
failing to build because the license is set to
`stdenv.lib.licenses.unkown`.
There will still be a warning about the unkown license.
Not only the binary `parallel` displays a re,inder to quote their
software but it systematically breaks update here regardless of my
network quality.
Better be slow than fail. If anyone can fix it, we may rollback this.