r/nim • • 21h ago

2D GameDev in Nim

26 Upvotes

Hey everyone!

I'm a Nim beginner, and I'd like to try making a 2D game in Nim, probably something along the lines of Beneath a Steel Sky. I have absolutely no game development experience, though. It's just something I want to try for fun.

I'm currently working on a web app in Nim. Once that's done, I'd like to move on to a simple game project.

I recently experimented with TIGR for graphics and miniaudio for sound in a small 2D demo (the .exe file is just 999KB). Just a PNG background and a simple sprite, nothing fancy, but everything worked nicely, including the audio. So I'm thinking of sticking with those two and maybe making a little cyberpunk-style game.

I'm curious, what lightweight GUI libraries or frameworks do you guys use for 2D game development in Nim?

Would love to hear your suggestions!


r/nim • • 2d ago

What web server to use for personal use?

10 Upvotes

I was going to use Jester, it seemed like a safe choice for a simple static website that's going to be my personal blog, using htmlgen or html-dsl for templating. I'd be using raw CSS and vanilla JS to fill in reactive holes already, so I didn't need anything super complicated.

But because of the main Jester package being outdated, and not working recent Nim versions, I started looking around. In the reply chain of an issue in the Jester repository, it was suggested to use Mummy. Mummy looks like a great project, and while I had questions about how big a "big file" was, and whether it'd cause the server to slow, or outright fail, it appears that the maintainer has straight-up quit programming. Which is a shame.

Coming here, I also see that big version leap to 3 is in the works as well. So I'm wondering if anyone here has a personal site using some Nim server packages, and what do they use? Mummy, or a jester fork? Basolato is "based on Jester" but seems more complicated. Basolato, Supranim, and Happyx all accommodate this group in my mind that are shooting to be more of Laravel/ASP.NET type frameworks. Which isn't bad, its just that I had just gotten into the idea/mindset of trying to start simple and add complexity when-needed, rather than trying to deal with it all at once. Maybe I'd be better off using something like Basolato in the long run, but also in this ecosystem state where I don't trust things to keep being maintained, I think I'd rather keep dependencies small, and own more of the project.

Which I guess is the argument for just doubling down with a Jester fork or Mummy. Just wondering if there's other people in a similar boat, and what they're doing.


r/nim • • 4d ago

Carne - JS Runtime with Nim + JavaScriptCore

Post image
56 Upvotes

Carne (/kär-nē/). An experimental JS runtime built with Nim + JavaScriptCore. At the moment, it runs on linux & mac (prebuilt binaries are available in /releases). The further I get with my projects and experiments, the harder it is for me to look at the node_modules folders in my Finder. So... :))

Note that JSCore is a runtime dependency, which makes the Carne binary around 7MB. Some things are faster in pure JS, so carne std init is necessary for initializing JS-based libs.

Of course, it wouldn't be complete without... Concarne! An Express-like web framework for Carne, lol!

WIP documentation here: https://getcarne.github.io/docs/. More examples here

Not really interesting, but JSCore's JIT is damn fast. Carne got compiled with --mm:orc and -d:release, with no other optimizations. it does an excellent job!

Benchmarkcarnenodebun
fib_recursive42.4 ms ± 0.5 ms85.1 ms ± 1.1 ms45.5 ms ± 1.0 ms
nested_loops9.3 ms ± 0.4 ms36.3 ms ± 0.7 ms11.9 ms ± 0.4 ms
prime_sieve9.2 ms ± 0.3 ms35.0 ms ± 0.5 ms11.7 ms ± 0.3 ms
string_concat9.4 ms ± 0.3 ms34.5 ms ± 0.5 ms11.7 ms ± 0.7 ms
tail_recursive9.7 ms ± 0.3 msCRASHED11.8 ms ± 0.3 ms
range_sum38.4 ms ± 0.4 ms43.8 ms ± 0.4 ms19.6 ms ± 0.3 ms
collatz51.1 ms ± 0.4 ms69.5 ms ± 0.7 ms53.4 ms ± 2.3 ms
array_sum14.6 ms ± 0.5 ms40.7 ms ± 0.9 ms16.8 ms ± 0.3 ms
bubble_sort11.8 ms ± 0.3 ms36.7 ms ± 0.4 ms14.5 ms ± 0.3 ms
object_access11.3 ms ± 0.3 ms36.9 ms ± 0.4 ms14.0 ms ± 0.3 ms
float_math12.9 ms ± 0.3 ms39.1 ms ± 1.0 ms16.5 ms ± 0.4 ms
call_overhead10.4 ms ± 0.2 ms35.5 ms ± 0.4 ms12.5 ms ± 0.3 ms
fizzbuzz_count43.8 ms ± 0.4 ms64.8 ms ± 0.6 ms38.3 ms ± 0.4 ms

