!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1932 Members
Nix programming language362 Servers

Load older messages


SenderMessageTime
21 May 2021
@snail:the-apothecary.clubLavender changed their display name from Lavender to Lavender's first braincell.20:07:07
@snail:the-apothecary.clubLavender changed their display name from Lavender's first braincell to Lavender.20:08:14
@mm-:matrix.orgJosh joined the room.20:10:02
@escap:matrix.orgescaP joined the room.20:15:59
@princemachiavelli:matrix.orgprincemachiavelli joined the room.21:50:25
@maralorn:maralorn.demaralorn joined the room.23:09:31
22 May 2021
@robin.gloster:matrix.mayflower.deglobin joined the room.00:04:23
@raccoon:raccoon.funraccoon! joined the room.08:55:30
@andi:kack.itandi- removed their profile picture.13:25:20
@andi:kack.itandi- set a profile picture.13:34:02
@jackal:matrix.orgcodyopel joined the room.14:24:03
@yusdacra:tchncs.deyusdacra changed their profile picture.15:11:39
@-chi:matrix.org-chi joined the room.15:50:09
@mvtva:matrix.orgmvnetbiz joined the room.15:52:23
@qyliss:fairydust.spaceAlyssa Ross joined the room.18:01:06
@qyliss:fairydust.spaceAlyssa Rosshmm, this channel isn't going to be the same without puck18:01:26
@7c6f434c:nitro.chat7c6f434c Alyssa Ross: I guess puck will join in a few days? 18:07:17
@toonn:matrix.orgtoonn Back to being a quiet place to learn about Nix quirks. 18:06:48
@qyliss:fairydust.spaceAlyssa Rossi'm not sure she's going to make the move to matrix18:07:55
@7c6f434c:nitro.chat7c6f434cWell, if there is not an IRC bridge in sight in a week…18:08:46
@toonn:matrix.orgtoonn Tell them we'll keep them company over on Libera.Chat : ) 18:11:02
@melg8:matrix.orgMelg8

Can somebody help, i've created a monster... now want it to be alive.
How to test:
nix-instantiate --eval --strict -E 'toString (import ./build_inputs_1.nix { pkg = (import <nixpkgs> {}).hello; })'
Create file build_inputs_1.nix with:

{ pkg, lib ? import <nixpkgs/lib> }:
let
  drv_direct_dependencies =
    drv_path:
    let
      drv_file = builtins.readFile drv_path;
      storeDirRe = lib.replaceStrings [ "." ] [ "\\." ] builtins.storeDir;
      storeBaseRe = "[0-9a-df-np-sv-z]{32}-[+_?=a-zA-Z0-9-][+_?=.a-zA-Z0-9-]*";
      re = "(${storeDirRe}/${storeBaseRe}\\.drv)";
      inputs = lib.concatLists (lib.filter lib.isList (builtins.split re drv_file));
    in
    inputs;

  drv_all_dependencies = { drv_path, visited }:
    let
      direct_dependencies = drv_direct_dependencies drv_path;
      minimal_path = { paths = [ drv_path ]; visited = visited ++ [ drv_path ]; };
      just_visited = { paths = [ ]; visited = visited ++ [ drv_path ];};
      concat_outs = (out1: out2: { paths = out1.paths ++ out2.paths; visited = out1.visited ++ out2.visited; });
      visit_all_childs = (out: dependency:
      if (builtins.elem dependency out.visited) then out
      else concat_outs out (drv_all_dependencies { drv_path = dependency; visited = out.visited; }));
      result =
        if (builtins.length direct_dependencies) == 0 then minimal_path
        else concat_outs (builtins.foldl' visit_all_childs just_visited direct_dependencies) minimal_path;
    in
    result;
in
(drv_all_dependencies { drv_path = pkg.drvPath; visited = [ ]; }).paths

Problem:
GC Warning: Repeated allocation of very large block (appr. size 2525917184):

but it works on small example (only 4 derivations in chain).

What i try to achieve: given drv_path function must reaturn a list, containing all derivations which need to be build in order to build derivation from drv_path. list should be ordered, so first on list is most needed derivation, last on list - derivation from given path.

18:16:10
@melg8:matrix.orgMelg8 i can add my initial attempt - without visited part, but it falis in other way - just too long to execute. 18:18:49
@sternenseemann:systemli.orgsterni (he/him)
In reply to @qyliss:fairydust.space
hmm, this channel isn't going to be the same without puck
indeed :(
18:19:11
@melg8:matrix.orgMelg8thanks! i figured out it by myself - just too much stuff were in "visited" - so i've added lib.unique - and now it works! anyway, if anyone have suggestions, i would like to hear them)18:31:11
@skochen:matrix.orgStéphan set a profile picture.20:23:18
@ivank:matrix.orgivan joined the room.21:27:59
@ivank:matrix.orgivan changed their display name from ivank to ivan.21:30:08
23 May 2021
@codygman:matrix.orgcodygman joined the room.03:12:17
@treed:cybre.spacetreed joined the room.04:47:52

Show newer messages


Back to Room ListRoom Version: 6