summaryrefslogtreecommitdiffstats
path: root/configs/rust.nix
blob: 739156992819ca596b7da4ce28ad0f8fa78997be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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";
}