feat: use fenix for cargo, add dynamic linking and pkg-config paths

This commit is contained in:
2026-01-17 12:52:13 -08:00
parent ee0cb47e34
commit 68588f5d72
5 changed files with 86 additions and 1 deletions

View File

@@ -50,7 +50,6 @@
gnumake
watchman
bat
rustup
emote
pkg-config
openssl

View File

@@ -21,5 +21,6 @@
./dns.nix
./mounts.nix
./nfs-mesh.nix
./rust.nix
];
}

41
nix/modules/rust.nix Normal file
View File

@@ -0,0 +1,41 @@
{
pkgs,
lib,
config,
inputs,
...
}:
{
options.rust = {
enable = lib.mkEnableOption "enable rust" // {
default = true;
};
};
config = lib.mkIf config.rust.enable {
nixpkgs.overlays = [ inputs.fenix.overlays.default ];
environment.systemPackages = with pkgs; [
(pkgs.fenix.stable.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
])
openssl
pkgconf
];
environment.variables = {
PKG_CONFIG_PATH =
with pkgs;
lib.makeSearchPath "/lib/pkgconfig" [
openssl.dev
];
LD_LIBRARY_PATH = "/run/current-system/sw/share/nix-ld/lib";
};
programs.nix-ld.libraries = with pkgs; [
openssl
zlib
];
};
}