[Nix-dev] monitor.nixos.org

Rok Garbas rok at garbas.si
Mon Nov 28 23:05:55 CET 2016


On Mon, Nov 28, 2016 at 9:42 PM, Profpatsch <mail at profpatsch.de> wrote:
> On 16-11-28 03:11pm, Rok Garbas wrote:
>> On Mon, Nov 28, 2016 at 2:37 PM, Bjørn Forsman <bjorn.forsman at gmail.com> wrote:
>> To start this we _only_ need to agree how we call this passthru
>> attribute :) ... update, updateSrc, refresh, refreshSrc, nextVersion,
>> ...
>
> Exactly.
> And of course the interface of what the script at this point should do.
>
> I’m not sure how to apply the changes to the source files in a sane way.
> No, regex replacement is definitely *not* a sane way.
> To be fair, the lisp guys have an advantage of about half a century
> with source code modification.
>

We don't need to define what that update script should do, since a
maintainer of that package also makes sure that generated files
(json/nix/...) that this update script provides will be read by the
package expression.

Now even if update script does some weird regex etc... and fails also
the build afterwards will fail and we don't merge the updated files.

I think Nix has the advantage here actually. A maintainer can write an
update script in any language that he is most comfortable with. On the
end they have to support it etc... BUT everybody can run the update
without knowing that this is a ruby script since ``nix-shell``
provides all the needed dependencies for us.

here are two examples:
 - update script stores a json and that json is passed to fetchFromGitHub
   https://github.com/mozilla-releng/services/blob/master/nix/tools/default.nix#L66
 - update script generated nix files (pypi2nix, go2nix, cabal2nix, ...)
   https://github.com/mozilla-releng/services/blob/master/nix/tools/default.nix#L18

and this is the main entry script which i use to run multiple update commands
https://github.com/mozilla-releng/services/blob/master/nix/update.nix
 - to run update on one package ->nix-shell nix/update.nix --argstr
pkg releng_docs
 - to run updates on all packages -> nix-shell nix/update.nix

So on the end we really need to just figure out the name ;) and start
writing update scripts. Even if they are full of regex :P


-- 
Rok Garbas


More information about the nix-dev mailing list