mirror of
https://github.com/xddxdd/nix-cachyos-kernel.git
synced 2026-07-03 19:18:07 +02:00
Add overlay and example NixOS configuration
This commit is contained in:
parent
b865f72390
commit
b4b0598879
21
README.md
21
README.md
@ -41,11 +41,26 @@ Add this repo to the inputs section of your `flake.nix`:
|
||||
}
|
||||
```
|
||||
|
||||
And then specify `inputs.nix-cachyos-kernel.legacyPackages.${pkgs.system}.linuxPackages-cachyos-latest` (or other variants you'd like) in your `boot.kernelPackages` option:
|
||||
Add the repo's overlay in your NixOS configuration, this will expose the packages in this flake as `pkgs.cachyosKernels.*`.
|
||||
|
||||
Then specify `pkgs.cachyosKernels.linuxPackages-cachyos-latest` (or other variants you'd like) in your `boot.kernelPackages` option.
|
||||
|
||||
### Example configuration
|
||||
|
||||
```nix
|
||||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
boot.kernelPackages = inputs.nix-cachyos-kernel.legacyPackages.${pkgs.system}.linuxPackages-cachyos-latest
|
||||
nixosConfigurations.example = inputs.nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
(
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
nixpkgs.overlays = [ self.overlay ];
|
||||
boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest;
|
||||
# ... your other configs
|
||||
}
|
||||
)
|
||||
];
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
50
flake.nix
50
flake.nix
@ -20,7 +20,19 @@
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
let
|
||||
loadPackages =
|
||||
pkgs:
|
||||
lib.removeAttrs
|
||||
(pkgs.callPackage ./kernel-cachyos {
|
||||
inherit inputs;
|
||||
})
|
||||
[
|
||||
"override"
|
||||
"overrideDerivation"
|
||||
];
|
||||
in
|
||||
rec {
|
||||
systems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-linux"
|
||||
@ -33,12 +45,42 @@
|
||||
}:
|
||||
rec {
|
||||
# Legacy packages contain linux-cachyos-* and linuxPackages-cachyos-*
|
||||
legacyPackages = pkgs.callPackage ./kernel-cachyos {
|
||||
inherit inputs;
|
||||
};
|
||||
legacyPackages = loadPackages pkgs;
|
||||
|
||||
# Packages only contain linux-cachyos-* due to Flake schema requirements
|
||||
packages = lib.filterAttrs (_: lib.isDerivation) legacyPackages;
|
||||
};
|
||||
|
||||
flake = {
|
||||
overlay = self.overlays.default;
|
||||
overlays.default = final: prev: {
|
||||
cachyosKernels = loadPackages prev;
|
||||
};
|
||||
|
||||
nixosConfigurations = lib.genAttrs systems (
|
||||
system:
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
(
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
nixpkgs.overlays = [ self.overlay ];
|
||||
boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest;
|
||||
|
||||
# Minimal config to make test configuration build
|
||||
boot.loader.grub.devices = [ "/dev/vda" ];
|
||||
fileSystems."/" = {
|
||||
device = "tmpfs";
|
||||
fsType = "tmpfs";
|
||||
};
|
||||
system.stateVersion = lib.trivial.release;
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user