16 Feb 2025 |
llakala | https://github.com/llakala/llakaLib/blob/main/lib/collectDirectoryPackages.nix | 04:34:06 |
Charles | oh interesting | 04:34:31 |
llakala | the noogle documentation here is also really good | 04:34:48 |
llakala | here's a usage example https://github.com/llakala/llakaLib/blob/2512d32d7812b62d27d9a63017fa1e4c91214d90/flake.nix#L42 | 04:35:42 |
Charles | oh i think i get it, this is very clever | 04:37:03 |
Charles | shouldn't localWrapper // pkgs be the other way aroudn? | 04:37:48 |
Charles | * shouldn't localWrapper // pkgs be the other way around? | 04:37:50 |
llakala | hmm will the order matter? | 04:38:03 |
llakala | I guess maybe it will | 04:38:18 |
llakala | that's smart | 04:38:20 |
Charles | yes, values in the latter attrset with the same name take precedence | 04:38:20 |
llakala | wait yeah that's VERY smart | 04:38:30 |
llakala | I'll make a note to fix that tomorrow, thanks :3 | 04:38:39 |
Charles | { a = "a"; } // { a = "b"; } -> { a = "b"; } for example | 04:38:49 |
Charles | wait no actually i think localWrapper // pkgs is correct | 04:40:45 |
Charles | because if i try flipping them i get infinite recursion, but if i don't flip them, then it works | 04:41:00 |
llakala | it doesn't matter as much in this case, because merging with localWrapper results in a top-level attribute localPackages, e.g.
```
{ pkgs, localPackages }:
```
but the only reason I HAD to create the localWrapper attribute was because of issues with shadowing, and swapping the order would've been an alternate way to fix it | 04:41:05 |
Charles | i'm not sure if it works as expected, but it at least evals | 04:41:12 |
llakala | In reply to @charles:computer.surgery because if i try flipping them i get infinite recursion, but if i don't flip them, then it works interesting | 04:41:16 |
llakala | will have to do some investigating into this | 04:41:43 |
Charles | the infinite recursion is because, for example, nixpkgs has displaycal and my scope also wants to have displaycal , and my scope's displaycal is defined in terms of nixpkgs' displaycal | 04:42:51 |
Charles | if localWrapper takes precedence over pkgs , then this is obviously infinite recursion | 04:43:16 |
Charles | but i suspect that also in this case if another local package wants to depend on displaycal , it will get the nixpkgs one instead of my overridden one | 04:43:48 |
Charles | ohhhhhhhhhhhhhhhh | 04:49:13 |
Charles | i'm stupid | 04:49:15 |
Charles | the reason i wasn't getting infinite recursion before is because i had an extra attrset in the way | 04:49:27 |
Charles | so i think what you have is actually fine, but you could also change it to just (localWrapper // extra) because i think including the stuff from pkgs is implied by using pkgs.newScope above | 04:50:50 |
llakala | In reply to @charles:computer.surgery so i think what you have is actually fine, but you could also change it to just (localWrapper // extra) because i think including the stuff from pkgs is implied by using pkgs.newScope above gotcha I'll try that | 04:51:19 |
Charles | if it doesn't work then just pretend i didn't say anything :P | 04:51:32 |
Charles | tangentially related: Option<T> in nix:
some[T] = [true T];
none = [false];
option[T] = some[T] | none
| 05:16:35 |