Skip to content

Instantly share code, notes, and snippets.

genotrance /
Last active Mar 25, 2019
Nimble lock files

Project setup

  • Create project
  • Setup for per project nimbleDir
    • New field in .nimble
    • Nimble anyway generates command line for nim so no change in nim/nim.cfg

Lock file creation workflow

  • Delete project nimbleDir or uninstall specific package
  • Install deps at preferred levels using nimble
    • nimble install abc@version or abc@#hash
genotrance /
Created Feb 27, 2019
Nim Holy Build Box
#! /bin/bash
export SRCFILE=nim-$VERSION.tar.xz
export BINFILE=nim-$VERSION-linux_x$ARCH.tar
echo "Building Nim $VERSION for $ARCH"
set -e
# Activate Holy Build Box environment.
View ui.nim
import strutils
const sourcePath = currentSourcePath().split({'\\', '/'})[0..^2].join("/")
{.passC: "-I\"" & sourcePath & "\"".}
{.passC: "-I\"" & sourcePath & "/common\"".}
const headerui = sourcePath & "/ui.h"
{.passL: "-lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lcomctl32 -ld2d1 -ldwrite -lUxTheme -lusp10 -lgdi32 -luser32 -lkernel32 -lstdc++".}
{.compile: "nimui/common/areaevents.c".}
{.compile: "nimui/common/attribute.c".}
{.compile: "nimui/common/attrlist.c".}
View sha256test.nim
import os
import sha256/sha256sum
import nimssl/sha
import nimSHA2
import sha3
import sph
import times
import strutils
const MAX_BUFFER* = 8192
View vimrc.vim
" Syntax and colors
filetype plugin indent on
syntax on
colorscheme industry
" Tabs
set tabstop=2
set shiftwidth=2
set expandtab
View mecho.nim
import math
import macros
import strutils
macro mechoall(): untyped =
lval1 = 50.2345
lval2 = 25.1234
lval = ""
genotrance / niminstall.txt
Last active Apr 30, 2018
Nim installer idea
View niminstall.txt
Nim GUI installer for Windows
Figure out C/C++ compiler
- Detect compiler presence
- Detect compiler arch
- User chooses correct compiler if multiple detected
- No compiler detected
- User chooses existing compiler location
- Detect compiler arch
- No compiler present
View autodup.nim
import asyncdispatch
import asynctools
import docopt
import json
import nre
import os
import ospaths
import sequtils
import sha256/sha256sum
import strutils
genotrance / failed.txt
Last active Mar 20, 2018
Nimscript ready modules
View failed.txt
Failed nimrtl
lib\nimrtl.nim(28, 10) Error: This file has to be compiled as a library!
Failed coro
lib\pure\coro.nim(23, 12) Error: Coroutines require -d:nimCoroutines
Failed endians
lib\pure\endians.nim(103, 57) Error: undeclared identifier: 'copyMem'
Failed htmlparser
genotrance /
Last active Apr 6, 2018
Nim 1.0 next steps

Trunk-based development

  • Support for multi-version release management
    • Add new {.version: "1.x.x".} pragma for new procs in stdlib, be able to define when added and removed "1.1.0, < 2.0.0"
    • Ship single package with multiple branches enabled - default selected is latest version of oldest supported branch
    • Add nim --list-versions to show users what versions are available (include deprecation status)
    • Add nim --set-version:1.2.0 to configure global nim.cfg or user to manually edit file
  • Ensure all pre-existing v2.0 features behind version block/pragma
  • Fix all "high priority" bugs, "regressions" and "showstoppers" in 1.0.0 code
  • Remove all deprecated symbols and update stdlib accordingly
  • Test all major libs and verify working with 1.0.0 version
You can’t perform that action at this time.