summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorAlexis Hildebrandt <afh@surryhill.net>2022-07-05 12:07:47 +0200
committerMartin Michlmayr <tbm@cyrius.com>2022-07-08 07:31:14 +0800
commit98f4915f1a203a2af05cfe995ad62a5b995a3cf7 (patch)
tree89a88880054bdaeb1268978ae68e0ce14aec62e4 /flake.nix
parent04d64fafbc53c745f28f5ea4715488d07b6332c2 (diff)
downloadfork-ledger-98f4915f1a203a2af05cfe995ad62a5b995a3cf7.tar.gz
fork-ledger-98f4915f1a203a2af05cfe995ad62a5b995a3cf7.tar.bz2
fork-ledger-98f4915f1a203a2af05cfe995ad62a5b995a3cf7.zip
Add usePython option to flake.nix
to toggle building ledger's Python bindings.
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix18
1 files changed, 15 insertions, 3 deletions
diff --git a/flake.nix b/flake.nix
index cc93053d..86e26ae9 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,6 +2,7 @@
description = "A double-entry accounting system with a command-line reporting interface";
outputs = { self, nixpkgs }: let
+ usePython = false;
useGpgme = true;
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
@@ -19,16 +20,27 @@
nativeBuildInputs = with pkgs; [ cmake ];
buildInputs = with pkgs; [
- boost gmp mpfr libedit python3 texinfo gnused
- ] ++ pkgs.lib.optional useGpgme gpgme;
+ (boost.override { enablePython = usePython; python = python3; })
+ gmp mpfr libedit texinfo gnused
+ ]
+ ++ pkgs.lib.optional usePython python3
+ ++ pkgs.lib.optional useGpgme gpgme;
enableParallelBuilding = true;
cmakeFlags = [
"-DCMAKE_INSTALL_LIBDIR=lib"
- (pkgs.lib.optionalString useGpgme "-DUSE_GPGME=1")
+ (pkgs.lib.optionalString usePython "-DUSE_PYTHON:BOOL=ON")
+ (pkgs.lib.optionalString useGpgme "-DUSE_GPGME:BOOL=ON")
];
+ # by default, it will query the python interpreter for it's sitepackages location
+ # however, that would write to a different nixstore path, pass our own sitePackages location
+ prePatch = pkgs.lib.optionalString usePython ''
+ substituteInPlace src/CMakeLists.txt \
+ --replace 'DESTINATION ''${Python_SITEARCH}' 'DESTINATION "lib/${pkgs.python3.sitePackages}"'
+ '';
+
checkPhase = ''
export LD_LIBRARY_PATH=$PWD
export DYLD_LIBRARY_PATH=$PWD