!9IQChSjwSHXPPWTa:lix.systems

Lix

1140 Members
Lix user channel. Feel free to discuss on-topic issues here and give each other help. For matrix.to links to the rest of the Lix channels, see: https://wiki.lix.systems/books/lix-organisation/page/matrix-rooms315 Servers

Load older messages


SenderMessageTime
13 Apr 2026
@charles:computer.surgeryCharles that + is scuffed though lol 20:40:31
@charles:computer.surgeryCharlesit makes sense but still20:40:52
@blokyk:matrix.orgzoë (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
@blokyk:matrix.orgzoë (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
@blokyk:matrix.orgzoë (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:computer.surgeryCharlesoh, that's silly20:47:57
@charles:computer.surgeryCharlesi assume there's a good reason why this hasn't been changed?20:48:05
@blokyk:matrix.orgzoë (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:computer.surgeryCharles
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
@blokyk:matrix.orgzoë (she/her) worst part is that if you wrote ${pins.press} instead, it would have worked just fine ;-; 20:49:08
@blokyk:matrix.orgzoë (she/her) * worst part is that if you wrote ${pins.press} instead, it would work just fine ;-; 20:49:14
@blokyk:matrix.orgzoë (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:computer.surgeryCharleslol reasonable20:50:52
@blokyk:matrix.orgzoë (she/her) yeah, toString and interpolation resulting in differently-contexted strings is another biiiig footgun 🙃 20:51:19
@blokyk:matrix.orgzoë (she/her)it has bit me many times before :/20:51:32
@blokyk:matrix.orgzoë (she/her)but it's also kinda load bearing20:51:45
@blokyk:matrix.orgzoë (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
@blokyk:matrix.orgzoë (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:computer.surgeryCharlesoof20:53:27
@blokyk:matrix.orgzoë (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:computer.surgeryCharlesi think that's why, yeah20:56:09
@charles:computer.surgeryCharlesbecause 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 do20:56:42
@blokyk:matrix.orgzoë (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:computer.surgeryCharles maybe also check __toString 22:10:43
@charles:computer.surgeryCharleshttps://docs.lix.systems/manual/lix/stable/language/builtins.html#builtins-import22:11:37
@charles:computer.surgeryCharles import checks that too for example 22:11:47
@blokyk:matrix.orgzoë (she/her)hmm that makes sense22:12:08
@charles:computer.surgeryCharles __toString takes precedence over outPath for builtins.toString so probably you'd want to copy that 22:12:31
@blokyk:matrix.orgzoë (she/her)i have to amend it anyway cause i forget to nixfmt it, as always22:12:31
@blokyk:matrix.orgzoë (she/her)oh god this language22:12:55

There are no newer messages yet.


Back to Room ListRoom Version: 10