{ description = "Environnement de développement pour des modules noyaux Linux"; inputs = { nixpkgs.url = "nixpkgs"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { nixpkgs, flake-utils, ... }: flake-utils.lib.eachSystem flake-utils.lib.allSystems (system: let pkgs = import nixpkgs { inherit system; }; linux = pkgs.linuxKernel.kernels.linux_zen; packages = with pkgs; [ clang-tools ]; in { devShells = rec { default = nixos; nixos = pkgs.mkShell { packages = [ linux.moduleBuildDependencies ] ++ packages; LINUX_MODULES_FOLDER = "${linux.dev}/lib/modules/${linux.modDirVersion}"; # Needed to build rust-analyzer conf to avoid error "Source code for the 'core' standard library could not be found" # with check condition in below of $LINUX_MODULES_FOLDER/source/scripts/rust_is_available.sh file # https://github.com/NixOS/nixpkgs/blob/6313551cd05425cd5b3e63fe47dbc324eabb15e4/pkgs/os-specific/linux/kernel/generic.nix#L154 RUST_LIB_SRC = pkgs.rustPlatform.rustLibSrc; shellHook = '' echo "Current Linux Kernel used : ${linux.version}" ''; }; other = pkgs.mkShell { inherit packages; shellHook = '' export LINUX_MODULES_FOLDER=/lib/modules/$(uname -r) echo "Current Linux Kernel used : $(uname -r)" ''; }; }; } ); }