HTTP "Hello, world" benchmark using wrk:

RuntimeRequests/secAvg latencyMax RSS
carne91330.441.15ms10.9 MB
carne-workers144029.68739.70us28.3 MB
node38576.692.71ms61.5 MB
bun86878.461.15ms31.1 MB

Have fun!


r/nim • • 9d ago

Best Way to Learn Nimony/Nim 3

24 Upvotes

No Nim experience.

Seeing that Nim 3 is different than Nim2, should I start with Nim 2, or a Nim 2 book, or should I just start messing around with things?

Congratulations to the team on 0.62! It looks like this will truly be a good language.

Thanks.

EDIT: I am just going to take this as kind of an obvious question. It looks like most of the syntax is shared, and especially if one is learning the language for the first time, then you will not be getting so deep into it that it makes such a huge difference initially.

This page lists the differences between Nimony (Nim 3) and Nim 2 so far.

Not a list of specific syntax differences. The syntax is largely the same between the two.


r/nim • • 10d ago

mq-bridge: streams and more for Nim

10 Upvotes

I wrote mq-bridge some time ago and now added Nim support. It supports Kafka, NATS, GRPC, RabbitMQ, ZMQ, SQL, MongoDB, HTTP, files (JSON, CSV, Parquet) and much more via simple YAML/JSON configuration. A http server is just a few lines. Data can be aggregated from DBs, REST and even ONNX. Plugins add more than 100 connectors.

Nim support is still fresh and it may not support embedded devices or rare CPUs.

I added some Nim examples with uses cases in the repo:

https://github.com/marcomq/mq-bridge/tree/main/bindings/nim/examples


r/nim • • 14d ago

I made a Concurrency lib in Nim using macro and it perform on par with the Goroutine has many features and is easy to use than you can think.

29 Upvotes

https://github.com/ghazalialshafi/stagelane

Our lib perform on par with many famous concurrency libs, and it is much easier for using.

I was always inspired by the macro power Nim has and learnt them along with Nim because I don't want to lose such valuable resource, recently after my Nimcsp project was not that famous (as it was linux and x86 only) through it perform well on benchmark I thought of making something which can support cross platform.

And inspired by Nimony CPS and reading discussions I thought of making a complete more features rich CPS based Concurrency lib for Nim that make it very easy and also gives great performance. I have earlier used anf and cps also even before Nimony passive came, infact our this lib merges both anf and cps.

Initially I don't get good results and thought of stopping but as soon as I get free time I developed better architecture and more faster, over a period I got performance even better than goroutine.

The part that I thought of making much more better for the lib was additional features and more things that are missing in general libs and Nimony too. So Everything like  Tasks, timers, timeouts, channels, select, mutexes, semaphores, TCP, and a thread pool for multi-core and for offloading blocking code all comes in the lib You can check the demos.

The lib works in Arc too and need only atomicarc only for pool not if you don't use it.

Overall I now use it in my own projects mostly I don't know why but our this lib was also not well received in Nim community I think probably because Nimony itself will have cps so who will use it that might be the reason, but overall I think till Nimony come this our lib will be useful. And also it provides educational value. (Btw engineering behind it is not something simple and it required spending a lot of time than I thought to archive it)

If anyone find it interesting or want something like Nimony passive n Nim 2 or were looking for it : I have posted it here as someone might find it useful besides me.

Good place to start :

https://github.com/ghazalialshafi/stagelane/blob/main/docs/guide.md

https://github.com/ghazalialshafi/stagelane/tree/main/demos

Thanks for taking your time.


r/nim • • 17d ago

Nim version 2.4.0 released

Thumbnail
nim-lang.org
81 Upvotes

r/nim • • 18d ago

Introducing Nim Pro: Nim development in JetBrains IDEs, with native debugging and macro exploration

Thumbnail
gallery
41 Upvotes

Hi all, I'm introducing Nim Pro, plugin for JetBrains IDEs 2026.2.

