1 # Hare {#sec-language-hare}
3 ## Building Hare programs with `hareHook` {#ssec-language-hare}
5 The `hareHook` package sets up the environment for building Hare programs by
8 1. Setting the `HARECACHE`, `HAREPATH` and `NIX_HAREFLAGS` environment variables;
9 1. Propagating `harec`, `qbe` and two wrapper scripts for the hare binary.
11 It is not a function as is the case for some other languages --- *e. g.*, Go or
12 Rust ---, but a package to be added to `nativeBuildInputs`.
14 ## Attributes of `hareHook` {#hareHook-attributes}
16 The following attributes are accepted by `hareHook`:
18 1. `hareBuildType`: Either `release` (default) or `debug`. It controls if the
19 `-R` flag is added to `NIX_HAREFLAGS`.
21 ## Example for `hareHook` {#ex-hareHook}
28 }: stdenv.mkDerivation {
30 version = "<version>";
33 nativeBuildInputs = [ hareHook ];
36 description = "<description>";
37 inherit (hareHook) badPlatforms platforms;
42 ## Cross Compilation {#hareHook-cross-compilation}
44 `hareHook` should handle cross compilation out of the box. This is the main
45 purpose of `NIX_HAREFLAGS`: In it, the `-a` flag is passed with the architecture
46 of the `hostPlatform`.
48 However, manual intervention may be needed when a binary compiled by the build
49 process must be run for the build to complete --- *e. g.*, when using Hare's
50 `hare` module for code generation.
52 In those cases, `hareHook` provides the `hare-native` script, which is a wrapper
53 around the hare binary for using the native (`buildPlatform`) toolchain.