Developing and Building GnuCash on a new Linux distribution can be be difficult. There are numerous dependencies to install into the current environment, which is not necessarily what you may want into your Linux profile.
Luckily the Nix ecosystem provides a way to temporarily load dependencies (guile, boost, glib etc) for building, allow building, then exit the Nix environment and still run the freshly built GnuCash.
-
Install Nix - guidance available at https://nixos.org/download.html#nix-install-linux
-
Install git. This is a must-have nowadays. And any text editor of your choice.
-
Clone the gnucash repository.
$ git clone https://github.com/Gnucash/gnucash/
-
Copy
shell.nix
into the current folder. -
Run
nix-shell
which loads the packages specified inshell.nix
and creates a child shell with all the required tooling available. The first launch will download all dependencies into/nix/store/
. The space used may be purged withnix-store --gc
. It is not necessary to purge the store. -
Build as required. My build scripts are as follows.
-
After building and installing, you can
exit
the Nix shell, and all dependencies are no longer available.
rebuild.sh:
rm -rf ./{build,install}
mkdir build
cd build
cmake -GNinja -DWITH_AQBANKING=OFF -DWITH_SQL=ON -DWITH_PYTHON=ON -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=../install ../gnucash
and run.sh:
cd build
ninja
ninja install > /dev/null
cd ../install/bin
./gnucash --extra --logto stdout