The goal is to keep everyday Nim work in the IDE, from configuring a toolchain to stepping through a native program.

Highlights include:

  • Semantic highlighting, completion, inspections and code navigation.

  • Refactoring previews and compiler validation for supported transformations.

  • Native debugging with watches and dedicated Nim type rendering.

  • Compiler macro and ARC expansion explorer.

  • Nimble dashboard, multiple toolchains and managed onboarding.

  • Individual-test Run/Debug actions and nimpretty formatting.

Compiler assistance uses nimlangserver through Red Hat LSP4IJ, alongside native IntelliJ language features.

Nim Pro is a commercial plugin, and you can find Nim Pro on the JetBrains Marketplace

Happy to hear feedback, bugs, suggestions, etc, I've built several other language plugins, like Swift, Mojo, Nix, and keen on supporting Nim as well.


r/nim • • 17d ago

AI Workflows With Your Nim Projects

0 Upvotes

Curious- what sorts of workflows do you guys have when building your Nim projects with AI assistance? I just left Cursor after a year or so of working with it, and picked up Claude code. I found things mostly the same but had to get creative in some areas. Example I noticed Claude eats up WAY more tokens in the beginning of a conversation than Cursor did and seems I may have to rely on autocompact rather than my "handoff" strategy I used with Cursor.


r/nim • • 19d ago

argumint: a CLI arg parsing library

Thumbnail
github.com
9 Upvotes

Hi, all. I've released argumint, a command-line argument parsing library. I know there are a lot of these floating around, but this one is special. It takes a docopt-like usage string and compiles it into an FSM that allows it to walk the grammar with backtracking. This allows grammar patterns that docopt fails at (such as cp's <src>... <dest>). Args are declared on a plain nim tuple that holds the parsed data, and the args can be implicitly converted into their values.

Quickstart Example

import std/strformat
import argumint

let
  spec = (
    src: args("<src>", help = "The source file(s) to copy"),
    dest: arg("<dest>", help = "The destination to copy to"),
    recursive: flag("-r, --recursive", help = "Whether to recurse into subdirectories"),
    help: help()
  )

spec.parseOrQuit(usage = "[-r] <src>... <dest>", prolog = "Copy files around")
for file in spec.src:
  echo fmt"Copying {file} to {spec.dest} (recursive: {spec.recursive})"

Used as follows:

$ ./cp -r foo.txt bar.txt dest/
Copying foo.txt to dest/ (recursive: true)
Copying bar.txt to dest/ (recursive: true)
$ ./cp foo.txt Parsing error:
  - missing argument: <dest>

Usage:
  cp [-r] <src>... <dest>
  cp (-h | --help)
$ ./cp --help
Copy files around

Usage:
  cp [-r] <src>... <dest>
  cp (-h | --help)

Arguments:
  <src>            The source file(s) to copy
  <dest>           The destination to copy to

Options:
  -r, --recursive  Whether to recurse into subdirectories
  -h, --help       Display this help message

Key Features

  • Usage strings that parse: optional, repeated, and alternative arguments, several usage lines, [options] for every option you don't name, and an end of options marker, all written the way you'd write them in help. Arguments, options, and commands mix freely.

  • Familiar syntax: long (--file) and short (-f) options, combined short options (-vx for -v -x), and every common way to attach a value: -f file, -ffile, -f=file, -f:file, --file file, --file=file, and --file:file.

  • Typed values: string, bool, char, enums, every integer and float type, and range types like Natural out of the box. You can easily add your own types with a converter.

  • Validators: limit a value to a set of choices or a range, or write your own check, and combine them with all and any. Help lists each limit for you.

  • Flags that do more than switch on: count how often a flag is given, step through an enum, or give several names to one value, each setting it, adding to it, or running your own code on it. A clamp keeps the result in bounds.

  • Commands: nested to any depth, each with its own spec and any number of names, and before, action, and after hooks to run your code.

  • Generated help: wrapped to the terminal, with each default, limit, and environment variable listed for you. Sort entries into groups, hide some, and choose a two-column layout or a paragraph layout with room for longer text. It's colored in a terminal and plain elsewhere. Add --version and other messages, or write your own layout.

  • Environment variables and config files: an option or flag can take its value from either when the user doesn't give one, and one variable can hold several values. The command line wins, then the environment, then the config file, then the default. INI and JSON are built in, and you can add your own format. Every value knows where it came from.

  • Helpful errors: each error names the argument that went wrong and suggests the long option or command the user probably meant. By default, a mistyped option is never taken as a value, but a negative number is.

  • Dynamic Shell completion: bash, zsh, and fish completion of commands, options, and choice values, drawn from the same usage strings, so it always agrees with the parser. fish and zsh show each one's help beside it.

