!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1518 Members
Nix programming language267 Servers

Load older messages


SenderMessageTime
22 Sep 2024
@aos1:matrix.orgaos What are the odds that we're both answering this question around the same time haha. Your answer is more thorough cafkafk thanks. I do want to add some links in case it's helpful: https://nix.dev/manual/nix/2.18/language/builtins.html?highlight=import#builtins-import and https://nixos.org/manual/nixos/stable/#sec-writing-modules 09:33:19
@cafkafk:gitter.imcafkafk
In reply to @aos1:matrix.org
What are the odds that we're both answering this question around the same time haha. Your answer is more thorough cafkafk thanks. I do want to add some links in case it's helpful: https://nix.dev/manual/nix/2.18/language/builtins.html?highlight=import#builtins-import and https://nixos.org/manual/nixos/stable/#sec-writing-modules
Hehe, thanks :p
09:33:35
@cafkafk:gitter.imcafkafk Also if you do wanna evaluate something like it's a NixOS module instead of using import, I'm pretty sure you can use lib.evalModules to get something like imports 09:34:40
@cafkafk:gitter.imcafkafk

ohh also, turns out import isn't technically a keyword, but a builtin ๐Ÿ™ƒ

nix-repl> import = x: x + 1

nix-repl> import 10
11
09:37:02
@rayne:spooky.computer@rayne:spooky.computer left the room.10:25:42
@me:caem.devcaem changed their profile picture.19:34:01
23 Sep 2024
@kamillaova:matrix.orgKamilla 'ova
In reply to@cafkafk:gitter.im

ohh also, turns out import isn't technically a keyword, but a builtin ๐Ÿ™ƒ

nix-repl> import = x: x + 1

nix-repl> import 10
11
null = "definitely not null" moment
02:48:22
@cafkafk:gitter.imcafkafk I think it's a good argument for always using builtins.<thing> which I haven't managed to reassign (yet) 02:50:10
@cafkafk:gitter.imcafkafkokay well you can reassign builtins but02:50:22
@cafkafk:gitter.imcafkafk * I think it's a good argument for always using builtins.<thing> which I haven't managed to reassign (yet) 02:51:17
@rz_mj:freiburg.social@rz_mj:freiburg.social left the room.07:33:37
@federicodschonborn:matrix.orgFederico Damiรกn Schonborn joined the room.12:47:10
@elikoga:matrix.orgelikoga joined the room.15:29:22
@beleap:matrix.orgBeLeap changed their profile picture.20:30:03
@beleap:matrix.orgBeLeap changed their display name from beleap to BeLeap.20:30:18
@beleap:matrix.orgBeLeap changed their profile picture.20:33:08
@me:caem.devcaem changed their profile picture.21:57:51
24 Sep 2024
@kuznero:matrix.orgkuznero joined the room.09:45:03
@memegames99:matrix.org@memegames99:matrix.org
In reply to @cafkafk:gitter.im

ohh also, turns out import isn't technically a keyword, but a builtin ๐Ÿ™ƒ

nix-repl> import = x: x + 1

nix-repl> import 10
11
very cool
10:14:22
@keithhub:matrix.orgkeithhub joined the room.18:04:56
@mel:rnrd.euMel joined the room.19:00:58
@ckie:ckie.devmei ๐ŸŒ’& changed their profile picture.23:24:59
25 Sep 2024
@luna-null:matrix.orgAutumn changed their display name from luna-null to Autumn.06:39:15
@artturin:matrix.orgArtturin
arch = builtins.getAttr stdenvNoCC.hostPlatform.system {
  x86_64-linux = "x64";
  x86-linux = "x86";
};

vs

arch =
  {
    x86_64-linux = "x64";
    x86-linux = "x86";
  }
  ."${stdenvNoCC.hostPlatform.system}";
20:55:59
@artturin:matrix.orgArtturinAny perf diff?20:56:31
@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

Show newer messages


Back to Room ListRoom Version: 6