!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

859 Members
177 Servers

Load older messages


SenderMessageTime
1 Mar 2025
@cleverca22:matrix.orgcleverca22i'm also using direnv, so you cant run it from outside the repo11:57:19
@cleverca22:matrix.orgcleverca22the shell would unload all of those utils11:57:24
@cleverca22:matrix.orgcleverca22
       error: attribute 'self' missing
           22|     _module.args = {
           23|       inherit (flake) inputs self;
             |                              ^
           24|     };
12:01:32
@cleverca22:matrix.orgcleverca22now that just leaves this puzzle, it was working earlier12:01:40
@elikoga:matrix.orgelikoga I do not know inherit (flake) I've never met this man in my life 12:02:34
@elikoga:matrix.orgelikoga Also self is in inputs 12:02:49
@cleverca22:matrix.orgcleverca22
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:matrix.orgcleverca22i think i just want flake.outputs12:03:55
@elikoga:matrix.orgelikoga I think you have access from the inside 12:04:04
@elikoga:matrix.orgelikoga From the outside you can just toString getFlake to get the path I think 12:04:25
@cleverca22:matrix.orgcleverca22in this case, i want one of the outputs on the flake12:04:41
@cleverca22:matrix.orgcleverca22 x.outputs.packages.x86_64-linux.netinstall_image so yeah, i just want outputs 12:05:00
2 Mar 2025
@heitoraugusto:matrix.orgHeitor Augusto joined the room.22:58:16
3 Mar 2025
@bendanm:matrix.orgbendanm joined the room.04:43:17
@vog:matrix.orgvog joined the room.10:24:09
6 Mar 2025
@solomon:cofree.coffeesolomon joined the room.00:12:18
@solomon:cofree.coffeesolomon

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:cofree.coffeesolomon so that you can do something like nix build '.#bar.baz' 00:15:28
@solomon:cofree.coffeesolomon I thought flake-utils' flattenTree would do this but it doesnt seem to 00:18:23
@solomon:cofree.coffeesolomon * I thought flake-utils' flattenTree would allow this but it doesnt seem to 00:18:30
@elikoga:matrix.orgelikoga I think you can place them in the root of the flake outputs 00:19:01
@solomon:cofree.coffeesolomonwhat do you mean?00:19:16
@elikoga:matrix.orgelikoga 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:cofree.coffeesolomon

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:cofree.coffeesolomon *

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:cofree.coffeesolomon and i'm using flake-utils.lib.eachDefaultSystem 00:20:22
@solomon:cofree.coffeesolomon * and i'm using flake-utils.lib.eachDefaultSystem to set the architecture 00:20:56
@elikoga:matrix.orgelikogaAh, 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 them00:21:12
@solomon:cofree.coffeesolomoni did that and those nested packages dont show up at all00:21:26
@elikoga:matrix.orgelikoga I suggest reading library source code if you are not familiar with the behavior of a library 00:21:44

Show newer messages


Back to Room ListRoom Version: 6