I add it as a flake:
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = {
self,
nixpkgs,
home-manager,
hardware,
...
} @ inputs: let
inherit (self) outputs;
in {
nixosConfigurations = {
nixos = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./nixos/configuration.nix
hardware.nixosModules.microsoft-surface-pro-intel
];
};
};
I am sorry, but I have tried in so many different ways and the kernel
variable doesn’t want to get changed. Could you please provide me with the code that just changes the kernel
variable? I have so far tried to do it in three different ways:
- Using pkgs.linux.override:
boot.kernelPackages = pkgs.linuxPackagesFor (pkgs.linux.override {
argsOverride = {
src = pkgs.stdenv.mkDerivation {
kernel = ...
};
};
});
I can change other variables with this, but not the kernel
one. When I provide src
, etc, it builds, but it starts compiling the kernel from source, so it’s like the variable isn’t read.
- Using the code you provided:
boot.kernelPackages = pkgs.linuxPackages_6_6 // {
kernel = ...;
}
Here, it just skips the row setting kernel
entierly. No error message, but it just grabs the stock kernel from cache.
- I also tried (using this: Linux kernel - NixOS Wiki) to write an overlay:
(self: super: {
linuxPackages = super.linuxPackages.extend (lpself: lpsuper: {
kernel = super.linuxPackages.kernel.overrideAttrs (oldAttrs: {
kernel = ...;
});
});
})
but here’s the error message:
error:
… while calling the 'head' builtin
at /nix/store/5hwz775f3grzikafj1sbwx4lqkjwqswb-source/lib/attrsets.nix:922:11:
921| || pred here (elemAt values 1) (head values) then
922| head values
| ^
923| else
… while evaluating the attribute 'value'
at /nix/store/5hwz775f3grzikafj1sbwx4lqkjwqswb-source/lib/modules.nix:807:9:
806| in warnDeprecation opt //
807| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
808| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error:
Failed assertions:
- CONFIG_DEVTMPFS is not enabled!
- CONFIG_CGROUPS is not enabled!
- CONFIG_INOTIFY_USER is not enabled!
- CONFIG_SIGNALFD is not enabled!
- CONFIG_TIMERFD is not enabled!
- CONFIG_EPOLL is not enabled!
- CONFIG_NET is not enabled!
- CONFIG_SYSFS is not enabled!
- CONFIG_PROC_FS is not enabled!
- CONFIG_FHANDLE is not enabled!
- CONFIG_CRYPTO_USER_API_HASH is not enabled!
- CONFIG_CRYPTO_HMAC is not enabled!
- CONFIG_CRYPTO_SHA256 is not enabled!
- CONFIG_DMIID is not enabled!
- CONFIG_AUTOFS_FS is not enabled!
- CONFIG_TMPFS_POSIX_ACL is not enabled!
- CONFIG_TMPFS_XATTR is not enabled!
- CONFIG_SECCOMP is not enabled!
- CONFIG_TMPFS is not yes!
- CONFIG_BLK_DEV_INITRD is not yes!
- CONFIG_EFI_STUB is not yes!
- CONFIG_BINFMT_ELF is not yes!
- CONFIG_UNIX is not enabled!
- CONFIG_INOTIFY_USER is not yes!
- CONFIG_NET is not yes!
The error messages thrown are almost always unintelligible for me.
I have tried looking into the code for the kernel package here: https://github.com/NixOS/nixpkgs/blob/0d5533510c63349cd6848bf7c1a00c293e058da4/nixos/modules/system/boot/kernel.nix, but it doesn’t help me in finding a way to change the variable.