ngi-nix / ngipkgs

Nix packages and services for projects supported through the NGI program
https://ngi-nix.github.io/ngipkgs
MIT License
34 stars 18 forks source link

Derivation of `.#overview` depends on `.#pretalxFull` for no good reason #259

Closed A-jay98 closed 3 months ago

A-jay98 commented 3 months ago

We're not sure what the dependencies are, but they seem to be very big projects, which doesn't seem correct.

wegank commented 3 months ago

Is building .#overview blocked on validator-nu (on a non x86_64-linux machine) or on pretalx? For the latter, you can drop these lines:

https://github.com/ngi-nix/ngipkgs/blob/84f90068258507753acc67449f211d807c0a62d9/projects/Pretalx/service.nix#L134-L140

fricklerhandwerk commented 3 months ago

Can we factor out the static files attribute into a passthru? Something that doesn't require changing the interface but avoids the expensive build...

lorenzleutgeb commented 3 months ago

It's not clear to me which dependencies this is about. I added validator-nu with the intention of making sure that we do not produce bad HTML.

wegank commented 3 months ago

validator-nu was only cached for x86_64-linux on Hydra (https://hydra.nixos.org/eval/1806741?filter=validator-nu&compare=1806726&full=), so if anyone is on aarch64-linux or darwin, they'll have to build it themselves. I opened https://github.com/NixOS/nixpkgs/pull/317390 for that.

lorenzleutgeb commented 3 months ago

Okay, so it's a derivation dependency on .#pretalxFull that we are talking about here.

$ nix why-depends .#overview .#pretalxFull
'git+file:///home/lorenz/src/github.com/ngi-nix/ngipkgs#overview' does not depend on 'git+file:///home/lorenz/src/github.com/ngi-nix/ngipkgs#pretalxFull'
$ nix why-depends --derivation .#overview .#pretalxFull
/nix/store/is8a59fb78wcfq3pr1kmjb08zz2jw8hk-overview.drv
└───/nix/store/bdyf0ziwmbyps7w3fng84ap3kap1rlsw-overview.html.drv
    └───/nix/store/63vgrk61sq14i0dsvsgw7kvwzm2njn3f-pretalx-2024.1.0.drv
$ nix run nixpkgs#nix-tree -- --derivation .#overview
[browse dependency tree]

TBH I do not understand why the derivation of .#overview depends on .#pretalxFull, and not on other packages in this repo. I have a suspicion that it is this wrapper:

https://github.com/ngi-nix/ngipkgs/blob/84f90068258507753acc67449f211d807c0a62d9/projects/Pretalx/service.nix#L51-L60

which might might get pulled in as we are collecting options.

fricklerhandwerk commented 3 months ago

More likely it's indeed the cfg.package in the example, since that's rendered.

wegank commented 3 months ago

I only discovered the workaround in my first comment after noticing that services.ngi-pretalx.filesystem.static is the only option on https://ngi-nix.github.io/ngipkgs/ that defaults to a store path. But since overview only needs .default.text, we can simply pass a defaultText to get around that. So #260 should fix the issue.

fricklerhandwerk commented 3 months ago

Oh wow, that's a hack. Can't we just rework the option?

lorenzleutgeb commented 3 months ago

I'd say that this can be closed as fixed by #260.

$ git rev-parse HEAD
5cf02536124e27db576d6fec05333b0e015c33ce
$ nix why-depends --derivation .#overview .#pretalxFull
'git+file:///home/lorenz/src/github.com/ngi-nix/ngipkgs#overview' does not depend on 'git+file:///home/lorenz/src/github.com/ngi-nix/ngipkgs#pretalxFull'