-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
78 lines (68 loc) · 2.71 KB
/
flake.nix
File metadata and controls
78 lines (68 loc) · 2.71 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
description = "Preliminary devshell support for WalletLedgerExport";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs, flake-utils }:
let
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ];
forEachSystem = f: builtins.listToAttrs (map (system: {
name = system;
value = f system;
}) systems);
in {
devShells = forEachSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
default = pkgs.mkShell {
buildInputs = [
pkgs.jdk # JDK 21 (We're still building with ./gradlew, so install JDK not gradle)
];
shellHook = ''
echo "Welcome to WalletLedgerExport"
'';
};
}
);
packages = forEachSystem (system: {
wallet-ledger-export =
let
pkgs = import nixpkgs {
inherit system;
};
mainProgram = "wallet-ledger-export";
gradle = pkgs.gradle_8;
jre = pkgs.jdk21_headless; # JRE to run the example with
self2 = pkgs.stdenv.mkDerivation (_finalAttrs: {
pname = "wallet-ledger-export";
version = "0.0.2-SNAPSHOT";
meta = {
inherit mainProgram;
};
src = self; # project root is source
nativeBuildInputs = [gradle pkgs.makeWrapper];
mitmCache = gradle.fetchDeps {
pkg = self2;
# update or regenerate this by running:
# $(nix build .#wallet-ledger-export.mitmCache.updateScript --print-out-paths)
data = ./nix-deps.json;
};
gradleBuildTask = "ledger-export-tool:installDist";
gradleFlags = [ "--info --stacktrace" ];
# will run the gradleCheckTask (defaults to "test")
doCheck = false;
installPhase = ''
mkdir -p $out/{bin,share/${mainProgram}/lib}
cp ledger-export-tool/build/install/LedgerExport/lib/*.jar $out/share/${mainProgram}/lib
# Compute CLASSPATH: all .jar files in $out/share/${mainProgram}/lib
export MYPATH=$(find $out/share/${mainProgram}/lib -name "*.jar" -printf ':%p' | sed 's|^:||') # Colon-separated, no leading :
makeWrapper ${jre}/bin/java $out/bin/${mainProgram} \
--add-flags "-cp $MYPATH org.consensusj.ledgerexport.tool.WalletAccountingExport" \
'';
});
in
self2;
});
};
}