Issue
Just finished full installation of Nim language to my Debian GNU/linux and feel a bit confused, not finding any development kits or at least console commands to try some scripting... Isn't it supposed to be included into instalation packages?
So I'll be thankfull to any advice how to choose between all aviable IDE or interfaces for coding with Nim on Linux.
Solution
Nim's main entry point is the nim
command. As long as you have that, you can compile and run nim programs all right:
$ cat > test.nim
echo "Hello nim!"
$ nim c -r test.nim
CC: stdlib_io.nim
CC: stdlib_system.nim
CC: test.nim
Hint: [Link]
Hint: 14205 LOC; 1.218 sec; 20.496MiB peakmem; Debug build; proj: /private/tmp/t/test.nim; out: /private/tmp/t/test [SuccessX]
Hint: /private/tmp/t/test [Exec]
Hello nim!
$
You can also embed that as a shebang into an executable hi.nim
file and run it:
#!/usr/bin/env nim c --hints:off -r
echo "Hi nim scripting!"
But you will get a compiled binary without the .nim
extension along the original file, so it's kind of awkward for scripting.
UPDATE: As suggested by @shirleyquirk you can also save .nims
files with a special shebang that will run them as NimScript, which has some limitations compared to normal Nim code but should be fine for most if not all typical scripts.
Answered By - Grzegorz Adam Hankiewicz