{
    stdenv,
    lib,
    leveldb-cli,
    value,
    origin ? "https://tetr.io",
    key ? "userConfig",
}:

let
    src = ./.;
in
stdenv.mkDerivation {
    pname = "tetrio-leveldb";
    version = "1";

    inherit src;

    nativeBuildInputs = [ leveldb-cli ];

    buildPhase = ''
                runHook preBuild

                ${lib.getExe leveldb-cli} \
        			$out \
        			${lib.escapeShellArg origin} \
        			${lib.escapeShellArg key} \
        			${lib.escapeShellArg (builtins.toJSON value)}

                runHook postBuild
    '';
}
