python3Packages.gnucash: Build from existing gnucash package

This commit is contained in:
polyfloyd
2025-04-07 22:06:26 +02:00
parent ddd5c21343
commit 69f4b7cdd6
2 changed files with 30 additions and 1 deletions
+25 -1
View File
@@ -25,8 +25,12 @@
swig,
webkitgtk_4_0,
wrapGAppsHook3,
python ? null,
enablePython ? false,
}:
assert enablePython -> (python != null);
stdenv.mkDerivation rec {
pname = "gnucash";
version = "5.11";
@@ -45,6 +49,11 @@ stdenv.mkDerivation rec {
pkg-config
];
cmakeFlags = lib.optional enablePython [
"-DWITH_PYTHON=\"ON\""
"-DPYTHON_SYSCONFIG_BUILD=\"$out\""
];
buildInputs =
[
aqbanking
@@ -68,7 +77,8 @@ stdenv.mkDerivation rec {
JSONParse
FinanceQuote
perl
]);
])
++ lib.optional enablePython python;
patches = [
# this patch disables test-gnc-timezone and test-gnc-datetime which fail due to nix datetime challenges
@@ -81,6 +91,20 @@ stdenv.mkDerivation rec {
./0004-exec-fq-wrapper.patch
];
postPatch = ''
patch -p0 <<END_PATCH
+++ bindings/python/__init__.py
@@ -1,3 +1,7 @@
+import os
+os.environ['GNC_DBD_DIR'] = '${libdbiDrivers}/lib/dbd'
+os.environ['GSETTINGS_SCHEMA_DIR'] = '${glib.makeSchemaPath "$out" "gnucash-${version}"}'
+
# import all the symbols from gnucash_core, so basic gnucash stuff can be
# loaded with:
# >>> from gnucash import thingy
END_PATCH
'';
# this needs to be an environment variable and not a cmake flag to suppress
# guile warning
env.GUILE_AUTO_COMPILE = "0";
+5
View File
@@ -5605,6 +5605,11 @@ self: super: with self; {
gntp = callPackage ../development/python-modules/gntp { };
gnucash = toPythonModule (pkgs.gnucash.override {
inherit (self) python;
enablePython = true;
});
gnureadline = callPackage ../development/python-modules/gnureadline { };
go2rtc-client = callPackage ../development/python-modules/go2rtc-client { };