plikd: webapp 1.3.7 -> 1.3.8, inline webapp installation, refactor

the binary was updated by R. RyanTM, in cbb4d12530 but the webapp didn't
automatically update due to the previously cursed structure of the package
This commit is contained in:
quantenzitrone
2026-02-02 11:32:45 +01:00
parent 762d460330
commit 36997acda9
3 changed files with 36 additions and 56 deletions
-39
View File
@@ -1,39 +0,0 @@
{
lib,
fetchurl,
makeWrapper,
runCommand,
callPackage,
}:
let
version = "1.3.7";
plikd-unwrapped = callPackage ./plikd.nix { };
plik = callPackage ./plik.nix { plikd = plikd-unwrapped; };
webapp = fetchurl {
url = "https://github.com/root-gg/plik/releases/download/${version}/plik-${version}-linux-amd64.tar.gz";
hash = "sha256-Uj3I/ohgMr/Ud5xAZiBjsIW8bSdUeXXv9NYKLu8Aym8=";
};
in
{
inherit plik plikd-unwrapped;
plikd =
runCommand "plikd-${version}"
{
nativeBuildInputs = [ makeWrapper ];
inherit (plikd-unwrapped) passthru;
}
''
mkdir -p $out/libexec/plikd/{bin,webapp} $out/bin
tar xf ${webapp} plik-${version}-linux-amd64/webapp/dist/
mv plik-*/webapp/dist $out/libexec/plikd/webapp
cp ${plikd-unwrapped}/bin/plikd $out/libexec/plikd/bin/plikd
makeWrapper $out/libexec/plikd/bin/plikd $out/bin/plikd \
--chdir "$out/libexec/plikd/bin"
'';
}
+34 -13
View File
@@ -2,41 +2,62 @@
lib,
buildGoModule,
fetchFromGitHub,
fetchurl,
nixosTests,
makeWrapper,
}:
buildGoModule rec {
pname = "plikd-unwrapped";
buildGoModule (finalAttrs: {
pname = "plikd";
version = "1.3.8";
src = fetchFromGitHub {
owner = "root-gg";
repo = "plik";
rev = version;
rev = finalAttrs.version;
hash = "sha256-WCtfkzlZnyzZDwNDBrW06bUbLYTL2C704Y7aXbiVi5c=";
};
# TODO build webapp from source (how to hanndle npm and bower deps?)
src-webapp = fetchurl {
url = "https://github.com/root-gg/plik/releases/download/${finalAttrs.version}/plik-${finalAttrs.version}-linux-amd64.tar.gz";
hash = "sha256-taUFXZJeUHYjjhrVlLgKYPxNn6W5o8uoEVcu+f5flCA=";
};
subPackages = [ "server" ];
vendorHash = null;
meta = {
homepage = "https://plik.root.gg/";
description = "Scalable & friendly temporary file upload system";
maintainers = [ ];
license = lib.licenses.mit;
};
nativeBuildInputs = [
makeWrapper
];
postPatch = ''
substituteInPlace server/common/version.go \
--replace '"0.0.0"' '"${version}"'
--replace '"0.0.0"' '"${finalAttrs.version}"'
'';
postFixup = ''
mv $out/bin/server $out/bin/plikd
postInstall = ''
# install the webapp
mkdir -p $out/libexec/plikd/{bin,webapp} $out/bin
tar xf ${finalAttrs.src-webapp} plik-${finalAttrs.version}-linux-amd64/webapp/dist/
mv plik-*/webapp/dist $out/libexec/plikd/webapp
# move and wrap the server binary
mv $out/bin/server $out/libexec/plikd/bin/plikd
makeWrapper $out/libexec/plikd/bin/plikd $out/bin/plikd \
--chdir "$out/libexec/plikd/bin"
'';
passthru.tests = {
inherit (nixosTests) plikd;
};
}
meta = {
description = "Scalable & friendly temporary file upload system";
homepage = "https://plik.root.gg/";
license = lib.licenses.mit;
mainProgram = "plikd";
maintainers = [ ];
};
})
+2 -4
View File
@@ -3390,10 +3390,8 @@ with pkgs;
playwright-driver = (callPackage ../development/web/playwright/driver.nix { }).playwright-core;
playwright-test = (callPackage ../development/web/playwright/driver.nix { }).playwright-test;
inherit (callPackage ../servers/plik { })
plik
plikd
;
plik = callPackage ../servers/plik/plik.nix { };
plikd = callPackage ../servers/plik/plikd.nix { };
plex = callPackage ../servers/plex { };