Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaushalmodi/nim_config
Global project-agnostic config.nims
https://github.com/kaushalmodi/nim_config
config nim nimscript
Last synced: 19 days ago
JSON representation
Global project-agnostic config.nims
- Host: GitHub
- URL: https://github.com/kaushalmodi/nim_config
- Owner: kaushalmodi
- License: mit
- Created: 2018-10-16T12:45:27.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-05T17:19:24.000Z (about 2 years ago)
- Last Synced: 2025-01-15T23:40:41.194Z (20 days ago)
- Topics: config, nim, nimscript
- Language: Nim
- Size: 47.9 KB
- Stars: 65
- Watchers: 8
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.org
- License: LICENSE
Awesome Lists containing this project
README
#+title: Global Nim config
#+author: Kaushal ModiThis repo contains my global Nim configuration ~config.nims~ (which I
place in the *$XDG_CONFIG_HOME/nim/* directory.)* Requirement
Needs Nim built from its ~devel~ branch (<2018-10-16 Tue>).
* List available tasks
#+begin_example
nim help
#+end_example
Note that there's no ~--~ before ~help~.That will print:
#+begin_example
installPcre Install PCRE using musl-gcc
installLibreSsl Install LIBRESSL using musl-gcc
installOpenSsl Install OPENSSL using musl-gcc
strip Optimize the binary size using 'strip' utility
upx Optimize the binary size using 'upx' utility
checksums Generate checksums of the binary using 'sha1sum' and 'md5sum'
sign Sign the binary using 'gpg' (armored, ascii)
encrypt Encrypt the binary using 'gpg' (compressed, symmetric, ascii)
musl Build an optimized static binary using musl
glibc25 Build C, dynamically linked to GLibC 2.5 (x86_64)
js2asm Build JS, print Assembly from that JS (performance debug)
c2asm Build C, print Assembly from that C (performance debug)
fmt Run nimpretty on all git-managed .nim files in the current repo
rmfiles Recursively remove all files with the specific extension(s) from the current directory
test Run tests via 'nim doc' (runnableExamples) and tests in tests/ dir
docs Deploy doc html + search index to public/ directory
runc Run equivalent of 'nim c -r ..'
runcpp Run equivalent of 'nim cpp -r ..'
#+end_example
* How to use this
** Use in your local projects
1. Create *$XDG_CONFIG_HOME/nim/* directory if it doesn't already
exist (or *~/.config/nim/* if you don't have ~XDG_CONFIG_HOME~
environment variable set).
2. Download the [[https://github.com/kaushalmodi/nim_config/blob/master/config.nims][config.nims]] and put it in that directory.
** Install using Curl:
#+begin_src bash
mkdir --verbose $XDG_CONFIG_HOME/nim/
curl -o $XDG_CONFIG_HOME/nim/config.nims https://raw.githubusercontent.com/kaushalmodi/nim_config/master/config.nims
#+end_src
** Uninstall:
#+begin_src bash
rm --verbose $XDG_CONFIG_HOME/nim/config.nims
#+end_src
** Use in Travis CI
I use this same file during Nim project builds on Travis CI by
including the below in the ~script:~ phase:
#+begin_example
git clone https://github.com/kaushalmodi/nim_config && cp nim_config/config.nims .
#+end_example- Note :: This will overwrite your project-specific ~config.nims~ (if
any) with the version in this repo. That overwrite happens
only in that Travis workspace, but still understand what the
above command is doing before using it. *** Using the ~test~
and ~docs~ tasks
*** Example use of ~test~ and ~docs~ tasks
#+begin_src yaml
script:
- nim -v
- git clone https://github.com/kaushalmodi/nim_config && cp nim_config/config.nims . # Get my global config.nims
- nim test # The 'test' task is defined in the above retrieved config.nims
- nim docs # The 'docs' task is defined in the above retrieved config.nims
#+end_src
[[https://github.com/kaushalmodi/elnim/blob/8f795c691f80e9d6a4ffe1bafc7892830d4b78ba/.travis.yml#L43-L47][Source]]
*** Example use of ~musl~ task
#+begin_src yaml
script:
- cd "${TRAVIS_BUILD_DIR}" # Ensure that you are in repo/build root now.
- nimble install --depsOnly --accept
- git clone https://github.com/kaushalmodi/nim_config && cp nim_config/config.nims . # Get my global config.nims
- nim musl "${NIMFILE}" # The ${NIMFILE} var is defined further up in that .travis.yml
#+end_src
[[https://github.com/OrgTangle/ntangle/blob/92fcd43569f48b512799ebf563ac4bbef6813795/.travis.yml#L59-L66][Source]]
* References
- [[https://nim-lang.github.io/Nim/nimscript.html][NimScript API]]
- [[https://nim-lang.github.io/Nim/nims.html][*.nims* config]]
- [[https://github.com/kaushalmodi/hello_musl][*musl* task]]