diff options
| -rw-r--r-- | configs/rust.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/configs/rust.nix b/configs/rust.nix new file mode 100644 index 0000000..7391569 --- /dev/null +++ b/configs/rust.nix @@ -0,0 +1,30 @@ +# Rust, for building and testing Rust projects (cargo, clippy, rustfmt), +# with what crates' build scripts commonly need: a C compiler, pkg-config, +# and OpenSSL to link to. From the host's nixpkgs, for every user, and +# so in the remotes' PATH (see configs/claude.nix). Crates come from +# crates.io, which the egress has to allow: +# fc-egress -v NAME allow https://index.crates.io https://static.crates.io +# The toolchain is big and changes rarely: put this into the layers below +# the ones that change more often, so their changes don't rebuild its image: +# --arg layers '[ layers/nix.nix .../configs/rust.nix .../configs/claude.nix ]' +{ pkgs, ... }: +{ + environment.systemPackages = [ + pkgs.cargo + pkgs.clippy + pkgs.rustc + pkgs.rustfmt + # cc (the linker cargo uses, too) and pkg-config, as nixpkgs wraps + # them: the C compiler finds its libc, and links store paths with an + # rpath to them. + pkgs.stdenv.cc + pkgs.pkg-config + pkgs.openssl.dev + ]; + + # The .pc files of the system's packages, for pkg-config, which looks + # only in its own package by default. In the environment of login + # shells, like those of the remotes' Bash tool. + environment.pathsToLink = [ "/lib/pkgconfig" "/share/pkgconfig" ]; + environment.variables.PKG_CONFIG_PATH = "/run/current-system/sw/lib/pkgconfig:/run/current-system/sw/share/pkgconfig"; +} |
