Debian Codegraph @

debian/rust-vendor/nix/README.md

raw
1 # Rust bindings to *nix APIs
2
3 [![crates.io](https://img.shields.io/crates/v/nix.svg)](https://crates.io/crates/nix)
4 [![docs.rs](https://img.shields.io/badge/docs.rs-nix-blue?style=flat-square&logo=docs.rs)](https://docs.rs/nix)
5 ![maintenance-status](https://img.shields.io/badge/maintenance-actively--developed-brightgreen.svg)
6 [![msrv](https://img.shields.io/badge/msrv-1.69-blue?style=flat-square&logo=rust)](https://www.rust-lang.org)
7
8 Nix seeks to provide friendly bindings to various *nix platform APIs (Linux, Darwin,
9 ...). The goal is to not provide a 100% unified interface, but to unify
10 what can be while still providing platform specific APIs.
11
12 For many system APIs, Nix provides a safe alternative to the unsafe APIs
13 exposed by the [libc crate](https://github.com/rust-lang/libc). This is done by
14 wrapping the libc functionality with types/abstractions that enforce legal/safe
15 usage.
16
17
18 As an example of what Nix provides, examine the differences between what is
19 exposed by libc and nix for the
20 [gethostname](https://man7.org/linux/man-pages/man2/gethostname.2.html) system
21 call:
22
23 ```rust,ignore
24 // libc api (unsafe, requires handling return code/errno)
25 pub unsafe extern fn gethostname(name: *mut c_char, len: size_t) -> c_int;
26
27 // nix api (returns a nix::Result<OsString>)
28 pub fn gethostname() -> Result<OsString>;
29 ```
30
31 ## Supported Platforms
32
33 nix target support consists of three tiers. While nix attempts to support all
34 platforms supported by [libc](https://github.com/rust-lang/libc), only some
35 platforms are actively supported due to either technical or manpower
36 limitations. Support for platforms is split into three tiers:
37
38 * Tier 1 - Builds and tests for this target are run in CI. Failures of either
39 block the inclusion of new code.
40 * Tier 2 - Builds for this target are run in CI. Failures during the build
41 blocks the inclusion of new code. Tests may be run, but failures
42 in tests don't block the inclusion of new code.
43 * Tier 3 - Builds for this target are run in CI. Failures during the build
44 *do not* necessarily block the inclusion of new code. That is, at
45 our discretion a Tier 3 target may be dropped at any time, if it
46 would otherwise block development.
47
48 Platforms not listed are supported on a best-effort basis, relying on our users
49 to report any problems.
50
51 The following targets are supported by `nix`:
52
53 <table>
54 <tr>
55 <th>Tier 1</th>
56 <th>Tier 2</th>
57 <th>Tier 3</th>
58 </tr>
59 <tr>
60 <td>
61 <ul>
62 <li>aarch64-apple-darwin</li>
63 <li>aarch64-unknown-linux-gnu</li>
64 <li>arm-unknown-linux-gnueabi</li>
65 <li>armv7-unknown-linux-gnueabihf</li>
66 <li>i686-unknown-freebsd</li>
67 <li>i686-unknown-linux-gnu</li>
68 <li>i686-unknown-linux-musl</li>
69 <li>mips-unknown-linux-gnu</li>
70 <li>mips64-unknown-linux-gnuabi64</li>
71 <li>mips64el-unknown-linux-gnuabi64</li>
72 <li>mipsel-unknown-linux-gnu</li>
73 <li>powerpc64le-unknown-linux-gnu</li>
74 <li>x86_64-unknown-freebsd</li>
75 <li>x86_64-unknown-linux-gnu</li>
76 <li>x86_64-unknown-linux-musl</li>
77 </ul>
78 </td>
79 <td>
80 <ul>
81 <li>aarch64-apple-ios</li>
82 <li>aarch64-linux-android</li>
83 <li>aarch64-unknown-linux-ohos</li>
84 <li>arm-linux-androideabi</li>
85 <li>arm-unknown-linux-musleabi</li>
86 <li>armv7-linux-androideabi</li>
87 <li>armv7-unknown-linux-ohos</li>
88 <li>i686-linux-android</li>
89 <li>loongarch64-unknown-linux-gnu</li>
90 <li>s390x-unknown-linux-gnu</li>
91 <li>x86_64-linux-android</li>
92 <li>x86_64-unknown-illumos</li>
93 <li>x86_64-unknown-linux-ohos</li>
94 <li>x86_64-unknown-netbsd</li>
95 </td>
96 <td>
97 <li>armv7-unknown-linux-uclibceabihf</li>
98 <li>powerpc64-unknown-linux-gnu</li>
99 <li>x86_64-unknown-fuchsia</li>
100 <li>x86_64-unknown-dragonfly</li>
101 <li>x86_64-unknown-haiku</li>
102 <li>x86_64-unknown-linux-gnux32</li>
103 <li>x86_64-unknown-openbsd</li>
104 <li>x86_64-unknown-redox</li>
105 <li>i686-unknown-hurd-gnu</li>
106 </td>
107 </tr>
108 </table>
109
110 ## Minimum Supported Rust Version (MSRV)
111
112 nix is supported on Rust 1.69 and higher. Its MSRV will not be
113 changed in the future without bumping the major or minor version.
114
115 ## Contributing
116
117 Contributions are very welcome. Please See [CONTRIBUTING](CONTRIBUTING.md) for
118 additional details.
119
120 Feel free to join us in [the nix-rust/nix](https://discord.com/invite/rkBeJUsmyd) channel on Discord to
121 discuss `nix` development.
122
123 ## License
124
125 Nix is licensed under the MIT license. See [LICENSE](LICENSE) for more details.