diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2022-07-05 12:07:47 +0200 |
---|---|---|
committer | Martin Michlmayr <tbm@cyrius.com> | 2022-07-08 07:31:14 +0800 |
commit | 98f4915f1a203a2af05cfe995ad62a5b995a3cf7 (patch) | |
tree | 89a88880054bdaeb1268978ae68e0ce14aec62e4 /flake.nix | |
parent | 04d64fafbc53c745f28f5ea4715488d07b6332c2 (diff) | |
download | fork-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.nix | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -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 |