History

argumint began as a fork of therapist, with FSM logic ported from mow.cli.

I had been slowly working on it for years, and kept on hitting blockers. I started using Claude in my workflow back in July and overall have been pretty happy with how it has turned out. Claude understands Nim very well; we even found a standard library bug and it was able to help me fix it and contribute a patch upstream. Rather than vibe coding, I've used it in an iterative process and tracked decisions along the way (see the docs/architecture.md and docs/adr/). The code base has grown, both in size and complexity, as the feature set has expanded. The initial commit on the main branch is AI free (except for the CLAUDE.md, which just describes the repo at the outset), if you want to see how things changed.

I'd be happy to hear any feedback or suggestions for improvement.


r/nim • • 25d ago

Nova: Git based package manager (UPDATE)

Thumbnail
gallery
18 Upvotes

Just added rudimentary support for Glaucus Linux. So now you can pull the latest version of apps directly from Github(assuming there's a musl binary in the releases of course).

Installation Instructions

$ wget2 https://github.com/BigMacTaylor/nova/releases/download/v0.0.9-beta.1/nova-linux-musl-amd64.tar.gz

$ tar -xzf ./nova-linux-musl-amd64.tar.gz

$ mv ./nova /usr/bin/nova

$ export PATH="$PATH:/root/.local/bin"

Note: you will have to use experimental flags for Glaucus. Example:

$ nova --no-verify --prefer-musl install aristocratos/btop


r/nim • • 26d ago

Lutra: A Nim-only bare-metal stack for microcontrollers

Thumbnail github.com
25 Upvotes

r/nim • • 28d ago

Nova: a package manager wrapper, with git support built in.

11 Upvotes

Thought id share a tool I made. Its a wrapper around native package managers (apt, dnf, pacman) that lets you install packages directly from github. One of the biggest problems with linux has always been package fragmentation. ie packaging for apt, dnf, appImage, flatpak, or ick snap. But ive never liked sandboxed apps. And with the 'rise of the machines' it makes it incredibly easy to build and package native software. So would it be better for people to get packages directly from the developers(through github, gitlab, etc.) with something like this? Or will we reach a point where everyone just uses agents to create their own custom versions of apps locally? Im curious what people think about it. Or have any better ideas?

Nova Package Manager


r/nim • • 29d ago

I compiler-tested 912 claims in my Nim skills for coding agents: what broke and what it changed

8 Upvotes

I'm planetis-m on GitHub. For a while I've maintained a set of Nim skills for coding agents. This year I tested every statement in them against the compiler, and a few of the findings seem worth sharing on their own.

A moved-from object can segfault. The official destructors manual said =wasMoved only needs to make =destroy a no-op, so setting the data pointer to nil is enough. That passes review, but reusing a moved-from value is legal. If pos and capacity keep their old values, the next write skips the reallocation and writes through the nil pointer. The fix is to reset every field your operations read, and to test reuse of moved-from values, not just destruction. The write-up has the reproducer and two related hook mistakes: Moved-from objects that segfault

The audit. I checked 21 skills against Nim 2.3.1 and Nimony 0.6.3, which came to 912 claims and 690 compiler-run tests. 127 statements needed correcting, some of them mine. The work also turned up Nimony issues #2674 to #2680, which Araq fixed within two days.

A small study. In a pre-registered comparison on four deliberately hard tasks, using a low-cost model and blind runs, 18 of 20 runs passed with the verified skills and 3 of 20 without, at about $0.05 versus $0.21 per solved task. The samples are small, so please read it as an indication rather than proof: Benchmarks

Disclosure. The verified catalog of 18 skills is my own paid product. The subscription pays for keeping it correct: re-testing every claim and fixing the skills when Nim or Nimony changes. It's $120 per year or $15 per month, with a founding price of $96 per year for subscriptions started before 30 November 2026 (site). The public skills at planetis-m/skills stay free under CC BY-NC-SA 4.0, and you can use them today.

Where do coding agents fail most for you in Nim?


r/nim • • 29d ago

My 4-year project: a Nim word processor that runs as a static site (drop it into CodePen/JSFiddle via CDN)

48 Upvotes

In my first post (Nim 2.2.4 compiling entirely in the browser), someone asked whether I was building it for something specific. I said my own word processor, along iwth Lua as the scripting language instead of VBA. It's not a LibreOffice WASM port. I've been building it from scratch for about four years. I just playing with html and javascript, making my own custom XML parser and then moved to HTML Canvas after I see Carota and then I start to use Web Assembly in hope if I can use my own memory allocation methods in text and layout rendering. I hope this will be like Obsidian with community plugins and custom templates.

This is the free word processor: QOQORO Write (previously QNote, you'll still see that name in the GIF).
🔗 Try it. Paste this into any HTML page:

<script src="https://cdn.jsdelivr.net/gh/QOQORO-official/qoqoro-cdn@main/qoqoro.js"></script>
<div id="notes" style="height:100vh"></div>
<script>QOQORO.mount('#notes', { mode: 'editor' });</script>

🔗 BindWeb (the Nim → WASM compiler it's built with): https://github.com/benagastov/bindweb-nim-WASM-compiler

Github for the cdn: https://github.com/QOQORO-official/qoqoro-cdn/
Demo: https://codepen.io/qoqoro/pen/pveVbjL
Some Implemented Features

  1. Floating images and text boxes

  • Images: inline, square wrap, behind or in front of text. Drag one and the text reflows around it, even across page breaks. Crop right on the page.

  • Text boxes: the same wrapping, plus auto-fit size and vertical text (縦書き: kanji and kana stand upright, Latin turns with the column or stands upright too).

  1. Tables Merged cells, column widths, cell padding, borders and fills, and row/column handles for inserting and deleting. Tab moves through cells, and cells keep mixed fonts, sizes and colours.

  2. Scripting with Word's object model Misc → Programs runs Luau (Roblox's typed Lua) against an object model you already know from VBA: ActiveDocument, Selection, Paragraphs, Tables, Font, Content.Find, PageSetup and the wd* constants.

    local doc = ActiveDocument Selection:InsertHeading(Report {doc.Now:sub(1, 10)}, wdStyleHeading2) for i, p in doc.Paragraphs do Selection:TypeText({i}: {p.Text}\n) end

It runs in a sandboxed worker with no DOM, network or file system, and a whole program is one undo step. You can also call it from the embedding page (QOQORO.luau.run(...)) or from a server over HTTP.
Compiling Nim on every Run click was too slow even at 7 s warm, so Luau handles it for now. Probably I will make it use Nim WASM as the scripting language if necessary.

  1. Templates with fill-in variables. Plain JSON with {{variables}}. Template Studio turns each variable into a fill-in box. Nothing in a template ever runs; it's data.

  2. Obsidian-style plugin packs. A ZIP with a manifest.xml that can bundle themes (light and dark), fonts, templates and Luau programs. Example packs: Retro Windows, Pixel C64 (with its own pixel font), Sakura 桜 (haru by day, yozakura at night), plus font, report and writing kits.

  3. Real Word files in and out. .docx import and export. This week it also learned to convert old MathType equations and charts, which Word stores as WMF/EMF and no browser can draw, into crisp SVG, using a small converter written in Nim.

The basics are there too: paged or infinite "blog" layout, live-reflowing columns, floating text boxes that text wraps around across page breaks, tables, equations, pen and stylus drawing, headers and footers, and phone and tablet layouts. Plus a workspace with a vault, whiteboard, PDF viewer and diagram editor.

It's just static files: one <script> tag, GitHub Pages or any CDN. Sync is optional through a server you run yourself, in Nim, Flask or Node.

Next up is Full suite desktop app with the Word Processor, PDF Reader and Diagram Editor, the Diagram Editor is based on mxgraph actually, because I think I already like it and I dont have time to create new one in Nim.


r/nim • • 29d ago

What GUI package do I use?

4 Upvotes

I cannot find a good GUI package. I am kinda terrible at coding a GUI. What GUI package do I start with?


r/nim • • Oct 16 '26

Neel v2.1 (HTML / JS GUI Apps w/ Nim) - Major Update

10 Upvotes

It turns out I wasn't quite done yet. Neel 2.1 is out, and it adds serve mode.

Release notes: https://github.com/Niminem/Neel/releases/tag/v2.1.0

Same app, same code, but instead of opening a browser window, Neel runs as a persistent server for one user, and you open it from whatever device you're on: laptop, phone, whatever. You reach it through an SSH forward, a tunnel, or a reverse proxy. One line changes:

startApp(serve = true, port = 8080, allowedOrigins = @["https://myapp.example.com"])

{.expose.}, neel.foo(), js.foo(), js.wait.foo() all work exactly the same. Neel still binds 127.0.0.1 only; the tunnel or proxy in front of it does the TLS and the login.

What it handles for you:

  • Open it on your phone and the laptop tab gets told "opened on another device" (close code 4000) instead of the two fighting over the session.

  • Pings every 30 s, so Cloudflare and nginx don't kill idle connections.

  • Lock your phone, unlock it, and the page reconnects by itself. If it can't, it waits quietly and tries again when you come back to the tab.

  • Ctrl-C, `SIGTERM`, Ctrl-Break, or closing the console window all shut down cleanly.

  • Auth proxies just work: a Cloudflare Access login redirects back to your app and loads, no 403. Other sites still can't frame it, script it, or open its WebSocket.

  • And `wss:` from my "next up" list last time: behind an HTTPS proxy, the page connects over `wss:` by itself.

2.0 apps compile and behave as before. The only local-mode changes: a displaced tab now reports close code 4000 instead of 1000, and on Windows a second app on a port that's already taken now fails at start, as it already did on macOS and Linux.

This was ABSOLUTELY POUNDED on all three OSes. nimble test, plus a manual checklist of every example, every signal, every reconnect and restart case, run on macOS, Windows, and Linux (Ubuntu). Then for real: an SSH forward from another machine, a cloudflared quick tunnel left idle for 10 minutes, an actual Android phone locked and unlocked, and a real domain behind Cloudflare Tunnel with Access, with the login redirect checked down to the request headers. Anything that broke got fixed, and the fix got pinned with a test.

Seriously I took the second half of the day yesterday and all day today off of work to finish this.

Docs:

Why I wanted this: serve mode turns Neel into a platform for always-on personal tools that live on a home server or a VM and that you reach from anywhere.

Put it on top of Claude Code, or use it together with something like my cursor sdk bridge or even 3code the pure Nim-based coding agent, and you have the pieces for something like OpenClaw or Hermes: a personal agent with a real UI you can open from your phone, all in Nim, zero deps on the Neel side.

Again- enjoy!


r/nim • • Oct 16 '26

Why Nim is the ultimate bridge between Python and C for computer science education (+ my open-source project)

26 Upvotes

Hi everyone!

As a high school student diving deep into systems programming and computer science (coming through CS50x/P/W), I've been thinking a lot about the eternal dilemma in CS education:

  1. Start with Python: Great syntax, but it's a black-box runtime (no memory layout, no pointers).

  2. Start with C/C++: Deep systems control, but a brutal learning curve that scares beginners away.

What if Nim is the ultimate single-language educational bridge?

Nim combines Python's clean, readable syntax with C's raw performance and modern ARC/ORC memory management (no heavy GC pauses, no strict Rust-like borrow checker fights).

To test this idea, I built a small open-source repository comparing Python vs Nim (for syntax/ease) and C vs Nim (for memory management like Linked Lists): 👉 https://github.com/BahaeldinMohhamed/nim-edu-bridge

The Educational Blueprint I imagined:

  • Year 1 (Conceptual): Write clean, readable code to learn core logic effortlessly (like Python).

  • Year 2-3 (Systems): Introduce pointers, value vs reference types, and C interop (.importc).

  • Year 4 (Capstones): Build tools and engines from scratch rather than consuming pre-made frameworks. This is the first time i post something in Reddit

Give me any advice you can give


r/nim • • Oct 14 '26

Another tiny cmd tool his I created

11 Upvotes

After my first project in Nim https://www.reddit.com/r/nim/comments/1w9v7i5/my_first_nim_project_lscd/

I fork it to another cmd tool his https://github.com/kernel1983/his to boost my productivity.

Previously I need to add frequently used cmd alias in my .bashrc, and I dont need to do that anymore in future.

And until recently I start to figure out bash only flush back to .bash_history when the process exit. This caused me hard to find some recently used cmds with ctrl-r in another tmux/byobu window.

I use his (shortcut h) to search in history, that's almost same as ctrl-r honestly. And I use right/left key to add/remove some useful cmds to favorite, which is stored in ~/.his_history

Anyway, I found it useful in my daily work.

Happy to share it here with everyone.


r/nim • • Oct 13 '26

Neel 2.0: HTML/JS GUI apps for Nim, rewritten from scratch

32 Upvotes

https://github.com/Niminem/Neel

Some of you may know Neel. This was my first Nim repository from 2020 when I was first learning it. It was what drove me to move from Python to Nim! It is my child and if you speak ill of it we will have problems (jk).

Neel is a library for making lightweight Electron-like desktop apps: the UI is in HTML/CSS/JS and everything else in Nim.

I just released v2. It is a ground-up rewrite. It is much better- more ergonomic, more capable, more... everything. Especially fun. A lot more fun.

Example, you can mark a Nim proc with {.expose.} pragma and the HTML page can call it as neel.<name>(...) and gets the return value back through a Promise. Register a JS function with neel.expose and Nim calls it as js.<name>(...), or js.wait.<name>(...) when it needs the answer. That's just too f*****g cool man. Neel handles the server, the browser window, the JSON conversion, the errors in between, all that stuff that's a PIA.

The short version of what's new:

  • Return values in both directions (1.x had none). Nim exceptions reach JS as e.name / e.message; JS throws reach Nim as NeelRemoteError.

  • {.expose.} on any top-level proc, in any module. Objects, Option, Table, HashSet, enums, tuples, JsonNode, and default parameter values all convert automatically.

  • Multiple windows, each addressable from Nim (openWindow, closeWindow, windows(), requireWindow(id), hooks).

  • Its own thread-based HTTP/WebSocket server in the spirit of Mummy: one IO thread owns the sockets, a worker pool runs your procs, no async anywhere. Mummy itself is gone.

  • Zero dependencies. Standard library only.

  • Finds Chrome, Chromium, or Edge and opens them in app mode (no tabs, no address bar); falls back to a tab in the default browser when none is installed.

  • Hardened against other websites open in the same browser: per-launch token plus Host / Origin / Sec-Fetch-Site checks, server bound to 127.0.0.1 only.

  • Release builds embed the web folder into the binary, so you ship one file.

Verified on macOS, Windows, and Linux (Ubuntu). Requires Nim >= 2.2.12 (older allocators crash intermittently when memory is freed after the owning thread exits, so Neel refuses to compile on them).

A complete app. The page asks for a directory and Nim picks a random entry from it:

import std/[os, random]
import neel

type
  MissingDirectoryError = object of CatchableError
  EmptyDirectoryError = object of CatchableError

proc filePicker(directory: string): string {.expose.} =
  let dir = absolutePath(directory, root = getHomeDir())
  if not dirExists(dir):
    raise newException(MissingDirectoryError, "no such directory: " & dir)
  var names: seq[string]
  for _, path in walkDir(dir):
    names.add path.extractFilename
  if names.len == 0:
    raise newException(EmptyDirectoryError, "the directory is empty: " & dir)
  var rng = initRand() # exposed procs run on worker threads
  rng.sample(names)

startApp()

And the page side (web/main.js, loaded after <script src="/neel.js">):

try {
  const name = await neel.filePicker(input.value);
  result.textContent = name;
} catch (e) {
  error.textContent = e.name + ": " + e.message;  // ex: "MissingDirectoryError: no such directory: ..."
}

Calling back into the page from Nim works the same way in reverse:

proc askPage(question: string): string {.expose.} =
  let reply = js.wait.answer(question)  # blocks until the page answers
  "the page answered: " & reply.getStr

proc notify(text: string) {.expose.} =
  js.showToast(text)                    # fire-and-forget

neel.expose(async function answer(question) {
  return prompt(question);
});

HOW COOL IS THAT???

Moving on...

nim c -r main.nim for development (assets read from disk, refresh to see changes), nim c -d:release main.nim to ship (assets embedded). Add --app:gui to hide the terminal.

Nothing from 1.x compiles unchanged; the README has the rename table and the guide (docs/GUIDE.md) has every detail: the full type list, error messages, lifecycle, threading model, security, caveats. Three runnable examples in the repo; start with examples/filepicker.

---

Neel started years ago as a port of Python's Eel library (now deprecated), and the 1.x line never really outgrew that: one window, no return values, a block of exposeProcs:, etc. Back in 2023 I rewrote the server with Mummy as the server because of a bunch of async problems but still never addressed some of its shortcomings.

I finally sat down and rewrote the whole thing. The big question was whether to keep an external server library or write one. Mummy had effectively been abandoned (there's a fork, but relying on a fork of an unmaintained dependency for the core of the library didn't sit right), and I'm using Neel for work, so future-proofing it mattered. Writing the server myself also meant Neel controls the threading, the shutdown ordering, and the WebSocket details end to end, which turned out to matter a lot for return values and multiple windows. Mummy is great and the design here is very much borrowed from it: one IO thread, a worker pool, no async. It's just all in the stdlib now, with no deps.

The big thing that ate most of my time was actually the hardening pass. Running all three examples on three OSes, trying to break them, and fixing what broke turned up some fun findings: a refreshed stale tab stealing another window's identity, Edge signing a fresh profile into your Microsoft account and syncing your extensions into the app window, Windows select silently capping you at about 8 windows, an allocator crash that pushed the minimum Nim to 2.2.12, all kinds of stuff. All has been fixed and pinned down with tests.

So this release had a lot of effort put into it. I'm sure you'll find it enjoyable and useful.

I have a few things next on the list: Brave / Opera / Vivaldi discovery (basically any other chromium based browsers), a Webview target (at least for Mac and Linux since Windows is guaranteed to have Edge), custom HTTP routes, and wss:. I will get to them when I can, but issues and PRs welcome of course.

Enjoy!


r/nim • • Oct 11 '26

is nim good at making external dsls

11 Upvotes

can nim convert into aarch64


r/nim • • Oct 06 '26

strip metadata from photos, audios and videos

Thumbnail
github.com
12 Upvotes

I guess we should animate this sub somehow. A simple CLI for removing metadata from files!

usage: striptease <input|input-dir> --out:<dir> [options]

required:
  <input>             file or directory (mixed formats allowed)
  -o, --out:<dir>     output directory for cleaned copies
                      (single file input plus --out:foo.ext writes one file,
                       not needed with --inspect)

supported formats:
  audio: .wav | images: .jpg .jpeg .png .gif .webp
  raw: .cr2 .nef .nrw .arw .srf .dng .rw2 .orf .pef .srw .tif .tiff
  video: .mp4 .mov .m4v .avi .mkv .webm | canon raw: .cr3 | heic: .heic .heif .hif

options:
  --dry-run           report only, write nothing
  --inspect           print metadata as pretty JSON, write nothing
  --verbose           per file kept and dropped chunks plus bytes saved
  --overwrite         overwrite existing files in out dir (default: skip)
  --keep-musical      WAV only: also keep cue, smpl, inst, acid chunks
  -h, --help          show this help
  --version           show version

r/nim • • Oct 06 '26

yet another proxy lib

Thumbnail
github.com
4 Upvotes

i didn't like the lack of proxy libs, so naturally i wrote my own
feel free to contribute.


r/nim • • Oct 01 '26

cursorsdk: Cursor SDK Bridge client for Nim

8 Upvotes

https://github.com/Niminem/cursorsdk

Cursor has an SDK and is what powers both the Cursor CLI and the Cursor editor. It's very powerful and flexible (ex: you can actually control the system prompt, tools, and much more).

At some point not long ago they created an SDK Bridge that allows non-typescript and non-python languages to communicate with it via RPC. Of course I had to write a Nim client for it.

It is fully compliant- built with and tested against their documentation. I did have to add some workarounds for upstream issues, but it's mostly implementation details (all noted in readme).

No deps aside from the nim standard library.

I've tested it on Mac (x64) and Windows (x64). Should work out of the box for Linux but it's untested.

You could build your own harness on top of this and all kinds of automations, scripts, etc. Pretty cool! Enjoy.

Example:

import std/asyncdispatch
import cursorsdk
proc main() {.async.} =
  let client = newClient()                 # CURSOR_API_KEY from env
  defer: waitFor client.close()
  let agent = await client.createAgent("composer-2.5")
  let run = await agent.send("Summarize this repository.")
  while true:
    let chunk = await run.nextText()
    if chunk.isNone: break
    stdout.write chunk.get
  await agent.close()
waitFor main()