Configure hermetic development environment: - fenix toolchain from rust-toolchain.toml - clangStdenv for Tree-sitter C grammar compilation - Multi-platform devShells (x86_64/aarch64, linux/darwin) - Generated flake.lock with pinned inputs
53 lines
1.3 KiB
Nix
53 lines
1.3 KiB
Nix
{
|
|
description = "nrd.sh - bespoke static site compiler";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
fenix = {
|
|
url = "github:nix-community/fenix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
fenix,
|
|
}:
|
|
let
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
];
|
|
forAllSystems = fn: nixpkgs.lib.genAttrs systems (system: fn system);
|
|
in
|
|
{
|
|
devShells = forAllSystems (
|
|
system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
fenixPkgs = fenix.packages.${system};
|
|
toolchain = fenixPkgs.fromToolchainFile { file = ./rust-toolchain.toml; sha256 = "sha256-vra6TkHITpwRyA5oBKAHSX0Mi6CBDNQD+ryPSpxFsfg=";};
|
|
in
|
|
{
|
|
default = pkgs.mkShell.override { stdenv = pkgs.clangStdenv; } {
|
|
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
|
packages =
|
|
[
|
|
toolchain
|
|
fenixPkgs.default.rustfmt
|
|
pkgs.pkg-config
|
|
]
|
|
++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
|
|
pkgs.apple-sdk
|
|
pkgs.libiconv
|
|
];
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|