Skip to content

Instantly share code, notes, and snippets.

View genotrance's full-sized avatar

genotrance genotrance

View GitHub Profile
@genotrance
genotrance / libvirt.cfg
Created November 8, 2017 08:13
Nimgen config file for libvirt
[n.global]
output = libvirt
filter = libvirt
[n.include]
libvirt/include
[n.exclude]
libvirt-common.h
@genotrance
genotrance / failed.txt
Last active March 20, 2018 16:32
Nimscript ready modules
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
genotrance / next.md
Last active April 6, 2018 17:01
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
@genotrance
genotrance / niminstall.txt
Last active April 30, 2018 15:46
Nim installer idea
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
import math
import macros
import strutils
macro mechoall(): untyped =
var
lval1 = 50.2345
lval2 = 25.1234
lval = ""
@genotrance
genotrance / sha256test.nim
Created August 15, 2018 02:52
sha256test.nim
import os
import sha256/sha256sum
import nimssl/sha
import nimSHA2
import sha3
import sph
import times
import strutils
const MAX_BUFFER* = 8192
@genotrance
genotrance / ui.nim
Created August 17, 2018 19:42
ui.nim
import strutils
const sourcePath = currentSourcePath().split({'\\', '/'})[0..^2].join("/")
{.passC: "-I\"" & sourcePath & "\"".}
{.passC: "-I\"" & sourcePath & "/common\"".}
const headerui = sourcePath & "/ui.h"
{.passC: "-DBUILD_SHARED_LIBS=OFF".}
{.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".}
@genotrance
genotrance / compile.sh
Created February 27, 2019 12:42
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.
@genotrance
genotrance / README.md
Last active March 25, 2019 18:18
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
genotrance / README.md
Last active November 12, 2019 18:34
Nimble RFC for lock file support

The following RFC aims to implement lock file support for Nimble. This is being tracked in issue 127 but this proposal is a simpler variation.

Intro:

  • lock mode will be enabled by a flag in nimble.ini
    • Since it is a new feature, this will reduce impact on the existing user base
    • It can be turned on by default in the future when stable enough
  • Lock information will be stored in $prj/nim.cfg
    • Nimble will append autogenerated section if existing
    • Nimble will update when any dep changes occur
    • Nimble will consume when having to install deps