From 975f4c45ae5c0f41769e7ccee08c96748b334b7f Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Mon, 30 Sep 2024 15:21:39 +0800 Subject: [PATCH] beszel: init at 0.6.2 --- pkgs/by-name/be/beszel/0001-fix-build.patch | 405 ++++++++++++++++++++ pkgs/by-name/be/beszel/package.nix | 84 ++++ 2 files changed, 489 insertions(+) create mode 100644 pkgs/by-name/be/beszel/0001-fix-build.patch create mode 100644 pkgs/by-name/be/beszel/package.nix diff --git a/pkgs/by-name/be/beszel/0001-fix-build.patch b/pkgs/by-name/be/beszel/0001-fix-build.patch new file mode 100644 index 000000000000..ae120cac4fa1 --- /dev/null +++ b/pkgs/by-name/be/beszel/0001-fix-build.patch @@ -0,0 +1,405 @@ +From 402b2d72ad3bcc4a8cdb0115220888154bdb3c39 Mon Sep 17 00:00:00 2001 +From: wxt <3264117476@qq.com> +Date: Tue, 29 Oct 2024 19:32:07 +0800 +Subject: [PATCH] fix build + +--- + package-lock.json | 368 ++++++++++++++++++++++++++++++++++ + 1 file changed, 368 insertions(+) + +diff --git a/package-lock.json b/package-lock.json +index 8e4532e..d3b3605 100644 +--- a/package-lock.json ++++ b/package-lock.json +@@ -679,6 +679,262 @@ + "node": ">=6.9.0" + } + }, ++ "node_modules/@esbuild/aix-ppc64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", ++ "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", ++ "cpu": [ ++ "ppc64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "aix" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/android-arm": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", ++ "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", ++ "cpu": [ ++ "arm" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "android" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/android-arm64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", ++ "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", ++ "cpu": [ ++ "arm64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "android" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/android-x64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", ++ "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", ++ "cpu": [ ++ "x64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "android" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/darwin-arm64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", ++ "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", ++ "cpu": [ ++ "arm64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "darwin" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/darwin-x64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", ++ "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", ++ "cpu": [ ++ "x64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "darwin" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/freebsd-arm64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", ++ "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", ++ "cpu": [ ++ "arm64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "freebsd" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/freebsd-x64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", ++ "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", ++ "cpu": [ ++ "x64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "freebsd" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/linux-arm": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", ++ "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", ++ "cpu": [ ++ "arm" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "linux" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/linux-arm64": { ++ "version": "0.24.0", ++ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz", ++ "integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==", ++ "cpu": [ ++ "arm64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "linux" ++ ], ++ "engines": { ++ "node": ">=18" ++ } ++ }, ++ "node_modules/@esbuild/linux-ia32": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", ++ "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", ++ "cpu": [ ++ "ia32" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "linux" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/linux-loong64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", ++ "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", ++ "cpu": [ ++ "loong64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "linux" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/linux-mips64el": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", ++ "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", ++ "cpu": [ ++ "mips64el" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "linux" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/linux-ppc64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", ++ "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", ++ "cpu": [ ++ "ppc64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "linux" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/linux-riscv64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", ++ "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", ++ "cpu": [ ++ "riscv64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "linux" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/linux-s390x": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", ++ "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", ++ "cpu": [ ++ "s390x" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "linux" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, + "node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", +@@ -695,6 +951,102 @@ + "node": ">=12" + } + }, ++ "node_modules/@esbuild/netbsd-x64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", ++ "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", ++ "cpu": [ ++ "x64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "netbsd" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/openbsd-x64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", ++ "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", ++ "cpu": [ ++ "x64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "openbsd" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/sunos-x64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", ++ "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", ++ "cpu": [ ++ "x64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "sunos" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/win32-arm64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", ++ "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", ++ "cpu": [ ++ "arm64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "win32" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/win32-ia32": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", ++ "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", ++ "cpu": [ ++ "ia32" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "win32" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, ++ "node_modules/@esbuild/win32-x64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", ++ "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", ++ "cpu": [ ++ "x64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "win32" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, + "node_modules/@floating-ui/core": { + "version": "1.6.4", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.6.4.tgz", +@@ -3545,6 +3897,22 @@ + "@esbuild/win32-x64": "0.21.5" + } + }, ++ "node_modules/esbuild/node_modules/@esbuild/linux-arm64": { ++ "version": "0.21.5", ++ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", ++ "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", ++ "cpu": [ ++ "arm64" ++ ], ++ "license": "MIT", ++ "optional": true, ++ "os": [ ++ "linux" ++ ], ++ "engines": { ++ "node": ">=12" ++ } ++ }, + "node_modules/escalade": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", +-- +2.46.1 + diff --git a/pkgs/by-name/be/beszel/package.nix b/pkgs/by-name/be/beszel/package.nix new file mode 100644 index 000000000000..6a8aa389dabd --- /dev/null +++ b/pkgs/by-name/be/beszel/package.nix @@ -0,0 +1,84 @@ +{ + buildGoModule, + lib, + fetchFromGitHub, + nix-update-script, + buildNpmPackage, + fetchpatch, +}: + +buildGoModule rec { + pname = "beszel"; + version = "0.6.2"; + + src = fetchFromGitHub { + owner = "henrygd"; + repo = "beszel"; + rev = "refs/tags/v${version}"; + hash = "sha256-x9HU+sDjxRthC4ROJaKbuKHPHgxFSpyn/dywyGWE/v8="; + }; + + webui = buildNpmPackage { + inherit + pname + version + src + meta + ; + + npmFlags = [ "--legacy-peer-deps" ]; + + patches = [ + # add missing @esbuild for multi platform + # https://github.com/henrygd/beszel/pull/235 + # add missing @esbuild for multi platform + # https://github.com/henrygd/beszel/pull/235 + ./0001-fix-build.patch + ]; + + buildPhase = '' + runHook preBuild + + node --max_old_space_size=1024000 ./node_modules/vite/bin/vite.js build + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp -r dist/* $out + + runHook postInstall + ''; + + sourceRoot = "${src.name}/beszel/site"; + + npmDepsHash = "sha256-t7Qcuvqbt0sPHAu3vcZaU8/Ij2yY5/g1TguozlKu0mU="; + }; + + sourceRoot = "${src.name}/beszel"; + + vendorHash = "sha256-/FePQkqoeuH63mV81v1NxpFw9osMUCcZ1bP+0yN1Qlo="; + + preBuild = '' + mkdir -p site/dist + cp -r ${webui}/* site/dist + ''; + + postInstall = '' + mv $out/bin/agent $out/bin/beszel-agent + mv $out/bin/hub $out/bin/beszel-hub + ''; + + passthru.updateScript = nix-update-script { }; + + meta = { + homepage = "https://github.com/henrygd/beszel"; + changelog = "https://github.com/henrygd/beszel/releases/tag/v${version}"; + description = "Lightweight server monitoring hub with historical data, docker stats, and alerts"; + maintainers = with lib.maintainers; [ bot-wxt1221 ]; + license = lib.licenses.mit; + }; +}