I updated my libclip library (https://github.com/jabbalaci/libclip) a bit. Supported platforms: Linux, Windows, MacOS and FreeBSD.
Its usage is very simple. After importing libclip/clipboard, you get two functions:
# copy text to clipboard
proc setClipboardText(text: string): bool
# read text from clipboard
proc getClipboardText(): string