| 10 Jul 2022 |
Alyssa Ross | https://sources.debian.org/ is what I was thinking of | 15:40:52 |
infinisil | For e.g. R, how about pkgs/prefixed/R/R/R/default.nix? | 15:41:41 |
infinisil | Or would that be too weird | 15:41:53 |
Alyssa Ross | if we say there are always exactly two levels, that's fine | 15:42:22 |
kevincox | In reply to @infinisil:matrix.org If we want to do auto-calling of these packages, then the attribute name should be determined from the file path though 🤔 Technically the other way around. With the attribute name we need to be able to find the file. | 15:44:42 |
kevincox | Maybe both if we need to support iteration. | 15:44:55 |
Alyssa Ross | Hydra needs to be able to iterate | 15:45:21 |
kevincox | So we need to be able to go both ways. Otherwise we still need to construct the full attrs for every eval. | 15:46:02 |
infinisil | It's very easy to go both ways | 15:47:30 |
kevincox | We can also consider a "slow path" or hack for hydra-type build all. But that probably isn't necessary. | 15:47:36 |
K900 | crates.io does a weird thing | 15:49:24 |
K900 | They have 1/a.json, 2/aa.json, 3/aaa.json, and then aa/aa/aaaa.json etc | 15:49:59 |
K900 | So the short names go into the short names corner of shame | 15:50:18 |
K900 | And then it's ab/cd/abcd.json | 15:50:43 |
infinisil | Btw if we're concerned about performance, there's also the option of adding Nix builtins to speed up certain operations | 15:51:20 |
kevincox | Assuming we still have .nix that seems unnecessary. It would be interesting to see their rationale. | 15:51:31 |
infinisil | Maybe even a builtins.prefixedAutocall | 15:51:32 |
kevincox | I think some sort of ProxyAttrs that allowed overriding lookup and iteration would be the generic option. But we could also just hardcode the lookup scheme that we pick. | 15:52:26 |
infinisil | Oh I see, so you mean to allow people to specify some file outside of nixpkgs for a specific attribute for development? | 15:53:27 |
infinisil | I think that's very unproblematic, an overlay can already be used for that | 15:54:31 |
kevincox | I'm thinking something like this. (For a flat solution)
all-packages = builtin.proxyAttrs {
lookup = name: pkgs.callPackage (import "pkgs/${name}.nix");
list-keys = # List all packages and return a list or something here.
};
Then for the common case of nix-build -A foo it just calls lookup "foo" and only that package is loaded.
| 15:56:13 |
infinisil | Ah! Yes that's an interesting idea and could have many other useful applications | 15:57:24 |
kevincox | To all other Nix code it would behave like a regular attrs of all packages except as long as you never do something that requires listing attributes it doesn't have to build the full set. | 15:57:29 |
kevincox | (IDK if we need other primitive operations but they can be added easily. We can also do caching to ensure that it is pure) | 15:58:11 |
kevincox | Yeah, for nixpkgs we can make as complicated of a lookup as we like, include 1 or 2 level and whatnot. We can also fall back to the current all-packages.nix attr for transition. | 15:59:05 |
kevincox | This could also be polyfilled for older NIxes by eagerly computing the real attrs. | 16:07:43 |
kevincox | * This could also be polyfilled for older NIxes by eagerly computing the a attrset. | 16:09:26 |
kevincox | * This could also be polyfilled for older NIxes by eagerly computing the resulting attrset. | 16:17:37 |
| 11 Jul 2022 |
j-k | Slightly related: I just noticed /nix/var/log/nix/drvs/ has a 2 letter prefix sub dir pattern
λ ls /nix/var/log/nix/drvs/
ï„• 00 ï„• 0s ï„• 1l ï„• 2f ï„• 38 ï„• 42 ï„• 4w ï„• 5n ï„• 6h ï„• 7a # ... etc ...
| 11:01:01 |
| Wanja Hentze joined the room. | 12:39:14 |