plik{,d}: refactor and move to pkgs/by-name (#486162)

This commit is contained in:
Gergő Gutyina
2026-02-04 01:27:18 +00:00
committed by GitHub
5 changed files with 95 additions and 117 deletions
+32
View File
@@ -0,0 +1,32 @@
{
buildGoModule,
plikd,
}:
buildGoModule (finalAttrs: {
pname = "plik";
inherit (plikd)
version
src
postPatch
passthru
;
subPackages = [ "client" ];
vendorHash = null;
postInstall = ''
mv $out/bin/client $out/bin/plik
'';
meta = {
inherit (plikd.meta)
description
homepage
license
maintainers
;
mainProgram = "plik";
};
})
+63
View File
@@ -0,0 +1,63 @@
{
lib,
buildGoModule,
fetchFromGitHub,
fetchurl,
nixosTests,
makeWrapper,
}:
buildGoModule (finalAttrs: {
pname = "plikd";
version = "1.3.8";
src = fetchFromGitHub {
owner = "root-gg";
repo = "plik";
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;
nativeBuildInputs = [
makeWrapper
];
postPatch = ''
substituteInPlace server/common/version.go \
--replace '"0.0.0"' '"${finalAttrs.version}"'
'';
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 = [ ];
};
})
-38
View File
@@ -1,38 +0,0 @@
{
lib,
fetchurl,
makeWrapper,
runCommand,
callPackage,
}:
let
version = "1.3.7";
programs = callPackage ./programs.nix { };
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 (programs) plik plikd-unwrapped;
plikd =
runCommand "plikd-${version}"
{
nativeBuildInputs = [ makeWrapper ];
inherit (programs.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 ${programs.plikd-unwrapped}/bin/plikd $out/libexec/plikd/bin/plikd
makeWrapper $out/libexec/plikd/bin/plikd $out/bin/plikd \
--chdir "$out/libexec/plikd/bin"
'';
}
-74
View File
@@ -1,74 +0,0 @@
{
lib,
buildGoModule,
fetchFromGitHub,
makeWrapper,
runCommand,
nixosTests,
}:
let
version = "1.3.8";
src = fetchFromGitHub {
owner = "root-gg";
repo = "plik";
rev = version;
hash = "sha256-WCtfkzlZnyzZDwNDBrW06bUbLYTL2C704Y7aXbiVi5c=";
};
vendorHash = null;
meta = {
homepage = "https://plik.root.gg/";
description = "Scalable & friendly temporary file upload system";
maintainers = [ ];
license = lib.licenses.mit;
mainProgram = "plik";
};
postPatch = ''
substituteInPlace server/common/version.go \
--replace '"0.0.0"' '"${version}"'
'';
passthru.tests = {
inherit (nixosTests) plikd;
};
in
{
plik = buildGoModule {
pname = "plik";
inherit
version
meta
src
vendorHash
postPatch
passthru
;
subPackages = [ "client" ];
postInstall = ''
mv $out/bin/client $out/bin/plik
'';
};
plikd-unwrapped = buildGoModule {
pname = "plikd-unwrapped";
inherit
version
src
vendorHash
postPatch
passthru
;
subPackages = [ "server" ];
postFixup = ''
mv $out/bin/server $out/bin/plikd
'';
};
}
-5
View File
@@ -3334,11 +3334,6 @@ 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
;
plex = callPackage ../servers/plex { };
plexRaw = callPackage ../servers/plex/raw.nix { };