# Nim Linux Packaging
## Guidelines
* [Packaging Nim](https://nim-lang.org/docs/packaging.html)
## Current Problems
* ~~The [choosenim AUR package](https://aur.archlinux.org/packages/choosenim) needs Nim to build, but trying to build it with the `extra/nim` package does not work.~~
**Note**: the package now uses the official Nim binary distribution to build, at least on x86_64.
* ~~The [choosenim-bin AUR package](https://aur.archlinux.org/packages/choosenim-bin), which doesn't need Nim to build, is outdated (still at version 0.8.4, using the unmaintained, [outdated upstream repo](https://github.com/dom96/choosenim])).~~
**Note**: the `choosenim-bin` AUR package has been updated now (2024-01-04)
* The `install.sh` script in the official Nim source and binary distribution does not follow the Nim packaging guidelines linked above.
* NimScript assumes `system.nim` lives in `lib` directory (`Error: cannot open '/usr/lib/nim/lib/system.nim'`).
* The [official Arch `extra/nim` package](https://archlinux.org/packages/extra/x86_64/nim/) is broken in several ways:
* It doesn't follow the Nim packaging guidelines linked above (but those do not adhere to the FHS).
* It is missing all the files in the `dist` directory the official Nim binary distribution contains and installs in the `<prefix>/lib/nim` directory.
* Several Nim tools (`nim doc`, `nimsuggest`) assume that some library files live next to the binaries, which isn't the case in an Arch Linux install, which tries to follow the FHS.
**Note:** This is still true for current Nim (2.0.8)
* It [builds from the source archive](https://gitlab.archlinux.org/archlinux/packaging/packages/nim/-/blob/main/PKGBUILD?ref_type=heads#L35), which GitHub automatically creates for release tags. These do not contain all the files, which the official Nim source distribution contains.
* It adds Arch- and x85_64-specific compiler flags to the `nim.cfg` file in the `compiler` module in the Nim installation, which breaks using Nim for cross-compiling using gcc.
* According to packaging guidelines, the Nim package should not ship with the `compiler` package installed. Nim projects requiring the Nim compiler sources can depend on the [nim nimble package](https://nimble.directory/pkg/nim) instead.
* It includes no man page (get it from Debian package?).
### Arch Package Issues
* https://gitlab.archlinux.org/archlinux/packaging/packages/nim/-/issues
### Upstream Issues
* [[nimsuggest] Move files under the lib/ dir to make it usable as a library](https://github.com/nim-lang/Nim/issues/14040)
### Forum Threads
* [Nimsuggest and Manjaro Nim installation](https://forum.nim-lang.org/t/11723)
## General Links
* [Nim source repo on GitHub](https://github.com/nim-lang/Nim)
* [Choosenim source repo on GitHub](https://github.com/nim-lang/choosenim)
* [Nim official Linux binary and source distributions](https://nim-lang.org/install_unix.html)