29 stdenv.mkDerivation rec {
33 # raw source code doesn't work out of box; fetchFromGitHub not usable
35 # Upstream uploaded a -1 tarball on the same release, remove on next release
36 url = "https://github.com/Gnucash/gnucash/releases/download/${version}/gnucash-${version}-1.tar.bz2";
37 hash = "sha256-d0EWXW1lLqe0oehJjPQ5pWuBpcyLZTKRpZBU8jYqv8w=";
65 ++ (with perlPackages; [
72 # this patch disables test-gnc-timezone and test-gnc-datetime which fail due to nix datetime challenges
73 ./0001-disable-date-and-time-tests.patch
74 # this patch prevents the building of gnc-fq-update, a utility which updates the GnuCash cli utils
75 ./0002-disable-gnc-fq-update.patch
76 # this patch prevents the building of gnucash-valgrind
77 ./0003-remove-valgrind.patch
78 # this patch makes gnucash exec the Finance::Quote wrapper directly
79 ./0004-exec-fq-wrapper.patch
80 # this patch fixes a test that fails due to a type error, remove on next release
82 name = "0005-utest-gnc-pricedb-fix.patch";
83 url = "https://github.com/Gnucash/gnucash/commit/0bd556c581ac462ca41b3cb533323fc3587051e1.patch";
84 hash = "sha256-k0ANZuOkWrtU4q380oDu/hC9PeGmujF49XEFQ8eCLGM=";
88 # this needs to be an environment variable and not a cmake flag to suppress
90 env.GUILE_AUTO_COMPILE = "0";
92 env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
93 # Needed with GCC 12 but breaks on darwin (with clang) or older gcc
94 "-Wno-error=use-after-free"
98 enableParallelChecking = true;
99 checkTarget = "check";
101 passthru.docs = stdenv.mkDerivation {
102 pname = "gnucash-docs";
105 src = fetchFromGitHub {
107 repo = "gnucash-docs";
109 hash = "sha256-aPxQEcpo8SPv8lPQbxMl1wg8ijH9Rz0oo4K5lp3C/bw=";
112 nativeBuildInputs = [ cmake ];
113 buildInputs = [ libxml2 libxslt ];
119 --prefix XDG_DATA_DIRS : ${passthru.docs}/share
120 # db drivers location
121 --set GNC_DBD_DIR ${libdbiDrivers}/lib/dbd
122 # gsettings schema location on Nix
123 --set GSETTINGS_SCHEMA_DIR ${glib.makeSchemaPath "$out" "gnucash-${version}"}
127 # wrapGAppsHook would wrap all binaries including the cli utils which need
129 dontWrapGApps = true;
131 # gnucash is wrapped using the args constructed for wrapGAppsHook.
132 # gnc-fq-* are cli utils written in Perl hence the extra wrapping
134 wrapProgram $out/bin/gnucash "''${gappsWrapperArgs[@]}"
135 wrapProgram $out/bin/gnucash-cli "''${gappsWrapperArgs[@]}"
137 wrapProgram $out/bin/finance-quote-wrapper \
138 --prefix PERL5LIB : "${with perlPackages; makeFullPerlPath [ JSONParse FinanceQuote ]}"
142 homepage = "https://www.gnucash.org/";
143 description = "Free software for double entry accounting";
145 GnuCash is personal and small-business financial-accounting software,
146 freely licensed under the GNU GPL and available for GNU/Linux, BSD,
147 Solaris, Mac OS X and Microsoft Windows.
149 Designed to be easy to use, yet powerful and flexible, GnuCash allows you
150 to track bank accounts, stocks, income and expenses. As quick and
151 intuitive to use as a checkbook register, it is based on professional
152 accounting principles to ensure balanced books and accurate reports.
154 Some interesting features:
156 - Double-Entry Accounting
157 - Stock/Bond/Mutual Fund Accounts
158 - Small-Business Accounting
160 - QIF/OFX/HBCI Import, Transaction Matching
161 - Scheduled Transactions
162 - Financial Calculations
164 license = licenses.gpl2Plus;
165 maintainers = with maintainers; [ domenkozar AndersonTorres rski nevivurn ];
166 platforms = platforms.unix;
167 mainProgram = "gnucash";
170 # TODO: investigate Darwin support