2021-12-27 04:37:57 +01:00
|
|
|
args@{ depot, pkgs, ... }:
|
2021-12-14 03:28:25 +01:00
|
|
|
|
|
|
|
with pkgs.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (depot.third_party) gitignoreSource;
|
|
|
|
|
|
|
|
deps = import ./deps.nix {
|
|
|
|
inherit (pkgs) fetchMavenArtifact fetchgit lib;
|
|
|
|
};
|
2022-01-30 17:06:58 +01:00
|
|
|
in
|
|
|
|
rec {
|
2021-12-14 03:28:25 +01:00
|
|
|
meta.targets = [
|
|
|
|
"db-util"
|
|
|
|
"server"
|
2021-12-27 04:37:57 +01:00
|
|
|
"tf"
|
2021-12-14 03:28:25 +01:00
|
|
|
];
|
|
|
|
|
2022-01-30 17:06:58 +01:00
|
|
|
depsPaths = deps.makePaths { };
|
2021-12-14 03:28:25 +01:00
|
|
|
|
|
|
|
resources = builtins.filterSource (_: type: type != "symlink") ./resources;
|
|
|
|
|
|
|
|
classpath.dev = concatStringsSep ":" (
|
2022-01-30 17:06:58 +01:00
|
|
|
(map gitignoreSource [ ./src ./test ./env/dev ]) ++ [ resources ] ++ depsPaths
|
2021-12-14 03:28:25 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
classpath.test = concatStringsSep ":" (
|
2022-01-30 17:06:58 +01:00
|
|
|
(map gitignoreSource [ ./src ./test ./env/test ]) ++ [ resources ] ++ depsPaths
|
2021-12-14 03:28:25 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
classpath.prod = concatStringsSep ":" (
|
2022-01-30 17:06:58 +01:00
|
|
|
(map gitignoreSource [ ./src ./env/prod ]) ++ [ resources ] ++ depsPaths
|
2021-12-14 03:28:25 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
testClojure = pkgs.writeShellScript "test-clojure" ''
|
|
|
|
export HOME=$(pwd)
|
|
|
|
${pkgs.clojure}/bin/clojure -Scp ${depsPaths}
|
|
|
|
'';
|
|
|
|
|
|
|
|
mkJar = name: opts:
|
|
|
|
with pkgs;
|
|
|
|
assert (hasSuffix ".jar" name);
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
inherit name;
|
|
|
|
dontUnpack = true;
|
|
|
|
buildPhase = ''
|
|
|
|
export HOME=$(pwd)
|
|
|
|
cp ${./pom.xml} pom.xml
|
|
|
|
cp ${./deps.edn} deps.edn
|
|
|
|
${clojure}/bin/clojure \
|
|
|
|
-Scp ${classpath.prod} \
|
|
|
|
-A:uberjar \
|
|
|
|
${name} \
|
|
|
|
-C ${opts}
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
echo "checking for existence of ${name}"
|
|
|
|
[ -f ${name} ]
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
cp ${name} $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
db-util-jar = mkJar "bbbg-db-util.jar" "-m bbbg.db";
|
|
|
|
|
|
|
|
db-util = pkgs.writeShellScriptBin "bbbg-db-util" ''
|
|
|
|
exec ${pkgs.openjdk17_headless}/bin/java -jar ${db-util-jar} "$@"
|
|
|
|
'';
|
|
|
|
|
|
|
|
server-jar = mkJar "bbbg-server.jar" "-m bbbg.core";
|
|
|
|
|
|
|
|
server = pkgs.writeShellScriptBin "bbbg-server" ''
|
|
|
|
exec ${pkgs.openjdk17_headless}/bin/java -jar ${server-jar} "$@"
|
|
|
|
'';
|
2021-12-27 04:37:57 +01:00
|
|
|
|
|
|
|
tf = import ./tf.nix args;
|
2021-12-14 03:28:25 +01:00
|
|
|
}
|