!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

895 Members
183 Servers

Load older messages


SenderMessageTime
1 Mar 2025
@elikoga:matrix.orgelikogainputs.self?11:06:53
@elikoga:matrix.orgelikoga Ah wait local path, no not possible. Since it's pure. 11:07:12
@elikoga:matrix.orgelikoga If you were able you would be able to smuggle information into the evaluation process 11:07:43
@elikoga:matrix.orgelikoga Why do you want to access that string? 11:08:07
@cleverca22:matrix.orgcleverca22
In reply to @elikoga:matrix.org
Why do you want to access that string?

i need the path to something in the working tree, to pass to a util i'm running in a shell
i dont want to have to re-load the shell every single time things get modified, thats already caused bugs because this wasnt noticed

i could use the working directory, but then it will fail if you cd into the wrong sub-dir

11:54:07
@elikoga:matrix.orgelikoga I use git rev-parse --show-toplevel in a shellHook in the dev shell and if you run it from outside the repo that's on you 11:55:42
@cleverca22:matrix.orgcleverca22ah yes, that sounds perfect11:56:48
@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

Show newer messages


Back to Room ListRoom Version: 6