!tDnwWRNkmmYtMXfaZl:nixos.org

Nix Language

1928 Members
Nix programming language359 Servers

Load older messages


SenderMessageTime
19 Jun 2026
@alexfmpe:matrix.orgalexfmpeA good deal was probably from me getting confused by lazyness but still12:07:04
@alexfmpe:matrix.orgalexfmpe
In reply to @llakala:matrix.org

i've come to the conclusion that somehow the toposort function has an extreme performance dropoff as the input size reaches a new power of 10

Benchmark 1: nix-instantiate --eval --strict  --expr '(import ./benchmark.nix)."999"'
  Time (mean ± σ):     244.7 ms ±   4.7 ms    [User: 177.6 ms, System: 65.8 ms]
  Range (min … max):   238.5 ms … 256.3 ms    25 runs

Benchmark 2: nix-instantiate --eval --strict  --expr '(import ./benchmark.nix)."1000"'
  Time (mean ± σ):     245.9 ms ±   4.8 ms    [User: 177.1 ms, System: 67.6 ms]
  Range (min … max):   239.4 ms … 258.7 ms    25 runs

Benchmark 3: nix-instantiate --eval --strict  --expr '(import ./benchmark.nix)."1001"'
  Time (mean ± σ):     392.6 ms ±   8.8 ms    [User: 280.1 ms, System: 108.8 ms]
  Range (min … max):   381.2 ms … 411.2 ms    25 runs

same thing happens at 99, 100, and 101

Oddly specific. Maybe some util is called chunking/partioning things into 10 pieces recursively? Then crossing to 10^n+1 territory means one more level of depth
12:10:02
@llakala:matrix.orgllakalayou'd think so... but the entire code is two functions, both of which I've read12:24:02
@llakala:matrix.orgllakalahang on I'll link it12:25:22
@llakala:matrix.orgllakalahttps://github.com/NixOS/nixpkgs/blob/805dc355c3c19ceca8b2dc2726d4f0414a64322e/lib/lists.nix#L124612:26:12
@llakala:matrix.orgllakalajust toposort and listDfs12:26:32
@alexfmpe:matrix.orgalexfmpemaybe it happens at the nix impl level? quickly grepping on NixOS/nix gives me nothing obvious though12:41:08
@alexfmpe:matrix.orgalexfmpebut that's the first thing that comes to mind when things magically get slower with lists of size 10^n+112:41:38
@alexfmpe:matrix.orgalexfmpeor some weird *10 allocation scheme12:45:05
@alexfmpe:matrix.orgalexfmpe also see nothing interesting when lazy grepping for '\b10\b' around NixOS/nix/lib 12:46:14
@llakala:matrix.orgllakala yeah but this is a deterministic difference 12:50:45
@llakala:matrix.orgllakalait differs in nrPrimops12:50:50
@llakala:matrix.orgllakalanot just real-time perf12:50:56
@xokdvium:matrix.orgSergei Zimmerman (xokdvium)
In reply to @alexfmpe:matrix.org
Oddly specific. Maybe some util is called chunking/partioning things into 10 pieces recursively? Then crossing to 10^n+1 territory means one more level of depth
Definitely not powers of 10 :) Doubt there’s even anything exponential growth related with a power of 2 (albeit a small suspect, due to std::vector and such)
12:54:54
@lumi:the-apothecary.clubNuwa changed their profile picture.17:41:22
@lumi:the-apothecary.clubNuwa removed their profile picture.17:41:43
@lumi:the-apothecary.clubNuwa set a profile picture.17:42:28
@lumi:the-apothecary.clubNuwa changed their profile picture.17:48:30
@lumi:the-apothecary.clubNuwa changed their profile picture.18:11:56
20 Jun 2026
@chronorose:matrix.orgchronorose joined the room.16:30:42
@turrentianos:matrix.orgTurrentianos joined the room.17:44:20
@lumi:the-apothecary.clubNuwa changed their profile picture.19:05:42
21 Jun 2026
@removed-user:matrix.orgremoved-user joined the room.12:25:01
@jmeh:matrix.orgJosé Echenique joined the room.18:55:19
@tsilvs:unredacted.orgtsilvs joined the room.21:27:45
@tsilvs:unredacted.orgtsilvs

Hello, everyone!

I recently started writing my onw NixOS config, and I have a question: How do you usually lint your nix configs?

I noticed there are at least 3 options, probably combinable:

  1. statix
  2. nixpkgs-lint
  3. bash lint scripts

There is also an ast-grep thing. That may or may not have a .nix syntax support somewhere.

Are there any common (or just practiced by anyone) techniques that allow writing custom AST-query-based rules to, for example, mark "hardcoded" port numbers (not read from a variable) as linting rule violations?

21:29:41
@djacu:matrix.orgdjacu There is also deadnix 21:32:28
@tsilvs:unredacted.orgtsilvsAFAIK, it only checks for dead code, right?21:33:18
@djacu:matrix.orgdjacu
In reply to @tsilvs:unredacted.org
AFAIK, it only checks for dead code, right?
I believe so
21:34:12
@tsilvs:unredacted.orgtsilvs

Thank you.

You know anything related to AST queries for Nix configs?

21:45:27

Show newer messages


Back to Room ListRoom Version: 6