Skip to content

Commit 3da41ec

Browse files
committed
flake.nix: add wallet-ledger-export package
1 parent aa9feda commit 3da41ec

File tree

3 files changed

+780
-1
lines changed

3 files changed

+780
-1
lines changed

flake.lock

Lines changed: 60 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
outputs = { self, nixpkgs, flake-utils }:
99
let
10+
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
11+
forEachSystem = f: builtins.listToAttrs (map (system: {
12+
name = system;
13+
value = f system;
14+
}) systems);
1015
in {
1116
devShells = forEachSystem (system:
1217
let
@@ -20,6 +25,54 @@
2025
echo "Welcome to WalletLedgerExport"
2126
'';
2227
};
23-
});
28+
}
29+
);
30+
packages = forEachSystem (system: {
31+
wallet-ledger-export =
32+
let
33+
pkgs = import nixpkgs {
34+
inherit system;
35+
};
36+
mainProgram = "wallet-ledger-export";
37+
gradle = pkgs.gradle_8;
38+
jre = pkgs.jdk21_headless; # JRE to run the example with
39+
self2 = pkgs.stdenv.mkDerivation (_finalAttrs: {
40+
pname = "wallet-ledger-export";
41+
version = "0.0.2-SNAPSHOT";
42+
meta = {
43+
inherit mainProgram;
44+
};
45+
46+
src = self; # project root is source
47+
48+
nativeBuildInputs = [gradle pkgs.makeWrapper];
49+
50+
mitmCache = gradle.fetchDeps {
51+
pkg = self2;
52+
# update or regenerate this by running:
53+
# $(nix build .#wallet-ledger-export.mitmCache.updateScript --print-out-paths)
54+
data = ./nix-deps.json;
55+
};
56+
57+
gradleBuildTask = "ledger-export-tool:installDist";
58+
59+
gradleFlags = [ "--info --stacktrace" ];
60+
61+
# will run the gradleCheckTask (defaults to "test")
62+
doCheck = false;
63+
64+
installPhase = ''
65+
mkdir -p $out/{bin,share/${mainProgram}/lib}
66+
cp ledger-export-tool/build/install/LedgerExport/lib/*.jar $out/share/${mainProgram}/lib
67+
# Compute CLASSPATH: all .jar files in $out/share/${mainProgram}/lib
68+
export MYPATH=$(find $out/share/${mainProgram}/lib -name "*.jar" -printf ':%p' | sed 's|^:||') # Colon-separated, no leading :
69+
70+
makeWrapper ${jre}/bin/java $out/bin/${mainProgram} \
71+
--add-flags "-cp $MYPATH org.consensusj.ledgerexport.tool.WalletAccountingExport" \
72+
'';
73+
});
74+
in
75+
self2;
76+
});
2477
};
2578
}

0 commit comments

Comments
 (0)