Calculate net worth and taxes due on cryptocurrency
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

39 lines
976 B

{ pkgs ? import <nixpkgs> {}, ... }:
let
cljdeps = pkgs.callPackage ./deps.nix {};
classpath = cljdeps.makeClasspaths {};
exec-name = "worther";
main-class = "worther.core";
manifest = pkgs.writeText "${exec-name}-MANIFEST.MF" ''
Manifest-Version: 1.0
Main-Class: ${main-class}
'';
in pkgs.stdenv.mkDerivation {
name = exec-name;
nativeBuildInputs = with pkgs; [ jre makeWrapper ];
buildInputs = map (x: x.paths) cljdeps.packages;
src = ./src;
phases = [ "unpackPhase" "buildPhase" "installPhase" ];
buildPhase = ''
mkdir classes
java -cp .:${classpath} clojure.main -e "(compile '${main-class})"
jar cmf ${manifest} out.jar -C classes worther
'';
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share/java
cp out.jar $out/share/java/${exec-name}.jar
makeWrapper ${pkgs.jdk}/bin/java $out/bin/${exec-name} \
--add-flags "-cp ${classpath}:$out/share/java/${exec-name}.jar ${main-class}"
'';
}