nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 54 lines 1.4 kB view raw
1{ 2 lib, 3 buildNpmPackage, 4 fetchFromGitHub, 5 nix-update-script, 6}: 7 8buildNpmPackage rec { 9 pname = "nezha-theme-user"; 10 version = "1.13.3"; 11 12 src = fetchFromGitHub { 13 owner = "hamster1963"; 14 repo = "nezha-dash-v1"; 15 tag = "v${version}"; 16 hash = "sha256-dg46wJtaY+b0gfL0+HchVNGFAx41Cz/moqL/8InNYp4="; 17 }; 18 19 # TODO: Switch to the bun build function once available in nixpkgs 20 postPatch = '' 21 cp ${./package-lock.json} package-lock.json 22 23 # We cannot directly get the git commit hash from the tarball 24 substituteInPlace vite.config.ts \ 25 --replace-fail 'git rev-parse --short HEAD' 'echo refs/tags/v${version}' 26 substituteInPlace src/components/Footer.tsx \ 27 --replace-fail '/commit/' '/tree/' 28 ''; 29 30 npmDepsHash = "sha256-n7ejpEkakvWO89GhHyy/QbxNvDaXXIDGERc8neeIyoU="; 31 32 npmPackFlags = [ "--ignore-scripts" ]; 33 34 npmFlags = [ "--legacy-peer-deps" ]; 35 36 dontNpmInstall = true; 37 installPhase = '' 38 runHook preInstall 39 40 cp -r dist $out 41 42 runHook postInstall 43 ''; 44 45 passthru.updateScript = nix-update-script { extraArgs = [ "--generate-lockfile" ]; }; 46 47 meta = { 48 description = "Nezha monitoring user frontend based on next.js"; 49 changelog = "https://github.com/hamster1963/nezha-dash-v1/releases/tag/v${version}"; 50 homepage = "https://github.com/hamster1963/nezha-dash-v1"; 51 license = lib.licenses.apsl20; 52 maintainers = with lib.maintainers; [ moraxyc ]; 53 }; 54}