2021-07-01 00:10:12 +00:00
|
|
|
{ lib
|
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, pkgs
|
|
|
|
, stdenv
|
|
|
|
, fetchzip
|
2021-09-26 09:19:29 +00:00
|
|
|
, jdk
|
2021-07-01 00:10:12 +00:00
|
|
|
, nodejs
|
|
|
|
, pathDeps ? [ ]
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "pufferpanel";
|
|
|
|
version = "2.2.0";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pufferpanel";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "1ifig8ckjlg47wj0lfk4q941dan7llb1i5l76akcpjq726b2j8lh";
|
|
|
|
};
|
|
|
|
|
|
|
|
# PufferPanel is split into two parts: the backend daemon and the
|
|
|
|
# frontend.
|
|
|
|
# Getting the frontend to build in the Nix environment fails even
|
|
|
|
# with all the proper node_modules populated. To work around this,
|
|
|
|
# we just download the built frontend and package that.
|
|
|
|
frontend = fetchzip {
|
|
|
|
url = "https://github.com/PufferPanel/PufferPanel/releases/download/v${version}/pufferpanel_${version}_linux_arm64.zip";
|
|
|
|
sha256 = "0phbf4asr0dns7if84crx05kfgr44yaxrbsbihdywbhh2mb16052";
|
|
|
|
stripRoot = false;
|
|
|
|
} + "/www";
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
vendorSha256 = "061l1sy0z3kd7rc2blqh333gy66nbadfxy9hyxgq07dszds4byys";
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
mkdir -p $out/share/pufferpanel
|
|
|
|
cp -r ${src}/assets/email $out/share/pufferpanel/templates
|
|
|
|
cp -r ${frontend} $out/share/pufferpanel/www
|
|
|
|
|
|
|
|
# Wrap the binary with the path to the external files.
|
|
|
|
mv $out/bin/cmd $out/bin/pufferpanel
|
|
|
|
wrapProgram "$out/bin/pufferpanel" \
|
|
|
|
--set PUFFER_PANEL_EMAIL_TEMPLATES $out/share/pufferpanel/templates/emails.json \
|
|
|
|
--set GIN_MODE release \
|
|
|
|
--set PUFFER_PANEL_WEB_FILES $out/share/pufferpanel/www \
|
2022-05-06 16:35:19 +00:00
|
|
|
--prefix PATH : ${lib.escapeShellArg (lib.makeBinPath pathDeps)}
|
2021-07-01 00:10:12 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A free, open source game management panel";
|
|
|
|
homepage = "https://www.pufferpanel.com/";
|
|
|
|
license = with licenses; [ asl20 ];
|
2021-07-25 23:08:49 +00:00
|
|
|
maintainers = with maintainers; [ ckie ];
|
2022-02-25 06:26:58 +00:00
|
|
|
broken = stdenv.isDarwin; # never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/pufferpanel.x86_64-darwin
|
2021-07-01 00:10:12 +00:00
|
|
|
};
|
|
|
|
}
|