put piped backend deps derivation in its own file
This commit is contained in:
parent
650e145370
commit
6063ef1f28
|
@ -8,7 +8,10 @@ final: prev: {
|
||||||
videojs = final.callPackage ./invidious/videojs.nix { };
|
videojs = final.callPackage ./invidious/videojs.nix { };
|
||||||
};
|
};
|
||||||
misskey-static = final.callPackage ./misskey { };
|
misskey-static = final.callPackage ./misskey { };
|
||||||
piped-backend = final.callPackage ./piped/backend { };
|
piped-backend = final.callPackage ./piped/backend {
|
||||||
|
jre = final.openjdk17_headless;
|
||||||
|
jdk = final.openjdk17;
|
||||||
|
};
|
||||||
piped-frontend = final.callPackage ./piped/frontend { };
|
piped-frontend = final.callPackage ./piped/frontend { };
|
||||||
piped-proxy = final.callPackage ./piped/proxy { };
|
piped-proxy = final.callPackage ./piped/proxy { };
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,9 @@
|
||||||
{ stdenv, runtimeShell, fetchFromGitHub, makeWrapper, openjdk17, gradle, perl
|
{ stdenv, runtimeShell, fetchFromGitHub, makeWrapper, jdk, jre, gradle, perl
|
||||||
, writeText }:
|
, writeText, callPackage }:
|
||||||
let
|
let
|
||||||
meta = builtins.fromJSON (builtins.readFile ../meta.json);
|
meta = builtins.fromJSON (builtins.readFile ../meta.json);
|
||||||
|
|
||||||
pname = "piped-backend";
|
deps = callPackage ./deps.nix { inherit stdenv fetchFromGitHub jdk gradle perl; };
|
||||||
rev = "${meta.backend.rev}";
|
|
||||||
version = "latest-${rev}";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "TeamPiped";
|
|
||||||
repo = "Piped-Backend";
|
|
||||||
inherit rev;
|
|
||||||
sha256 = "${meta.backend.sha256}";
|
|
||||||
};
|
|
||||||
|
|
||||||
deps = stdenv.mkDerivation {
|
|
||||||
pname = "${pname}-deps";
|
|
||||||
inherit src version;
|
|
||||||
nativeBuildInputs = [ gradle openjdk17 perl ];
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
export GRADLE_USER_HOME=$(mktemp -d);
|
|
||||||
gradle --no-daemon assemble shadowJar
|
|
||||||
'';
|
|
||||||
|
|
||||||
# perl code mavenizes paths (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
|
|
||||||
installPhase = ''
|
|
||||||
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
|
|
||||||
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
|
|
||||||
| sh
|
|
||||||
'';
|
|
||||||
|
|
||||||
dontStrip = true;
|
|
||||||
|
|
||||||
outputHashAlgo = "sha256";
|
|
||||||
outputHashMode = "recursive";
|
|
||||||
outputHash = "sha256-fERSbMTJcvf1fG+H1yg2TFwdsq6+mkTzj/LvutgLAQs=";
|
|
||||||
};
|
|
||||||
|
|
||||||
gradleInit = writeText "init.gradle" ''
|
gradleInit = writeText "init.gradle" ''
|
||||||
logger.lifecycle 'Replacing Maven repositories with ${deps}...'
|
logger.lifecycle 'Replacing Maven repositories with ${deps}...'
|
||||||
|
@ -64,9 +31,17 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
inherit pname version src;
|
pname = "piped-backend";
|
||||||
|
version = "latest-${meta.backend.rev}";
|
||||||
|
|
||||||
nativeBuildInputs = [ gradle openjdk17 ];
|
src = fetchFromGitHub {
|
||||||
|
owner = "TeamPiped";
|
||||||
|
repo = "Piped-Backend";
|
||||||
|
rev = "${meta.backend.rev}";
|
||||||
|
sha256 = "${meta.backend.sha256}";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ gradle jdk ];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
@ -89,8 +64,8 @@ in stdenv.mkDerivation rec {
|
||||||
mkdir -p "$out/bin"
|
mkdir -p "$out/bin"
|
||||||
cat <<EOF >$out/bin/piped-backend
|
cat <<EOF >$out/bin/piped-backend
|
||||||
#!${runtimeShell}
|
#!${runtimeShell}
|
||||||
export JAVA_HOME=${openjdk17}
|
export JAVA_HOME=${jre}
|
||||||
exec ${openjdk17}/bin/java -jar "$out/share/piped-backend/piped-1.0-all.jar" "\$@"
|
exec ${jre}/bin/java -jar "$out/share/piped-backend/piped-1.0-all.jar" "\$@"
|
||||||
EOF
|
EOF
|
||||||
chmod a+x "$out/bin/piped-backend"
|
chmod a+x "$out/bin/piped-backend"
|
||||||
|
|
||||||
|
|
33
overlay/piped/backend/deps.nix
Normal file
33
overlay/piped/backend/deps.nix
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
{ stdenv, fetchFromGitHub, gradle, jdk, perl }:
|
||||||
|
let meta = builtins.fromJSON (builtins.readFile ../meta.json);
|
||||||
|
in stdenv.mkDerivation {
|
||||||
|
pname = "piped-backend-deps";
|
||||||
|
version = "latest-${meta.backend.rev}";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "TeamPiped";
|
||||||
|
repo = "Piped-Backend";
|
||||||
|
rev = "${meta.backend.rev}";
|
||||||
|
sha256 = "${meta.backend.sha256}";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ gradle jdk perl ];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
export GRADLE_USER_HOME=$(mktemp -d);
|
||||||
|
gradle --no-daemon assemble shadowJar
|
||||||
|
'';
|
||||||
|
|
||||||
|
# perl code mavenizes paths (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
|
||||||
|
installPhase = ''
|
||||||
|
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
|
||||||
|
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
|
||||||
|
| sh
|
||||||
|
'';
|
||||||
|
|
||||||
|
dontStrip = true;
|
||||||
|
|
||||||
|
outputHashAlgo = "sha256";
|
||||||
|
outputHashMode = "recursive";
|
||||||
|
outputHash = "sha256-fERSbMTJcvf1fG+H1yg2TFwdsq6+mkTzj/LvutgLAQs=";
|
||||||
|
}
|
Loading…
Reference in a new issue