13 pname = "pufferpanel";
16 src = fetchFromGitHub {
17 owner = "PufferPanel";
20 hash = "sha256-+ZZUoqCiSbrkaeYrm9X8SuX0INsGFegQNwa3WjBvgHQ=";
24 # Bump sha1cd package, otherwise i686-linux fails to build.
25 # Also bump github.com/swaggo/swag for PR 257790.
28 # Seems to be an anti-feature. Startup is the only place where user/group is
29 # hardcoded and checked.
31 # There is no technical reason PufferPanel cannot run as a different user,
32 # especially for simple commands like `pufferpanel version`.
33 ./disable-group-checks.patch
35 # Some tests do not have network requests stubbed :(
36 ./skip-network-tests.patch
42 "-X=github.com/pufferpanel/pufferpanel/v2.Hash=none"
43 "-X=github.com/pufferpanel/pufferpanel/v2.Version=${version}-nixpkgs"
46 frontend = buildNpmPackage {
47 pname = "pufferpanel-frontend";
50 src = "${src}/client";
52 npmDepsHash = "sha256-oWFXtV/dxzHv3sfIi01l1lHE5tcJgpVq87XgS6Iy62g=";
54 NODE_OPTIONS = "--openssl-legacy-provider";
55 npmBuildFlags = [ "--" "--dest=${placeholder "out"}" ];
56 dontNpmInstall = true;
59 nativeBuildInputs = [ makeWrapper go-swag ];
61 vendorHash = "sha256-1U7l7YW1fu5M0/pPHTLamLsTQdEltesRODUn21SuP8w=";
64 # Generate code for Swagger documentation endpoints (see web/swagger/docs.go).
65 # Note that GOROOT embedded in go-swag is empty by default since it is built
66 # with -trimpath (see https://go.dev/cl/399214). It looks like go-swag skips
67 # file paths that start with $GOROOT, thus all files when it is empty.
69 GOROOT=''${GOROOT-$(go env GOROOT)} swag init --output web/swagger --generalInfo web/loader.go
75 # Set up directory structure similar to the official PufferPanel releases.
76 mkdir -p $out/share/pufferpanel
77 cp "$GOPATH"/bin/cmd $out/share/pufferpanel/pufferpanel
78 cp -r $frontend $out/share/pufferpanel/www
79 cp -r $src/assets/email $out/share/pufferpanel/email
80 cp web/swagger/swagger.{json,yaml} $out/share/pufferpanel
82 # Wrap the binary with the path to the external files, but allow setting
83 # custom paths if needed.
84 makeWrapper $out/share/pufferpanel/pufferpanel $out/bin/pufferpanel \
85 --set-default GIN_MODE release \
86 --set-default PUFFER_PANEL_EMAIL_TEMPLATES $out/share/pufferpanel/email/emails.json \
87 --set-default PUFFER_PANEL_WEB_FILES $out/share/pufferpanel/www
93 inherit (nixosTests) pufferpanel;
94 version = testers.testVersion {
95 package = pufferpanel;
96 command = "${pname} version";
101 description = "Free, open source game management panel";
102 homepage = "https://www.pufferpanel.com/";
103 license = with licenses; [ asl20 ];
104 maintainers = with maintainers; [ tie ];
105 mainProgram = "pufferpanel";