Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 28 lines 671 B view raw
1{ 2 hare, 3 runCommandNoCC, 4 writeText, 5}: 6let 7 mainDotHare = writeText "main.ha" '' 8 use fmt; 9 use mime; 10 export fn main() void = { 11 const ext = "json"; 12 match(mime::lookup_ext(ext)) { 13 case let mime: const *mime::mimetype => 14 fmt::printfln("Found mimetype for extension `{}`: {}", ext, mime.mime)!; 15 case null => 16 fmt::fatalf("Could not find mimetype for `{}`", ext); 17 }; 18 }; 19 ''; 20in 21runCommandNoCC "mime-module-test" { nativeBuildInputs = [ hare ]; } '' 22 HARECACHE="$(mktemp -d)" 23 export HARECACHE 24 readonly binout="test-bin" 25 hare build -qRo "$binout" ${mainDotHare} 26 ./$binout 27 : 1>$out 28''