summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix51
1 files changed, 29 insertions, 22 deletions
diff --git a/flake.nix b/flake.nix
index 4be0275c..784f88ad 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,9 +1,10 @@
{
description = "A double-entry accounting system with a command-line reporting interface";
+ nixConfig.bash-prompt = "ledger$ ";
outputs = { self, nixpkgs }: let
- usePython = false;
- useGpgme = true;
+ usePython = true;
+ gpgmeSupport = true;
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
@@ -11,36 +12,43 @@
packages = forAllSystems (system: let
pkgs = nixpkgsFor.${system};
- in {
- ledger = pkgs.stdenv.mkDerivation {
+ in with pkgs; {
+ ledger = stdenv.mkDerivation {
pname = "ledger";
version = "3.3.0-${self.shortRev or "dirty"}";
src = self;
- nativeBuildInputs = with pkgs; [ cmake ];
- buildInputs = with pkgs; [
- (boost.override { enablePython = usePython; python = python3; })
- gmp mpfr libedit texinfo gnused
- ]
- ++ pkgs.lib.optional usePython python3
- ++ pkgs.lib.optional useGpgme gpgme;
+ outputs = [ "out" "dev" ] ++ lib.optionals usePython [ "py" ];
+
+ buildInputs = [
+ gmp mpfr libedit gnused
+ ] ++ lib.optionals gpgmeSupport [
+ gpgme
+ ] ++ (if usePython
+ then [ python3 (boost.override { enablePython = true; python = python3; }) ]
+ else [ boost ]);
+
+ nativeBuildInputs = [ cmake texinfo ];
enableParallelBuilding = true;
cmakeFlags = [
"-DCMAKE_INSTALL_LIBDIR=lib"
- (pkgs.lib.optionalString usePython "-DUSE_PYTHON:BOOL=ON")
- (pkgs.lib.optionalString useGpgme "-DUSE_GPGME:BOOL=ON")
+ "-DBUILD_DOCS:BOOL=ON"
+ "-DUSE_PYTHON:BOOL=${if usePython then "ON" else "OFF"}"
+ "-DUSE_GPGME:BOOL=${if gpgmeSupport then "ON" else "OFF"}"
];
# by default, it will query the python interpreter for its sitepackages location
# however, that would write to a different nixstore path, pass our own sitePackages location
- prePatch = pkgs.lib.optionalString usePython ''
+ prePatch = lib.optionalString usePython ''
substituteInPlace src/CMakeLists.txt \
- --replace 'DESTINATION ''${Python_SITEARCH}' 'DESTINATION "lib/${pkgs.python3.sitePackages}"'
+ --replace 'DESTINATION ''${Python_SITEARCH}' 'DESTINATION "${placeholder "py"}/${python3.sitePackages}"'
'';
+ installTargets = [ "doc" "install" ];
+
checkPhase = ''
export LD_LIBRARY_PATH=$PWD
export DYLD_LIBRARY_PATH=$PWD
@@ -49,20 +57,19 @@
doCheck = true;
- meta = {
- homepage = "http://ledger-cli.org/";
+ meta = with lib; {
description = "A double-entry accounting system with a command-line reporting interface";
- license = pkgs.lib.licenses.bsd3;
-
+ homepage = "https://ledger-cli.org/";
+ changelog = "https://github.com/ledger/ledger/raw/v${version}/NEWS.md";
+ license = lib.licenses.bsd3;
longDescription = ''
Ledger is a powerful, double-entry accounting system that is accessed
from the UNIX command-line. This may put off some users, as there is
no flashy UI, but for those who want unparalleled reporting access to
their data, there really is no alternative.
'';
-
- platforms = pkgs.lib.platforms.all;
- maintainers = with pkgs.lib.maintainers; [ jwiegley ];
+ platforms = lib.platforms.all;
+ maintainers = with maintainers; [ jwiegley ];
};
};
});