| 13 Apr 2026 |
Charles | that + is scuffed though lol | 20:40:31 |
Charles | it makes sense but still | 20:40:52 |
zoë (she/her) | yep, especially because that value is not a path according to the builtins (isPath {...} = false, isAttrs {...} = true), which makes it really transparent in some cases while still breaking down when it's least convenient (e.g. trying to use a derivation (which, for most cases, is any set with outPath) as a nixpkgs module) | 20:43:43 |
zoë (she/her) | * yep, especially because that value is not a path according to the builtins (isPath {...} = false, isAttrs {...} = true), which makes it really transparent in some cases while still breaking down when it's least convenient (e.g. trying to use a derivation (which, for most cases, is any set with outPath) as a nixpkgs module, because the module system uses builtins.isPath but never foo?outPath) | 20:45:16 |
zoë (she/her) | so, for example, trying to directly put a pin from npins into a module's import list doesn't work; instead, you need to explicitely use .outPath on it:
{ ... }:
let pins = import ./npins {}; in {
imports = [
pins.press # doesn't work
pins.nix-z4h.outPath # works
];
}
| 20:47:13 |
Charles | oh, that's silly | 20:47:57 |
Charles | i assume there's a good reason why this hasn't been changed? | 20:48:05 |
zoë (she/her) | * so, for example, trying to directly put a pin from npins into a module's import list doesn't work; instead, you need to explicitely use .outPath on it:
{ ... }:
let pins = import ./npins {}; in {
imports = [
pins.press # doesn't work
pins.nix-z4h.outPath # works
];
}
| 20:48:32 |
Charles | nix-repl> builtins.getContext (builtins.toString <nixpkgs>)
{ }
nix-repl> builtins.getContext "${<nixpkgs>}"
{
"/nix/store/bwdc9wx2vwdawf6pfv6kcdjc4lz87nhb-anvdcc2arw7kqrvwnidvhw6ypkkvws68-source" = { ... };
}
nix-repl> <nixpkgs>
/nix/store/anvdcc2arw7kqrvwnidvhw6ypkkvws68-source
tangentially related, this was interesting. also that second expr took a very long time to run
| 20:48:38 |
zoë (she/her) | worst part is that if you wrote ${pins.press} instead, it would have worked just fine ;-; | 20:49:08 |
zoë (she/her) | * worst part is that if you wrote ${pins.press} instead, it would work just fine ;-; | 20:49:14 |
zoë (she/her) | i have no idea; i assume there is, but i've never seen a nixpkgs issue for it and i've been too lazy to make one and fight against whatever inevitable nitpicking/bikeshedding would occur (especially since i knew zilch about the module system) | 20:50:33 |
Charles | lol reasonable | 20:50:52 |
zoë (she/her) | yeah, toString and interpolation resulting in differently-contexted strings is another biiiig footgun 🙃 | 20:51:19 |
zoë (she/her) | it has bit me many times before :/ | 20:51:32 |
zoë (she/her) | but it's also kinda load bearing | 20:51:45 |
zoë (she/her) | the most frustrating part is mostly when using other's code (including nixpkgs), since then you have to go digging into every function to know whether or not the drv/path you're passing gets interpolated or toString'd | 20:52:37 |
zoë (she/her) | * the most frustrating part is mostly when using other's code (including nixpkgs), since then you have to go digging into every function to know whether or not the drv/path you're passing gets interpolated or toString'd, and there's some contexts/applications where that really matters | 20:53:18 |
Charles | oof | 20:53:27 |
zoë (she/her) | (also yeah i've also noticed getContext taking a bit of time in the past, though i had always assumed that was either just an illusion or a personal thing; it might just be because it's computing/instantiating the derivation?) | 20:55:55 |
Charles | i think that's why, yeah | 20:56:09 |
Charles | because the store path it outputs is weird i assume it's making another copy of nixpkgs, at minimum, which isn't the fastest thing to do | 20:56:42 |
zoë (she/her) | you know what they say: the best way to learn something is to be wrong about it on the internet :) | 22:08:43 |
Charles | maybe also check __toString | 22:10:43 |
Charles | https://docs.lix.systems/manual/lix/stable/language/builtins.html#builtins-import | 22:11:37 |
Charles | import checks that too for example | 22:11:47 |
zoë (she/her) | hmm that makes sense | 22:12:08 |
Charles | __toString takes precedence over outPath for builtins.toString so probably you'd want to copy that | 22:12:31 |
zoë (she/her) | i have to amend it anyway cause i forget to nixfmt it, as always | 22:12:31 |
zoë (she/her) | oh god this language | 22:12:55 |