summaryrefslogtreecommitdiff
path: root/flake.nix
blob: cc93053dec594fb67a81d54fdd82119b3448d28f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
  description = "A double-entry accounting system with a command-line reporting interface";

  outputs = { self, nixpkgs }: let
    useGpgme = 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" ];
  in {

    packages = forAllSystems (system: let
        pkgs = nixpkgsFor.${system};
      in {
      ledger = pkgs.stdenv.mkDerivation {
        pname = "ledger";
        version = "3.2.1-${self.shortRev or "dirty"}";

        src = self;

        nativeBuildInputs = with pkgs; [ cmake ];
        buildInputs = with pkgs; [
          boost gmp mpfr libedit python3 texinfo gnused
        ] ++ pkgs.lib.optional useGpgme gpgme;

        enableParallelBuilding = true;

        cmakeFlags = [
          "-DCMAKE_INSTALL_LIBDIR=lib"
          (pkgs.lib.optionalString useGpgme "-DUSE_GPGME=1")
        ];

        checkPhase = ''
          export LD_LIBRARY_PATH=$PWD
          export DYLD_LIBRARY_PATH=$PWD
          ctest -j$NIX_BUILD_CORES
        '';

        doCheck = true;

        meta = {
          homepage = "http://ledger-cli.org/";
          description = "A double-entry accounting system with a command-line reporting interface";
          license = pkgs.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 ];
        };
      };
    });

    defaultPackage = forAllSystems (system: self.packages.${system}.ledger);

  };
}