Use same stdenv for kernel and ZFS (#14)

This commit is contained in:
Lan Tian 2025-12-23 19:02:37 -08:00
parent 6165a9592d
commit 4d1b0c56ac
No known key found for this signature in database
GPG Key ID: 04E66B6B25A0862B
2 changed files with 45 additions and 35 deletions

View File

@ -44,9 +44,11 @@
kernels
// packages
// {
zfs-cachyos = pkgs.callPackage ./zfs-cachyos {
zfs-cachyos = packages.linuxPackages-cachyos-latest.callPackage ./zfs-cachyos {
inherit inputs;
};
zfs-cachyos-lto = packages.linuxPackages-cachyos-latest-lto.callPackage ./zfs-cachyos {
inherit inputs;
kernel = kernels.linux-cachyos-latest;
};
};
in
@ -84,37 +86,48 @@
cachyosKernels = self.legacyPackages."${final.stdenv.hostPlatform.system}";
};
hydraJobs.packages = self.packages;
hydraJobs = {
inherit (self) packages;
nixosConfigurations = lib.mapAttrs (n: v: v.config.system.build.toplevel) self.nixosConfigurations;
};
# Example configurations for testing CachyOS kernel
nixosConfigurations = lib.genAttrs systems (
system:
inputs.nixpkgs.lib.nixosSystem {
inherit system;
modules = [
(
{ pkgs, config, ... }:
{
nixpkgs.overlays = [ self.overlays.pinned ];
boot.kernelPackages = pkgs.cachyosKernels.linuxPackages-cachyos-latest;
nixosConfigurations =
let
mkSystem =
kernelPackageName:
inputs.nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(
{ pkgs, config, ... }:
{
nixpkgs.overlays = [ self.overlays.pinned ];
boot.kernelPackages = pkgs.cachyosKernels."${kernelPackageName}";
# ZFS test
boot.supportedFilesystems.zfs = true;
boot.zfs.package = config.boot.kernelPackages.zfs_cachyos;
networking.hostId = "12345678";
# ZFS test
boot.supportedFilesystems.zfs = true;
boot.zfs.package = config.boot.kernelPackages.zfs_cachyos;
networking.hostId = "12345678";
# Minimal config to make test configuration build
boot.loader.grub.devices = [ "/dev/vda" ];
fileSystems."/" = {
device = "tmpfs";
fsType = "tmpfs";
};
system.stateVersion = lib.trivial.release;
}
)
];
}
);
# Minimal config to make test configuration build
boot.loader.grub.devices = [ "/dev/vda" ];
fileSystems."/" = {
device = "tmpfs";
fsType = "tmpfs";
};
system.stateVersion = lib.trivial.release;
}
)
];
};
in
{
cachyos-latest = mkSystem "linuxPackages-cachyos-latest";
cachyos-latest-lto = mkSystem "linuxPackages-cachyos-latest-lto";
cachyos-lts = mkSystem "linuxPackages-cachyos-lts";
cachyos-lts-lto = mkSystem "linuxPackages-cachyos-lts-lto";
};
};
}
);

View File

@ -14,15 +14,12 @@ in
lib.mapAttrs' (
n: v:
let
zfsPackage = callPackage ../zfs-cachyos {
inherit inputs;
kernel = v;
};
packages = kernelModuleLLVMOverride (
(linuxKernel.packagesFor v).extend (
final: prev: {
zfs_cachyos = zfsPackage;
zfs_cachyos = final.callPackage ../zfs-cachyos {
inherit inputs;
};
}
)
);