[{"data":1,"prerenderedAt":426},["ShallowReactive",2],{"doc:\u002Fguides\u002Finstallation":3,"nav:guides":376},{"doc":4,"source":375},{"id":5,"title":6,"body":7,"description":367,"extension":368,"meta":369,"navigation":370,"path":371,"seo":372,"stem":373,"__hash__":374},"guides\u002Fguides\u002Finstallation.md","Installation",{"type":8,"value":9,"toc":362},"minimark",[10,14,23,28,44,62,69,186,202,206,224,227,300,316,320,345,358],[11,12,6],"h1",{"id":13},"installation",[15,16,17,18,22],"p",{},"zig-pkl needs Zig 0.17.0 and a ",[19,20,21],"code",{},"pkl"," executable. It has no other dependencies.",[24,25,27],"h2",{"id":26},"add-the-package","Add the package",[29,30,35],"pre",{"className":31,"code":32,"language":33,"meta":34,"style":34},"language-sh shiki shiki-themes github-light github-dark","zig fetch --save https:\u002F\u002Fgithub.com\u002Fguanchzhou\u002Fzig-pkl\u002Freleases\u002Fdownload\u002Fv0.1.1\u002Fzig-pkl-0.1.1.tar.gz\n","sh","",[19,36,37],{"__ignoreMap":34},[38,39,42],"span",{"class":40,"line":41},"line",1,[38,43,32],{},[15,45,46,49,50,53,54,57,58,61],{},[19,47,48],{},"zig fetch"," records the URL and the package hash in ",[19,51,52],{},"build.zig.zon",". The release page lists checksums, SBOMs, and a signature for the archive. ",[19,55,56],{},"git+https:\u002F\u002Fgithub.com\u002Fguanchzhou\u002Fzig-pkl#v0.1.1"," fetches the same release from git, and ",[19,59,60],{},"git+https:\u002F\u002Fgithub.com\u002Fguanchzhou\u002Fzig-pkl"," the latest commit.",[15,63,64,65,68],{},"Import the module in ",[19,66,67],{},"build.zig",":",[29,70,74],{"className":71,"code":72,"language":73,"meta":34,"style":34},"language-zig shiki shiki-themes github-light github-dark","const zig_pkl = b.dependency(\"zig_pkl\", .{\n    .target = target,\n    .optimize = optimize,\n});\nexe.root_module.addImport(\"zig_pkl\", zig_pkl.module(\"zig_pkl\"));\n","zig",[19,75,76,110,127,142,148],{"__ignoreMap":34},[38,77,78,82,86,89,92,96,100,103,107],{"class":40,"line":41},[38,79,81],{"class":80},"szBVR","const",[38,83,85],{"class":84},"s4XuR"," zig_pkl",[38,87,88],{"class":80}," =",[38,90,91],{"class":84}," b",[38,93,95],{"class":94},"sVt8B",".",[38,97,99],{"class":98},"sScJk","dependency",[38,101,102],{"class":94},"(",[38,104,106],{"class":105},"sZZnC","\"zig_pkl\"",[38,108,109],{"class":94},", .{\n",[38,111,113,116,119,121,124],{"class":40,"line":112},2,[38,114,115],{"class":94},"    .",[38,117,118],{"class":84},"target",[38,120,88],{"class":80},[38,122,123],{"class":84}," target",[38,125,126],{"class":94},",\n",[38,128,130,132,135,137,140],{"class":40,"line":129},3,[38,131,115],{"class":94},[38,133,134],{"class":84},"optimize",[38,136,88],{"class":80},[38,138,139],{"class":84}," optimize",[38,141,126],{"class":94},[38,143,145],{"class":40,"line":144},4,[38,146,147],{"class":94},"});\n",[38,149,151,154,156,159,161,164,166,168,171,174,176,179,181,183],{"class":40,"line":150},5,[38,152,153],{"class":84},"exe",[38,155,95],{"class":94},[38,157,158],{"class":84},"root_module",[38,160,95],{"class":94},[38,162,163],{"class":98},"addImport",[38,165,102],{"class":94},[38,167,106],{"class":105},[38,169,170],{"class":94},", ",[38,172,173],{"class":84},"zig_pkl",[38,175,95],{"class":94},[38,177,178],{"class":98},"module",[38,180,102],{"class":94},[38,182,106],{"class":105},[38,184,185],{"class":94},"));\n",[15,187,188,189,192,193,196,197,95],{},"The same dependency provides the ",[19,190,191],{},"zig-pkl-gen"," code generator as ",[19,194,195],{},"zig_pkl.artifact(\"zig-pkl-gen\")",". See ",[198,199,201],"a",{"href":200},"..\u002Fcodegen","Code generation",[24,203,205],{"id":204},"install-pkl","Install Pkl",[15,207,208,209,212,213,219,220,223],{},"zig-pkl talks to ",[19,210,211],{},"pkl server"," over standard input and output. Install Pkl 0.25.3 or newer from the ",[198,214,218],{"href":215,"rel":216},"https:\u002F\u002Fgithub.com\u002Fapple\u002Fpkl\u002Freleases",[217],"nofollow","Pkl releases"," or with a package manager, for example ",[19,221,222],{},"brew install pkl",". Code generation needs Pkl 0.32.2.",[15,225,226],{},"The library never searches for Pkl on its own. You pass the command that starts the server:",[29,228,230],{"className":71,"code":229,"language":73,"meta":34,"style":34},"const manager = try zig_pkl.Manager.init(allocator, io, &.{ \"pkl\", \"server\" }, zig_pkl.Logger.noop);\n",[19,231,232],{"__ignoreMap":34},[38,233,234,236,239,241,244,246,248,251,253,256,258,261,263,266,268,271,274,277,279,282,285,287,289,292,294,297],{"class":40,"line":41},[38,235,81],{"class":80},[38,237,238],{"class":84}," manager",[38,240,88],{"class":80},[38,242,243],{"class":80}," try",[38,245,85],{"class":84},[38,247,95],{"class":94},[38,249,250],{"class":84},"Manager",[38,252,95],{"class":94},[38,254,255],{"class":98},"init",[38,257,102],{"class":94},[38,259,260],{"class":84},"allocator",[38,262,170],{"class":94},[38,264,265],{"class":84},"io",[38,267,170],{"class":94},[38,269,270],{"class":80},"&",[38,272,273],{"class":94},".{ ",[38,275,276],{"class":105},"\"pkl\"",[38,278,170],{"class":94},[38,280,281],{"class":105},"\"server\"",[38,283,284],{"class":94}," }, ",[38,286,173],{"class":84},[38,288,95],{"class":94},[38,290,291],{"class":84},"Logger",[38,293,95],{"class":94},[38,295,296],{"class":84},"noop",[38,298,299],{"class":94},");\n",[15,301,302,303,305,306,309,310,313,314,95],{},"Use an absolute path when ",[19,304,21],{}," is not on ",[19,307,308],{},"PATH",". The examples in this repository read the path from the ",[19,311,312],{},"PKL_EXEC"," environment variable and fall back to ",[19,315,21],{},[24,317,319],{"id":318},"check-the-setup","Check the setup",[29,321,323],{"className":31,"code":322,"language":33,"meta":34,"style":34},"git clone https:\u002F\u002Fgithub.com\u002Fguanchzhou\u002Fzig-pkl\ncd zig-pkl\nzig build test\nzig build examples\n",[19,324,325,330,335,340],{"__ignoreMap":34},[38,326,327],{"class":40,"line":41},[38,328,329],{},"git clone https:\u002F\u002Fgithub.com\u002Fguanchzhou\u002Fzig-pkl\n",[38,331,332],{"class":40,"line":112},[38,333,334],{},"cd zig-pkl\n",[38,336,337],{"class":40,"line":129},[38,338,339],{},"zig build test\n",[38,341,342],{"class":40,"line":144},[38,343,344],{},"zig build examples\n",[15,346,347,350,351,357],{},[19,348,349],{},"zig build examples"," builds and runs every program in ",[198,352,354],{"href":353},"..\u002F..\u002Fexamples",[19,355,356],{},"examples\u002F",". It fails when Pkl cannot be started.",[359,360,361],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}",{"title":34,"searchDepth":112,"depth":112,"links":363},[364,365,366],{"id":26,"depth":112,"text":27},{"id":204,"depth":112,"text":205},{"id":318,"depth":112,"text":319},"zig-pkl needs Zig 0.17.0 and a pkl executable. It has no other dependencies.","md",{},true,"\u002Fguides\u002Finstallation",{"title":6,"description":367},"guides\u002Finstallation","1DQZx6cZCaHb0fiElNVsCyMTabV_HkocOhvBp4zFNlc","docs\u002Fguides\u002Finstallation.md",[377,381,385,389,393,397,398,402,406,410,414,418,422],{"title":378,"path":379,"stem":380},"Version compatibility","\u002Fguides\u002Fcompatibility","guides\u002Fcompatibility",{"title":382,"path":383,"stem":384},"Concurrency","\u002Fguides\u002Fconcurrency","guides\u002Fconcurrency",{"title":386,"path":387,"stem":388},"Errors","\u002Fguides\u002Ferrors","guides\u002Ferrors",{"title":390,"path":391,"stem":392},"Evaluation","\u002Fguides\u002Fevaluation","guides\u002Fevaluation",{"title":394,"path":395,"stem":396},"External readers","\u002Fguides\u002Fexternal-readers","guides\u002Fexternal-readers",{"title":6,"path":371,"stem":373},{"title":399,"path":400,"stem":401},"Logging","\u002Fguides\u002Flogging","guides\u002Flogging",{"title":403,"path":404,"stem":405},"Migrating from pkl-zig","\u002Fguides\u002Fmigration","guides\u002Fmigration",{"title":407,"path":408,"stem":409},"Ownership","\u002Fguides\u002Fownership","guides\u002Fownership",{"title":411,"path":412,"stem":413},"Projects","\u002Fguides\u002Fprojects","guides\u002Fprojects",{"title":415,"path":416,"stem":417},"Quick start","\u002Fguides\u002Fquickstart","guides\u002Fquickstart",{"title":419,"path":420,"stem":421},"Readers","\u002Fguides\u002Freaders","guides\u002Freaders",{"title":423,"path":424,"stem":425},"Security","\u002Fguides\u002Fsecurity","guides\u002Fsecurity",1792908673089]