summaryrefslogtreecommitdiffstats
path: root/configs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-21 14:59:14 +0000
committertv <tv@krebsco.de>2026-11-21 16:22:47 +0100
commitd0327b65df5ee88eb19e1714287ff18655c1018e (patch)
treed20cb34dbce2a2e7a547a8b9e17d9523e4dc9942 /configs
parent0c5656e6277aefcb3704ab1715e81a6ab7462bc4 (diff)
configs/rust: a layer with Rust, for building and testing Rust projects
cargo, clippy, rustc and rustfmt from the host's nixpkgs, for every user (so in the remotes' PATH), and what crates' build scripts commonly need: nixpkgs' wrapped cc and pkg-config, and OpenSSL, with pkg-config finding the system's .pc files through PKG_CONFIG_PATH. Meant to go below the layers that change more often, as its image is big and changes rarely.
Diffstat (limited to 'configs')
-rw-r--r--configs/rust.nix30
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";
+}