| 1 Mar 2025 |
elikoga | Also self is in inputs | 12:02:49 |
cleverca22 | nix-repl> x = builtins.getFlake (toString ./.);
nix-repl> x.inputs.self
error:
… while evaluating the attribute 'inputs.self'
at «nix-internal»/call-flake.nix:78:23:
77|
78| inherit inputs; inherit outputs; inherit sourceInfo; _type = "flake";
| ^
79| };
error: attribute 'self' missing
at «string»:1:1:
1| x.inputs.self
| ^
| 12:03:14 |
cleverca22 | i think i just want flake.outputs | 12:03:55 |
elikoga | I think you have access from the inside | 12:04:04 |
elikoga | From the outside you can just toString getFlake to get the path I think | 12:04:25 |
cleverca22 | in this case, i want one of the outputs on the flake | 12:04:41 |
cleverca22 | x.outputs.packages.x86_64-linux.netinstall_image so yeah, i just want outputs | 12:05:00 |
| 2 Mar 2025 |
| Heitor Augusto joined the room. | 22:58:16 |
| 3 Mar 2025 |
| bendanm joined the room. | 04:43:17 |
| vog joined the room. | 10:24:09 |
| 6 Mar 2025 |
| solomon joined the room. | 00:12:18 |
solomon | Hi. is there any way to have nested package outputs like this?
packages = {
foo = pkgs.foo;
bar = {
baz = pkgs.baz;
qux = pkgs.qux;
};
};
| 00:15:10 |
solomon | so that you can do something like nix build '.#bar.baz' | 00:15:28 |
solomon | I thought flake-utils' flattenTree would do this but it doesnt seem to | 00:18:23 |
solomon | * I thought flake-utils' flattenTree would allow this but it doesnt seem to | 00:18:30 |
elikoga | I think you can place them in the root of the flake outputs | 00:19:01 |
solomon | what do you mean? | 00:19:16 |
elikoga | Right now you're trying to use shorthand package selection syntax but it probably fails due to there not being an architecture | 00:19:27 |
solomon | sorry let me give a real example:
packages = flake-utils.lib.flattenTree {
docker = import ./nix/docker.nix {
inherit pkgs;
cofree-bot = hsPkgs.cofree-bot;
};
ghc982 = flake-utils.lib.flattenTree {
chat-bots = hsPkgs.chat-bots;
chat-bots-contrib = hsPkgs.chat-bots-contrib;
cofree-bot = hsPkgs.cofree-bot;
default = hsPkgs.cofree-bot;
};
chat-bots = hsPkgs.chat-bots;
chat-bots-contrib = hsPkgs.chat-bots-contrib;
cofree-bot = hsPkgs.cofree-bot;
default = hsPkgs.cofree-bot;
};
| 00:19:52 |
solomon | * sorry let me give a real example:
packages = flake-utils.lib.flattenTree {
docker = import ./nix/docker.nix {
inherit pkgs;
cofree-bot = hsPkgs.cofree-bot;
};
ghc982 = {
chat-bots = hsPkgs.chat-bots;
chat-bots-contrib = hsPkgs.chat-bots-contrib;
cofree-bot = hsPkgs.cofree-bot;
default = hsPkgs.cofree-bot;
};
chat-bots = hsPkgs.chat-bots;
chat-bots-contrib = hsPkgs.chat-bots-contrib;
cofree-bot = hsPkgs.cofree-bot;
default = hsPkgs.cofree-bot;
};
| 00:20:02 |
solomon | and i'm using flake-utils.lib.eachDefaultSystem | 00:20:22 |
solomon | * and i'm using flake-utils.lib.eachDefaultSystem to set the architecture | 00:20:56 |
elikoga | Ah, yes, I'm not familiar with flattenTree but you can try using tab completion in the cli or nix repl to find out the ultimate path of your packages. And then use them | 00:21:12 |
solomon | i did that and those nested packages dont show up at all | 00:21:26 |
elikoga | I suggest reading library source code if you are not familiar with the behavior of a library | 00:21:44 |
elikoga |  Download Screenshot_20250306_012226_Firefox.png | 00:22:40 |
elikoga | Have you tried setting recurseForDerivations? | 00:22:56 |
elikoga | https://github.com/numtide/flake-utils/blob/11707dc2f618dd54ca8739b309ec4fc024de578b/flattenTree.nix#L18 | 00:23:09 |
solomon | i've never heard of that | 00:23:11 |
elikoga | I don't know it's right there on my screen | 00:23:22 |