Signed-off-by: faumaray <faumaray@gmail.com>
This commit is contained in:
faumaray committed 2026-10-29 16:02:14 +03:00
1 parent 80ec3dfdd3
commit 079cceb554
57 files changed
+4092 -538

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
# C/C++ shells: the same tools on two compilers.
# cpp Clang/LLVM (clangStdenv): cc and c++ are clang, CC=clang, CXX=clang++
# cpp-gcc GCC (stdenv): CC=gcc, CXX=g++
# Both carry CMake, Ninja, Meson, pkg-config, clang-tools (clangd, clang-format,
# clang-tidy; the clangd wrapper adds the shell's include paths), lldb, gdb,
# cppcheck, valgrind and GoogleTest. The cc-wrapper's hardening flags are off,
# so sanitizers and -O0 builds behave as on other distributions, and CMake
# writes compile_commands.json, which clangd reads from build/.
# Knob: `llvm`, the LLVM release behind clang, clangd and lldb.
{
perSystem =
{ lib, pkgs, ... }:
let
llvm = pkgs.llvmPackages;
cppShell = stdenv: description: {
inherit stdenv description;
packages = [
pkgs.cmake
pkgs.ninja
pkgs.meson
pkgs.pkg-config
llvm.clang-tools
llvm.lldb
pkgs.gdb
pkgs.cppcheck
pkgs.valgrind
pkgs.gtest
];
env.CMAKE_EXPORT_COMPILE_COMMANDS = "ON";
hardeningDisable = [ "all" ];
};
vulkanShell = stdenv: description: {
inherit stdenv description;
packages = [
pkgs.cmake
pkgs.ninja
pkgs.meson
pkgs.pkg-config
llvm.clang-tools
llvm.lldb
pkgs.gdb
pkgs.cppcheck
pkgs.valgrind
pkgs.gtest
pkgs.glfw
pkgs.glfw.dev
pkgs.glslang
pkgs.shaderc
pkgs.vulkan-headers
pkgs.vulkan-loader
pkgs.vulkan-validation-layers
pkgs.freetype
pkgs.vulkan-tools-lunarg
pkgs.vulkan-memory-allocator
pkgs.vulkan-extension-layer
pkgs.shader-slang
pkgs.shader-slang.dev
pkgs.libarchive.dev
pkgs.libarchive.lib
pkgs.openssl.dev
pkgs.libsodium.dev
pkgs.libsodium
pkgs.sqlite.dev
pkgs.sqlite
];
env.CMAKE_EXPORT_COMPILE_COMMANDS = "ON";
env.VULKAN_SDK = "${pkgs.vulkan-headers}";
env.VK_LAYER_PATH = "${pkgs.vulkan-validation-layers}/share/vulkan/explicit_layer.d";
hardeningDisable = [ "all" ];
};
in
{
shells = {
cpp = cppShell llvm.stdenv "C/C++ with Clang ${lib.getVersion llvm.clang}: CMake, Ninja, Meson, clangd, lldb/gdb, cppcheck, valgrind, gtest";
cpp-gcc = cppShell pkgs.stdenv "C/C++ with GCC ${lib.getVersion pkgs.stdenv.cc.cc}, the tools of `cpp`";
vulkan-gcc = vulkanShell pkgs.stdenv "C/C++ with GCC ${lib.getVersion pkgs.stdenv.cc.cc}, the tools of `cpp` with Vulkan";
vulkan = vulkanShell llvm.stdenv "C/C++ with GCC ${lib.getVersion pkgs.stdenv.cc.cc}, the tools of `cpp` with Vulkan";
};
};
}
+18
View File
@@ -0,0 +1,18 @@
# Rust and C/C++ in one shell (FFI, cxx, bindgen, -sys crates built with CMake):
# everything from `cpp` and `rust`, compiled with the cpp shell's Clang. Also an
# example of composing shells: copy this file to combine others.
{
perSystem =
{ pkgs, ... }:
{
shells.rust-cpp = {
description = "rust + cpp on Clang, with bindgen's libclang";
extends = [
"cpp"
"rust"
];
# LIBCLANG_PATH and BINDGEN_EXTRA_CLANG_ARGS for bindgen.
packages = [ pkgs.rustPlatform.bindgenHook ];
};
};
}
+59
View File
@@ -0,0 +1,59 @@
# Rust shells. The toolchain is fenix's (inputs.fenix): rustc, cargo, clippy,
# rustfmt, rust-src, llvm-tools and the rust-analyzer of the same release, so the
# editor's language server (rustaceanvim) always matches the compiler.
# rust stable
# rust-nightly the latest nightly, same components and tools
# Knob: the fenix channel given to `rustShell`: "stable", "beta" or "latest"
# (nightly). A project pinned by rust-toolchain.toml is better served by a flake
# of its own (fenix.packages.<system>.fromToolchainFile).
{
perSystem =
{ inputs', pkgs, ... }:
let
rustShell =
channel: description:
let
toolchain = inputs'.fenix.packages.${channel}.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
"rust-analyzer"
"llvm-tools" # llvm-cov and llvm-profdata for cargo-llvm-cov
];
in
{
inherit description;
packages = [
toolchain
pkgs.cargo-nextest
pkgs.cargo-expand
pkgs.cargo-edit
pkgs.bacon
# Debuggers (codelldb for nvim-dap comes with the editor, modules/cli/neovim.nix).
pkgs.lldb
pkgs.gdb
# -sys crates (openssl-sys, ...) find their C libraries through pkg-config.
pkgs.pkg-config
pkgs.openssl
pkgs.dav1d
pkgs.libvpx
pkgs.alsa-lib
pkgs.alsa-lib.dev
pkgs.libopus
pkgs.fontconfig
pkgs.pipewire
pkgs.pipewire.dev
pkgs.fontconfig.dev
];
env.RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
};
in
{
shells = {
rust = rustShell "stable" "Rust stable (fenix): cargo, clippy, rustfmt, rust-analyzer, nextest, llvm-cov, bacon, lldb/gdb";
rust-nightly = rustShell "latest" "Rust nightly (fenix latest) with the tools of `rust`";
};
};
}