29 stdenv.mkDerivation rec {
33 # raw source code doesn't work out of box; fetchFromGitHub not usable
35 url = "https://github.com/Gnucash/gnucash/releases/download/${version}/gnucash-${version}.tar.bz2";
36 hash = "sha256-tLQsYmNQ8+effKHyFzVFzGPd7hrd8kYLGh8iIhvyG9E=";
64 ++ (with perlPackages; [
71 # this patch disables test-gnc-timezone and test-gnc-datetime which fail due to nix datetime challenges
72 ./0001-disable-date-and-time-tests.patch
73 # this patch prevents the building of gnc-fq-update, a utility which updates the GnuCash cli utils
74 ./0002-disable-gnc-fq-update.patch
75 # this patch prevents the building of gnucash-valgrind
76 ./0003-remove-valgrind.patch
77 # this patch makes gnucash exec the Finance::Quote wrapper directly
78 ./0004-exec-fq-wrapper.patch
81 # this needs to be an environment variable and not a cmake flag to suppress
83 env.GUILE_AUTO_COMPILE = "0";
85 env.NIX_CFLAGS_COMPILE = toString (lib.optionals (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12") [
86 # Needed with GCC 12 but breaks on darwin (with clang) or older gcc
87 "-Wno-error=use-after-free"
91 enableParallelChecking = true;
92 checkTarget = "check";
94 passthru.docs = stdenv.mkDerivation {
95 pname = "gnucash-docs";
98 src = fetchFromGitHub {
100 repo = "gnucash-docs";
102 hash = "sha256-rQZoau466Bi/YpPj1XpSsm67FgTYhiMfZfogTtn+m1k=";
105 nativeBuildInputs = [ cmake ];
106 buildInputs = [ libxml2 libxslt ];
112 --prefix XDG_DATA_DIRS : ${passthru.docs}/share
113 # db drivers location
114 --set GNC_DBD_DIR ${libdbiDrivers}/lib/dbd
115 # gsettings schema location on Nix
116 --set GSETTINGS_SCHEMA_DIR ${glib.makeSchemaPath "$out" "gnucash-${version}"}
120 # wrapGAppsHook would wrap all binaries including the cli utils which need
122 dontWrapGApps = true;
124 # gnucash is wrapped using the args constructed for wrapGAppsHook.
125 # gnc-fq-* are cli utils written in Perl hence the extra wrapping
127 wrapProgram $out/bin/gnucash "''${gappsWrapperArgs[@]}"
128 wrapProgram $out/bin/gnucash-cli "''${gappsWrapperArgs[@]}"
130 wrapProgram $out/bin/finance-quote-wrapper \
131 --prefix PERL5LIB : "${with perlPackages; makeFullPerlPath [ JSONParse FinanceQuote ]}"
134 passthru.updateScript = ./update.sh;
137 homepage = "https://www.gnucash.org/";
138 description = "Free software for double entry accounting";
140 GnuCash is personal and small-business financial-accounting software,
141 freely licensed under the GNU GPL and available for GNU/Linux, BSD,
142 Solaris, Mac OS X and Microsoft Windows.
144 Designed to be easy to use, yet powerful and flexible, GnuCash allows you
145 to track bank accounts, stocks, income and expenses. As quick and
146 intuitive to use as a checkbook register, it is based on professional
147 accounting principles to ensure balanced books and accurate reports.
149 Some interesting features:
151 - Double-Entry Accounting
152 - Stock/Bond/Mutual Fund Accounts
153 - Small-Business Accounting
155 - QIF/OFX/HBCI Import, Transaction Matching
156 - Scheduled Transactions
157 - Financial Calculations
159 license = licenses.gpl2Plus;
160 maintainers = with maintainers; [ domenkozar AndersonTorres rski nevivurn ];
161 platforms = platforms.unix;
162 mainProgram = "gnucash";
165 # TODO: investigate Darwin support