!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1519 Members
Nix programming language268 Servers

Load older messages


SenderMessageTime
25 Sep 2024
@emilazy:matrix.orgemilyhm, function call vs. string interpolation maybe?20:57:37
@artturin:matrix.orgArtturin
$ diff stats-simple-builtin.json stats-simple-interpolation.json
2c2
<   "cpuTime": 0.011803999543190002,
---
>   "cpuTime": 0.009681999683380127,
10c10
<     "totalBytes": 10416
---
>     "totalBytes": 10432
17,18c17,18
<   "nrAvoided": 4,
<   "nrExprs": 59,
---
>   "nrAvoided": 3,
>   "nrExprs": 58,
23,24c23,24
<   "nrPrimOpCalls": 1,
<   "nrThunks": 2,
---
>   "nrPrimOpCalls": 0,
>   "nrThunks": 1,
41,42c41,42
<     "bytes": 3072,
<     "number": 128
---
>     "bytes": 3048,
>     "number": 127

(ignore cpu time)

21:08:33
@artturin:matrix.orgArtturinimage.png
Download image.png
21:09:53
@artturin:matrix.orgArtturin
let
  system = "x86_64-linux";
  arch =
    {
      x86_64-linux = "x64";
      x86-linux = "x86";
    }
    ."${system}";
in
  arch
let
  system = "x86_64-linux";
  arch = builtins.getAttr system {
    x86_64-linux = "x64";
    x86-linux = "x86";
  };
in
  arch
21:11:43
@artturin:matrix.orgArtturinAnd in nixpkgs 21:13:35
@artturin:matrix.orgArtturinimage.png
Download image.png
21:13:37
@artturin:matrix.orgArtturin NIX_SHOW_STATS=1 NIX_SHOW_STATS_PATH=stats-interpolation.json nix eval --impure ".#cups-idprt-barcode" 21:14:36
@artturin:matrix.orgArtturin Can't do or (throw "cups-idprt-barcode: No prebuilt filters for system: ${stdenvNoCC.hostPlatform.system}") with getAttr so will have to use the interpolation 21:30:58
@artturin:matrix.orgArtturin

Or

arches = {
  x86_64-linux = "x64";
  x86-linux = "x86";
};
arch =
  if (builtins.hasAttr stdenvNoCC.hostPlatform.system arches) then
    builtins.getAttr (stdenvNoCC.hostPlatform.system) arches
  else
    throw "Not supported on ${stdenvNoCC.hostPlatform.system}";

but this is ugly and also has worse stats

21:36:34
@artturin:matrix.orgArtturinimage.png
Download image.png
21:36:37
@emilazy:matrix.orgemily would be nice if you could say foo.(stdenvNoCC.…) 22:07:21
@buckley310:matrix.orgBuckley joined the room.23:11:54
26 Sep 2024
@fabianhjr:matrix.orgFabián Heredia set a profile picture.01:15:50
@genga898:matrix.orgEmmanuel Genga joined the room.11:44:21
@vendion:matrix.orgvendion joined the room.14:21:54
@simonyde:matrix.org@simonyde:matrix.org left the room.19:30:41
27 Sep 2024
@drupol:matrix.orgPol joined the room.12:09:09
@drupol:matrix.orgPol Heya!
I'm working on this PR https://github.com/hercules-ci/flake.parts-website/pull/1096 and I'm trying to address the first point noted by Robert Hensing (roberth) https://github.com/hercules-ci/flake.parts-website/pull/1096#issuecomment-2378900576
I would like to have some directions on how to do such a function.
I saw that efforts were made in https://github.com/NixOS/nixpkgs/issues/237776, figsoda proposed a function concatMapAttrsWith but I don't know how it could help me for the issue I have.
12:11:15
@drupol:matrix.orgPol

I'm basically looking for transforming such an attribute:

{
             a = {
               b = {
                 c = <derivation hello-2.12.1>;
};

into:

"a/b/c" = <derivation ...>;`
12:13:46
@drupol:matrix.orgPol *

I'm basically looking for transforming such an attribute:

{
  a = {
    b = {
      c = <derivation hello-2.12.1>;
    };
  };
};

into:

"a/b/c" = <derivation ...>;`
12:14:15
@drupol:matrix.orgPol *

I'm basically looking for transforming such an attribute:

{
  a = {
    b = {
      c = <derivation hello-2.12.1>;
    };
  };
};

into:

"a/b/c" = <derivation ...>;`

Knowing that the tree structure can be totally varying.

12:14:51
@drupol:matrix.orgPol I pushed this thing: https://github.com/drupol/pkgs-by-name-for-flake-parts/commit/baf7212a27ec1cb1a1139f8bbc78a184581a4bcd but I have the feeling that it could be simplified/improved using concatMapAttrWith. WDYT? 12:29:08
@figsoda:matrix.orgfigsoda
In reply to @drupol:matrix.org

I'm basically looking for transforming such an attribute:

{
  a = {
    b = {
      c = <derivation hello-2.12.1>;
    };
  };
};

into:

"a/b/c" = <derivation ...>;`

Knowing that the tree structure can be totally varying.

I'm not sure if concatMapAttrsWith would be helpful in this particular case. I did the same thing in fenix to make nested package sets show up in flakes: code, but I just used concatMapAttrs directly
15:45:18
@drupol:matrix.orgPolGoing to check!15:45:36
@figsoda:matrix.orgfigsoda
In reply to @drupol:matrix.org

I'm basically looking for transforming such an attribute:

{
  a = {
    b = {
      c = <derivation hello-2.12.1>;
    };
  };
};

into:

"a/b/c" = <derivation ...>;`

Knowing that the tree structure can be totally varying.

* I'm not sure if concatMapAttrsWith would be helpful in this particular case. I did the same thing in fenix to make nested package sets show up in flakes: code, but I just used concatMapAttrs directly
15:45:52
@drupol:matrix.orgPolThank you!15:46:13
@elikoga:matrix.orgelikoga set a profile picture.16:27:25
@cafkafk:fem.ggcafkafk 🏳️‍⚧️ joined the room.19:11:48
28 Sep 2024
@aleksana:mozilla.orgaleksana (force me to bed after 18:00 UTC) Why is repl allowing if = 1 (can autocomplete if but can't get the value) but not a = { if = 1; }? 02:49:18
@aleksana:mozilla.orgaleksana (force me to bed after 18:00 UTC)I'm reading the lexer and parser but still can't understand why02:49:37

Show newer messages


Back to Room ListRoom Version: 6