13 go-turbo-version = "1.7.4";
15 x86_64-linux = fetchurl {
16 url = "https://registry.npmjs.org/turbo-linux-64/-/turbo-linux-64-${go-turbo-version}.tgz";
17 hash = "sha256-bwi+jthoDe+SEvCPPNNNv9AR8n5IA1fc4I8cnfC095Y=";
19 aarch64-linux = fetchurl {
20 url = "https://registry.npmjs.org/turbo-linux-arm64/-/turbo-linux-arm64-${go-turbo-version}.tgz";
21 hash = "sha256-j3mUd3x16tYR3QQweIB07IbCKYuKPeEkKkUHhrpHzyc=";
24 go-turbo = stdenv.mkDerivation {
26 version = go-turbo-version;
27 src = go-turbo-srcs.${stdenv.hostPlatform.system};
28 nativeBuildInputs = [ autoPatchelfHook ];
31 install -Dm755 bin/go-turbo -t $out/bin
36 stdenv.mkDerivation (finalAttrs: {
40 src = fetchFromGitHub {
43 rev = "refs/tags/${finalAttrs.version}";
44 hash = "sha256-1+5UaSYtY00F+1oJfovLIBPnmfRnKpIkQHpxb93rO2k=";
45 # turborepo requires .git directory
55 pnpmDeps = pnpm_9.fetchDeps {
56 inherit (finalAttrs) pname version src;
57 hash = "sha256-FfqBe1WQc6ditizjxYLmjb8mvCjQJMpvyUDdaW29sXY=";
62 echo VITE_EMBED_SERVER_ORIGIN="https://embed.zenn.studio" > packages/zenn-cli/.env
64 # replace go-turbo since the existing one can't be executed
65 + lib.optionalString stdenv.hostPlatform.isLinux ''
66 cp ${go-turbo}/bin/go-turbo node_modules/.pnpm/turbo-linux-*/node_modules/turbo-linux*/bin/go-turbo
72 pnpm build --no-daemon
80 mkdir -p $out/{bin,lib/node_modules/zenn-cli}
81 cp -r packages/zenn-cli/{dist,LICENSE,package.json,README.md} $out/lib/node_modules/zenn-cli
83 makeWrapper "${lib.getExe nodejs}" "$out/bin/zenn" \
84 --add-flags "$out/lib/node_modules/zenn-cli/dist/server/zenn.js"
90 tests.version = testers.testVersion { package = finalAttrs.finalPackage; };
94 description = "Preview Zenn content locally";
95 homepage = "https://github.com/zenn-dev/zenn-editor";
96 changelog = "https://github.com/zenn-dev/zenn-editor/releases/tag/${finalAttrs.version}";
97 license = lib.licenses.mit;
98 maintainers = with lib.maintainers; [ natsukium ];
100 platforms = nodejs.meta.platforms;