Skip to content

Commit

Permalink
Merge pull request #516 from nix-community/zfs
Browse files Browse the repository at this point in the history
add latest zfs-kernel mixin
  • Loading branch information
Mic92 authored Sep 22, 2024
2 parents a432e71 + aba9ec6 commit 3d63210
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
6 changes: 6 additions & 0 deletions dev/test-configurations.nix
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ in
self.nixosModules.mixins-nginx
];
};
examples-mixin-latest-zfs-kernel = nixosSystem {
modules = [
dummy
self.nixosModules.mixins-latest-zfs-kernel
];
};

# Roles
example-roles-github-actions-runner = nixosSystem {
Expand Down
7 changes: 4 additions & 3 deletions nixos/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ exposeModules ./. [
./hardware/hetzner-cloud/arm.nix
./hardware/hetzner-online/amd.nix
./hardware/hetzner-online/arm.nix
./hardware/hetzner-online/intel.nix
./hardware/hetzner-online/ex101.nix
./hardware/hetzner-online/intel.nix
./hardware/vultr/bare-metal.nix
./hardware/vultr/vm.nix
./mixins/cloud-init.nix
./mixins/latest-zfs-kernel.nix
./mixins/mdns.nix
./mixins/nginx.nix
./mixins/nix-experimental.nix
./mixins/systemd-boot.nix
./mixins/telegraf.nix
./mixins/terminfo.nix
./mixins/tracing.nix
./mixins/trusted-nix-caches.nix
./mixins/nix-experimental.nix
./mixins/mdns.nix
./roles/github-actions-runner.nix
./roles/nix-remote-builder.nix
./roles/prometheus
Expand Down
19 changes: 19 additions & 0 deletions nixos/mixins/latest-zfs-kernel.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ lib, pkgs, ... }:
let
latestZfsCompatibleLinuxPackages = lib.pipe pkgs.linuxKernel.packages [
builtins.attrValues
(builtins.filter (
kPkgs:
(builtins.tryEval kPkgs).success
&& kPkgs ? kernel
&& kPkgs.kernel.pname == "linux"
&& !kPkgs.zfs.meta.broken
))
(builtins.sort (a: b: (lib.versionOlder a.kernel.version b.kernel.version)))
lib.last
];
in
{
# Note this might jump back and worth as kernel get added or removed.
boot.kernelPackages = latestZfsCompatibleLinuxPackages;
}

0 comments on commit 3d63210

Please sign in to comment.