@jaspermayone.com's dotfiles

Simplify QMD package using Bun

+21 -24
+21 -24
packages/qmd.nix
··· 1 1 { 2 2 lib, 3 - buildNpmPackage, 3 + stdenvNoCC, 4 4 fetchFromGitHub, 5 - nodejs, 6 - python3, 7 - stdenv, 8 - darwin, 5 + bun, 6 + makeWrapper, 9 7 }: 10 8 11 - buildNpmPackage rec { 9 + stdenvNoCC.mkDerivation rec { 12 10 pname = "qmd"; 13 - version = "unstable-2025-01-31"; 11 + version = "unstable-2025-02-01"; 14 12 15 13 src = fetchFromGitHub { 16 14 owner = "tobi"; ··· 19 17 hash = lib.fakeHash; 20 18 }; 21 19 22 - npmDepsHash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # Placeholder - needs to be updated 23 - 24 20 nativeBuildInputs = [ 25 - nodejs 26 - python3 27 - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ 28 - darwin.cctools 21 + bun 22 + makeWrapper 29 23 ]; 30 24 31 - buildInputs = lib.optionals stdenv.hostPlatform.isDarwin ( 32 - with darwin.apple_sdk.frameworks; [ 33 - Security 34 - ] 35 - ); 25 + buildPhase = '' 26 + runHook preBuild 27 + HOME=$TMPDIR bun install --frozen-lockfile --no-progress 28 + runHook postBuild 29 + ''; 36 30 37 - # Skip npm install scripts that might fail 38 - npmInstallFlags = [ "--ignore-scripts" ]; 31 + installPhase = '' 32 + runHook preInstall 39 33 40 - # QMD requires Bun runtime but can be built with npm 41 - postInstall = '' 42 - # Ensure binary is executable 43 - chmod +x $out/bin/qmd 34 + mkdir -p $out/lib/qmd $out/bin 35 + cp -r . $out/lib/qmd/ 36 + 37 + makeWrapper ${bun}/bin/bun $out/bin/qmd \ 38 + --add-flags "run $out/lib/qmd/src/cli.ts" 39 + 40 + runHook postInstall 44 41 ''; 45 42 46 43 meta = with lib; {