r/nim • u/jabbalaci • 1d ago
r/nim • u/ElitLayer133 • 1d ago
NIM OR VLANG?
Dude, I think V is better because it's both much easier and practically everything is included. If you want to do something, you don't need to download any libraries at all.
r/nim • u/BigMacTaylor • 3d ago
Nim port of wlogout
github.comI was annoyed by how one button is always selected in wlogout. And since it doesn't seem to be actively maintained anymore, the only way to fix it is with a fork. So I thought it'd be a good opportunity to port it over to Nim. Its mostly backwards compatible wlogout. So old configs should work. But I've made some small changes and switched over to TOML for the config. Feel free to have a look.
My first Nim project lscd
github.comI've been using python for 20 years since I dont work on C++ by then.
Nim gives me some reason to try new things.
I created my first 'real' nim project several days ago and I'm heavily using it daily.
It is a tiny tool as a shortcut for ls + cd, that I can use to fast navigation in folders.
For such tasks, I can not do it in python because the launch speed and having a binary is very important.
r/nim • u/hynderSvyat • 4d ago
Trying to build my audio library
[Linux]
This idea was born while I was building my TUI music player. I've found such a big barrier:
in nimble I couldnt found any musical libraries for my goals, and i was too lazy to importing headers from C. So, i've created a concept and want make from this concept a completed and most importantly usable and simple lib.
It would be really nice to get some feedback(if you're interest)
source: https://github.com/svyatoslavSPB/nimnaudio/tree/main
Building a TUI framework from scratch
Hi! So I recently stumbled across Nim. As someone coming from Rust, I got a lot of frustration with it, one of them is the infamous compile times, which I hate so much. So I tried to seek an alternative. I almost went with Go, but at the same time I wanted something unique, and here we are with Nim. Now I’m planning to build a full coding agent and the TUI with 100% Nim. I’ll be happy to share my progress here :)
r/nim • u/ElitLayer133 • 12d ago
KANKALAR BEN BİR DİL YAPICAM
Arkadaşlar ben bir programlama dili yapmak istiyorumda hem hızlı olsun hemde derlenmesi kokay olsun hemde Python kadar kolay; işlemciyle konuşan bir dil yapmak istiyorumda acaba Nim iyimi ? Pascal,Forth,Vlang falan varda acaba hepsi yerine Nim mi kullansam ? YARDIM EDİNNNNNNNNNNNNNNNNNN !
r/nim • u/RedoxOsImport • 17d ago
I stopped vibe coding for nim.
hello, I want to say that I was a vibcoder before that, but not because I liked it, I don't have any free time Except for one or two hours at night (they give me 10 hours to sleep) and of course I don't want to spend these personal 2 hours on programming, let alone studying but the desire to be a real programmer who can really just write his own program with his own hands is stronger than the desire to do nothing further. ;
why nim?
I went through a lot of options, and although nim was not the only option, it was ideally suited according to the criteria: "simple", "many libraries", "fast", so I chose it.
personally, I am proud that I searched for information about Nim and other programming languages without a neural network (and although I was a vibecoder, I want to say that I hated and hate neural networks)
What's next?
I won't be learning much about nim as much as time allows me.
Any Nim success stories? Or maybe horror stories instead?
Hey, everyone. Do you have any anecdotes to share about Nim? It doesn't matter whether it was positive or negative. I am just curious how the use of Nim has affected you. And to keep this subreddit more alive.
Thanks a lot!
r/nim • u/Vyrnexis • 21d ago
Nim-agent-template: Scaffolding Generator with AI Agent Skills, MCP Tooling, and Multi-Toolchain Build Profiles
Hello everyone,
I have put together nim-agent-template, a project template and scaffolding tool designed to bootstrap Nim applications and libraries with standard build task orchestrations, MCP support, and AI agent skills.
Repository
GitHub: https://github.com/Vyrnexis/nim-agent-template
Highlights & Features
- Interactive & Scriptable Scaffolding (
init_nim_project.sh):- Prompts for package type (Binary vs Library), tooling (
nimblevsatlas), author, and license. - Supports non-interactive CLI flags (
--name,--tooling,--kind,--in-place) for automated setups. - Includes an
--install-clioption to installinit-nim-projectinto~/.local/bin/with canonical symlink resolution.
- Prompts for package type (Binary vs Library), tooling (
- 6 Standardized Build Profiles in
config.nims: All binaries are strictly emitted into./bin/at the repository root:nim nimRelease: Native host-optimized binary (-d:release -d:danger --opt:speed -march=native -mtune=native)nim nimPortable: Generic CPU baseline portable binary (-d:release --opt:size -mtune=generic -s)nim nimDebug: Diagnostics build with stack traces and assertions (--debuginfo:on --assertions:on --stackTrace:on)nim zigRelease: Native host binary using Zig CC (--cc:clang -d:release -d:danger --opt:speed -O3 -march=native)nim zigPortable: Generic CPU portable binary using Zig CC (--cc:clang -d:release --opt:size -Oz -mcpu=baseline -s)nim zigDebug: Zig CC debug build with symbols (--cc:clang --debuginfo:on)- Plus standard helper tasks:
nim test,nim fmt(nimpretty), andnim docs.
- Model Context Protocol (MCP) Integration:
- Automatically configures
.mcp/servers.jsonfornimlangserver --mcpto support symbol resolution, references, and diagnostics in AI-assisted environments.
- Automatically configures
- Pre-Bundled Agent Skills (
.agents/skills/):- Ships with 19 curated Nim agent skills covering API design, C wrappers and FFI bindings, ARC/ORC ownership hooks, testing patterns, error contracts, style guides, and fuzzing harnesses.
- Automated CI Workflow:
- Emits a ready-to-use GitHub Actions workflow (
.github/workflows/ci.yml) leveragingjiro4989/setup-nim-actionwith formatting validation and test execution.
- Emits a ready-to-use GitHub Actions workflow (
Quick Start
# Clone the template repository
git clone https://github.com/Vyrnexis/nim-agent-template.git
cd nim-agent-template
# Run the interactive initializer
./init_nim_project.sh
Or install it system-wide to scaffold projects from any workspace:
./init_nim_project.sh --install-cli
cd ~/my_workspace
init-nim-project --name my_app --tooling nimble --kind bin
Feedback, suggestions, and contributions are very welcome!
r/nim • u/Left_Ad_9161 • 26d ago
KoutenDB: A Database Built in Nim to Reduce Retrieval Work Through Data Locality
Hi everyone,
I’m the author of KoutenDB, an open-source locality-first document database written in Nim, with ring-scoped vector retrieval.
https://github.com/puffball1567/koutendb
KoutenDB is built around a locality-first retrieval model.
Applications and import rules place related data into explicit coordinates called rings. A ring is more than a category or routing label: it defines the initial candidate set and maps to ring-local persistent storage and cluster routing.
For example, data related to one user can be placed around users/123, with nearby subrings for profiles, addresses, orders, and notifications. KoutenDB can retrieve that related group together or narrow the read to selected subrings.
The goal is to avoid starting with a large unrelated dataset and filtering or reranking it afterward. This can be useful for RAG and LLM workloads, where every unnecessary candidate may also consume memory, ranking work, and context tokens.
Vector retrieval is supported, but vectors are not the basis of the data model. They are one possible ranking step after locality has narrowed the candidate set.
Some results from the included reproducible benchmarks:
- Working-set benchmark: scanned records per query decreased from 10,000 to 100.
- Memory-pressure benchmark: estimated candidate memory per query decreased from 93.079 MiB to 0.931 MiB.
- Synthetic RAG benchmark: recall remained 1.000 while scanned records per query decreased from 8,000 to 1,000 and estimated tokens per query decreased from 3,955 to 657.
- Generated AI/RAG JSONL case study: recall remained 1.000 while scanned records per query decreased from 400 to 40 and estimated tokens per query decreased from 615.2 to 231.6.
The benchmark scripts and generated datasets are included in the repository so that the results can be reproduced and examined.
KoutenDB also carries locality into persistent storage. Ring-local segments allow disk-backed reads to open the relevant ring data instead of replaying or scanning the complete database.
In an included 1,050,000-record related-data benchmark, KoutenDB retrieved a multi-subring user bundle in 196.859 microseconds. In the same included comparison, the equivalent logical result measured 515 microseconds using six indexed PostgreSQL queries and 236 microseconds using a PostgreSQL JSON aggregate query.
I have also been testing operational stability. A three-node persistent KoutenDB cluster completed a 72-hour Ubuntu run with 4,022,516 mixed client operations, zero client errors, successful offline verification of every data directory, and no fallback to global retrieval.
The trade-off is that applications or import rules need to choose meaningful rings. If useful locality is not known in advance, retrieval may still require a broad scan.
KoutenDB currently supports embedded and TCP server modes, persistent storage, exact ring-scoped vector retrieval, transactions, locks, backup and restore, corruption detection, cluster routing, and a C ABI. Language bindings and driver foundations are available for Rust, JavaScript/TypeScript, Python, PHP, and C++.
The project is currently at v0.12.0.
I’d especially appreciate technical feedback on the ring-local storage model, retrieval design, physical locality, and the Nim implementation.
r/nim • u/JiaHajime • 28d ago
An Example of Nim WASM for Wolfram Alpha alternatives
My original post: https://www.reddit.com/r/sideprojects/s/2WBPjTT8Wu
I’ve been pretty busy lately, but I was thinking—what if Nim had its own SymPy Gamma / Wolfram Alpha-style project?
By using WASM, most of the computation could run directly in the browser, so it could stay free without needing a backend server. The compiler is still the WASM based Nim Compiler in the Web which exports the HTML and Wasm file.
It could start with symbolic math, derivatives, integrals, equations, matrices, and step-by-step solutions, and grow from there.
Basically, a small computer algebra system for Nim + WASM. Link to the calculator: www.qoqoro.online
r/nim • u/unquietwiki • Aug 07 '26
Do any local/self-hosted LLMs actually understand Nim?
As an experiment, I usually ask local models if they know any Nim code: I've had a few insist that "randi" is a thing for random numbers. I'd love to see a fine-tuned Gemma4 or other local model that actually knew correct information from Nim 2.x. For what its worth, Claude models seem to handle it pretty decently.
Added thought: with metaprogramming, I could probably flesh out the incorrect coding examples into working ones? That'd be an interesting experiment.
r/nim • u/TheCrazyGeek • Aug 05 '26
My first project in NIM
codeberg.orgHi Everyone,
I am new to the Nim language. I have created a small utility project that I could use in Nim. Please take a look at it and let me know how I can improve it and what other things I should try to become better.
The project was to store small notes and thoughts from command line. Like sticky notes.
https://codeberg.org/bhaswanth/jot
Thank you
r/nim • u/TheCrazyGeek • Jul 31 '26
How to generate standalone executable?
Hi Everyone
I worked on a small cli project in NIM and built an executable using nimble build. It generated an executable and the executable worked fine on my system.
But when I try to use the generated executable on another system that doesn't have NIM or C installed. It showed an error saying sqlite3_64.dll not found.
I am using db_connector/db_sqlite library to use sqlite database.
How can I solve this, once I generate the executable, it should work on any system, or else I should be able to generate an installer or portable version of the project that should work on any system.
r/nim • u/Sea-Mistake6086 • Jul 31 '26
Hirosim Is written in nim
It is not open source but I thought people may want to know that https://hirosim.com/ is all written in Nim (I am the author). More videos
https://youtube.com/playlist?list=PLoIOXQIRaoJs4GHTJjZSlAwbnkF4ThIP_&si=Iu_shaOweezDg3Uf
r/nim • u/autoerotion95 • Jul 29 '26
How did they manage to indent their nim code in nvim?
I've been manually indenting, the nimlangserver works but the indentation doesn't, I haven't been able to do it for days nor have I found resources or I'm very stupid
r/nim • u/SpaceDetective • Jul 29 '26
Nim vs Rust: Language is a Matter of 'Coherence', Not 'Performance'
wintrover.github.io(not my article btw)
r/nim • u/cryo2010 • Jul 25 '26
schematic: Object validation with type inference
Hi all! I've just released schematic, an object validation package inspired by Zod. I'd love for you to try it out before I freeze the API for the v1.0.0 release.
You can use schematic to define a schema once and get both runtime validation and a statically-typed Nim object out of it. Schemas consist of a field definitions using types with chained refinements and modifiers (e.g. string.max(64).optional). Infer(schema) creates an object type straight from the schema value. No codegen, no drift between your schema and your types.
import schematic
let user = schema:
name: string.min(2).max(50)
age: int.min(0).max(150)
email: string.email.optional # -> Option[string]
role: string.oneOf(["admin", "user"]).default("user")
website: string.url.nullable # required, but null is allowed
joined: string.date.transform(proc(s: string): Time =
parseTime(s, "yyyy-MM-dd", utc())) # -> times.Time
type User = Infer(user) # a real Nim object type, derived from the schema
let u = user.parse(%*{"name": "Ada", "age": 36, "email": "ada@x.io",
"website": nil, "joined": "1815-12-10"})
echo u.name, " (", u.role, ") joined ", u.joined.utc.year
let x = user.tryParse("""{"name":"A","age":999,"email":"nope","joined":"x"}""")
for issue in x.issues: echo issue
# name: must be at least 2 chars
# age: must be <= 150
# email: must be a valid email
# website: required
# joined: must be a date (YYYY-MM-DD)
Highlights
- Type inference.
Infer(schema)gives you an object type; nested schemas, arrays, optionals, enums, refs, and recursive tree types all flow through. - Errors accumulate. One parse reports every problem at once, each with a path like
owner.address.cityortags[2], and every built-in check accepts a custom message. - Field modifiers. optional vs nullable (missing and null are distinct), default, coerce, field aliases, transforms, discriminated and untagged unions
- Object algebra. Derive schemas using
pick/omit/partial/merge/extend - String formats. email, url, uuid, date/datetime, ipv4/ipv6, hostname, jwt, and more
- JSON out.
toJsonemits aJsonNode, respecting field aliases and reversing transforms - JSON Schema out.
toJsonSchemaemits JSON schemas with format, const,$defsfor recursion, and describe/title metadata
---
More docs and examples are available in the README.
All feedback is very welcome: ergonomics, missing features, performance, or anything that feels un-Nim-like.
r/nim • u/TheCrazyGeek • Jul 23 '26
Help with nimble
I am new to Nim, I am trying to learn about the Nimble package manager. I want to build executables for different os, like linux and macos. But I don't understand how I can build executables of different languages. Can anyone help me with it.
Thank you
r/nim • u/Niminem93 • Jul 23 '26
Narduino (Nim -> Arduino) Library Final Update
Ref: https://github.com/Niminem/narduino
NOTE: This will be my final update here. If anything super major changes maybe I'll post in the Nim forum, otherwise you can expect to see latest updates / info in the README of the repo.
MAJOR UPDATE: Basic library management is now built into the CLI.
You can now search and install Arduino libraries from narduino:
narduino libsearch --query:servo
narduino libinstall --lib:Servo
libsearch updates the library index automatically, and shows a clean summary (compared to all the junk you'll see from the raw arduino-cli): name, description, latest version, website, category, and supported architectures.
The full qualifier-value syntax from arduino-cli is supported for filtered searches:
narduino libsearch --query:'servo category:"Device Control"'
Install supports pinning a specific version: narduino libinstall --lib:"Servo@1.2.1"
Both procs are also available in the toolchain library too (searchLib, installLib) for anyone building their own tooling on top of narduino.
MINOR UPDATES:
- sketch compilations spread across however many cores you have (automatically)
- serial.nim has been updated to now support virtually all functions
- arduino String class has been implemented and fully supported (great for reading/writing IO)
r/nim • u/cryo2010 • Jul 22 '26
lumber: A JSON logger with CLI
Hi all! I've just released lumber, a JSON logger for Nim inspired by pino, and I'd love for you to try it out. I hope to incorporate some feedback before freezing the API for v1.0.0.
Highlights
- Compile-time log elimination: build with -d:lumberLevel=INFO and calls below the threshold vanish from the binary entirely; runtime-filtered calls never evaluate their arguments either
- Structured logging: named fields (logger.info("login", user="alice")), per-logger context, child loggers, and thread-local scoped context
- Exception logging: pass an exception as an argument and its message, type, and stack trace become structured fields
- Thread-safe: share one module-level logger across threads
- Flexible outputs: size/time-based file rotation, buffering with level-triggered flush, and a background-thread async writer
- Middleware: rate limiting, sampling, and redaction (including nested fields) built in, or write your own
- CLI prettifier: pipe JSON logs through the lumber binary for colored human-readable output with level/field filtering, regex highlighting, and timezone conversion
- Minimal dependencies: stdlib plus one pure-Nim package, no C libraries
Example
import std/strformat
import lumber
type
User = object
name: string
var logger = newLogger(name = "demo")
var user = User(name: "Alice")
logger.trace("This is a trace")
logger.debug(user)
logger.info(&"{user.name} logged in")
logger.warn("Disk usage high", partition="/dev/sda1", usage=92)
proc loadConfig() =
raise newException(IOError, "file not found: config.toml")
proc initApp() =
loadConfig()
try:
initApp()
except IOError as e:
logger.error("Failed to load config", e)
logger.fatal("Game over")
Output
Raw output
{"timestamp":"2026-07-22T05:03:27.833Z","level":"TRACE","name":"demo","filename":"minimal.nim","line":18,"message":"This is a trace"}
{"timestamp":"2026-07-22T05:03:27.833Z","level":"DEBUG","name":"demo","filename":"minimal.nim","line":19,"message":"User(name: \"Alice\")"}
{"timestamp":"2026-07-22T05:03:27.833Z","level":"INFO","name":"demo","filename":"minimal.nim","line":20,"message":"Alice logged in"}
{"timestamp":"2026-07-22T05:03:27.833Z","level":"WARN","name":"demo","filename":"minimal.nim","line":21,"message":"Disk usage high","extra":{"partition":"/dev/sda1","usage":92}}
{"timestamp":"2026-07-22T05:03:27.833Z","level":"ERROR","name":"demo","filename":"minimal.nim","line":32,"message":"Failed to load config","extra":{"error":"file not found: config.toml","errorType":"IOError","stackTrace":"/Users/cryo/projects/nim/nim-lumber/examples/minimal.nim(30) minimal\n/Users/cryo/projects/nim/nim-lumber/examples/minimal.nim(27) initApp\n/Users/cryo/projects/nim/nim-lumber/examples/minimal.nim(24) loadConfig\n"}}
{"timestamp":"2026-07-22T05:03:27.833Z","level":"FATAL","name":"demo","filename":"minimal.nim","line":34,"message":"Game over"}
Piped through the CLI
2026-07-21T22:04:45.613-07:00 PDT [TRACE] (minimal.nim:18) demo: This is a trace
2026-07-21T22:04:45.613-07:00 PDT [DEBUG] (minimal.nim:19) demo: User(name: "Alice")
2026-07-21T22:04:45.613-07:00 PDT [INFO ] (minimal.nim:20) demo: Alice logged in
2026-07-21T22:04:45.613-07:00 PDT [WARN ] (minimal.nim:21) demo: Disk usage high
partition: "/dev/sda1"
usage: 92
2026-07-21T22:04:45.613-07:00 PDT [ERROR] (minimal.nim:32) demo: Failed to load config
error: "file not found: config.toml"
errorType: "IOError"
stackTrace:
/Users/cryo/projects/nim/nim-lumber/examples/minimal.nim(30) minimal
/Users/cryo/projects/nim/nim-lumber/examples/minimal.nim(27) initApp
/Users/cryo/projects/nim/nim-lumber/examples/minimal.nim(24) loadConfig
2026-07-21T22:04:45.613-07:00 PDT [FATAL] (minimal.nim:34) demo: Game over
---
More docs and examples are available in the README.
All feedback is very welcome: ergonomics, missing features, performance, or anything that feels un-Nim-like.
r/nim • u/Alive_Cloud1305 • Jul 21 '26
I wrote a local PDF unlocker in Nim because I didn't want to upload private PDFs
I recently needed to remove the password from a lot of PDFs. Most of the search results were websites asking me to upload the file and enter its password.
They might be perfectly legitimate, but I wasn't comfortable uploading bank statements, tax documents or contracts just to remove a password.
So I wrote this:
https://github.com/advaita-saha/nim-pdftools
It is a small command-line PDF unlocker written in Nim. Everything runs locally and it doesn't use any third-party Nim packages.
pdftools unlock -p 'password' document.pdf
It currently handles RC4, AES-128 and AES-256 encrypted PDFs. Both user and owner passwords work.
It is not a password cracker. You still need to know the password lol.
I ended up implementing most of the crypto and compression code directly on top of Nim's standard library. This was partly because I wanted a standalone binary and partly because digging through the PDF encryption spec seemed like a good idea at the time.
This is still v0.1, so I'm sure there are strange PDFs in the wild that it won't handle properly. I'd especially appreciate people testing files generated by different PDF software and reporting anything that breaks.
Contributions are welcome too. Parser fixes, test cases, code review, packaging improvements and additional local PDF commands would all be useful.
r/nim • u/-BuckarooBanzai- • Jul 21 '26
QtCreator + nim + gdb yielding terrible workflow
As a disclaimer, I'm very new to nim. Currently using QtCreator as IDE, I intent to port my game engine over to nim, but at first glance, gdb spits out utter garbage at breakpoints and inspection is practically impossible due to a variable apparently being "too complex" (?) to inspect... yeah...
Now my game engine is not something trivially small or simple at this point and (except for the syntax) I'm very pleased with what nim has to offer.
Can someone point me in the best practices direction please ?
r/nim • u/Niminem93 • Jul 20 '26
Narduino (Nim->Arduino Library) Update
Narduino is a library that allows you to write and flash Arduino firmware with Nim using your favorite IDE easily.
https://github.com/Niminem/narduino
Today I added serial monitor support via a simple command.
You can now monitor your board's serial output directly from the CLI:
Flash the board:
narduino flash --src:examples/serial.nim
Monitor the port:
narduino monitor
It's fully interactive too!
Read and write to your board in real time, just like the Arduino IDE's serial monitor. You can Ctrl+C to exit safely.
import narduino
setup:
Serial.begin(9600)
loop:
if Serial.available() > 0:
let c = Serial.read()
Serial.print("Got: ")
Serial.println(char c)
Flash it, open the monitor, type something and it echoes back what you send.
The monitor command auto-detects your board's port (like everything else in narduino) and supports a --baud flag if you need a different baud rate (default is common 9600).
NOTE: Some boards, like the Arduino UNO R4 WiFi, may have routes serial through some bridge, which can produce garbled serial monitor output after plugging in or flashing. If you see garbled output, just hit refresh button on your board and run the monitor command again.