flake.nix Add support of other distro with interpreted shell

This commit is contained in:
Florian RICHER 2025-02-10 13:03:56 +01:00
parent ca2332a6c9
commit 9d9b5d8985
2 changed files with 14 additions and 3 deletions

View file

@ -9,7 +9,9 @@ Otherwise, change linux_dev variable with you kernel variant and change flake.lo
On other distros:
- You need to setup LINUX_MODULES_FOLDER to linux modules folder of your distro (ex: `/lib/modules/$(uname -r)/build`) in flake.nix
1. With Nix env, .envrc, change line by `use flake .#other`
2. Without Nix env, you need to setup LINUX_MODULES_FOLDER to linux modules folder of your distro (ex: `/lib/modules/$(uname -r)`) in your shell (bashrc)
## make : targets list

View file

@ -16,8 +16,10 @@
linux = pkgs.linuxKernel.kernels.linux_zen;
in {
devShells = {
default = pkgs.mkShell {
devShells = rec {
default = nixos;
nixos = pkgs.mkShell {
packages = [ linux.moduleBuildDependencies ];
LINUX_MODULES_FOLDER = "${linux.dev}/lib/modules/${linux.modDirVersion}";
@ -26,6 +28,13 @@
echo "Current Linux Kernel used : ${linux.version}"
'';
};
other = pkgs.mkShell {
shellHook = ''
export LINUX_MODULES_FOLDER=/lib/modules/$(uname -r)
echo "Current Linux Kernel used : $(uname -r)"
'';
};
};
}
);