Merge pull request #281 from nix-community/zfs-latest
installer: add our own latestZfsCompatibleLinuxPackages
This commit is contained in:
commit
776ee2484d
3 changed files with 33 additions and 8 deletions
|
@ -18,11 +18,11 @@
|
||||||
},
|
},
|
||||||
"nixos-unstable": {
|
"nixos-unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726658796,
|
"lastModified": 1726798147,
|
||||||
"narHash": "sha256-SiiWCVg/W8i6jvpgQj3NNd3YtV+jfnn/t3Za7hfn1iE=",
|
"narHash": "sha256-k/Ojv+MUDKUbj8JPd1MulJrf5BVz3jIUfrreMHbeTBE=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "75ac2a58e988a346960938ab16cea903a3cb053a",
|
"rev": "e88358265511d3a73b30dc6e4c15579844b35280",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
./latest-zfs-kernel.nix
|
||||||
|
./nix-settings.nix
|
||||||
|
];
|
||||||
# more descriptive hostname than just "nixos"
|
# more descriptive hostname than just "nixos"
|
||||||
networking.hostName = lib.mkDefault "nixos-installer";
|
networking.hostName = lib.mkDefault "nixos-installer";
|
||||||
|
|
||||||
|
@ -16,7 +20,6 @@
|
||||||
|
|
||||||
# use latest kernel we can support to get more hardware support
|
# use latest kernel we can support to get more hardware support
|
||||||
boot.zfs.package = pkgs.zfsUnstable;
|
boot.zfs.package = pkgs.zfsUnstable;
|
||||||
boot.kernelPackages = pkgs.zfsUnstable.latestCompatibleLinuxPackages;
|
|
||||||
|
|
||||||
documentation.enable = false;
|
documentation.enable = false;
|
||||||
documentation.man.man-db.enable = false;
|
documentation.man.man-db.enable = false;
|
||||||
|
@ -33,10 +36,6 @@
|
||||||
# alternative to nixos-generate-config
|
# alternative to nixos-generate-config
|
||||||
] ++ lib.optional (pkgs.lib.versionAtLeast lib.version "24.11") pkgs.nixos-facter;
|
] ++ lib.optional (pkgs.lib.versionAtLeast lib.version "24.11") pkgs.nixos-facter;
|
||||||
|
|
||||||
imports = [
|
|
||||||
./nix-settings.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
# Don't add nixpkgs to the image to save space, for our intended use case we don't need it
|
# Don't add nixpkgs to the image to save space, for our intended use case we don't need it
|
||||||
system.installer.channel.enable = false;
|
system.installer.channel.enable = false;
|
||||||
}
|
}
|
||||||
|
|
26
nix/latest-zfs-kernel.nix
Normal file
26
nix/latest-zfs-kernel.nix
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
isUnstable = config.boot.zfs.package == pkgs.zfsUnstable;
|
||||||
|
zfsCompatibleKernelPackages = lib.filterAttrs (
|
||||||
|
name: kernelPackages:
|
||||||
|
(builtins.match "linux_[0-9]+_[0-9]+" name) != null
|
||||||
|
&& (builtins.tryEval kernelPackages).success
|
||||||
|
&& (
|
||||||
|
(!isUnstable && !kernelPackages.zfs.meta.broken)
|
||||||
|
|| (isUnstable && !kernelPackages.zfs_unstable.meta.broken)
|
||||||
|
)
|
||||||
|
) pkgs.linuxKernel.packages;
|
||||||
|
latestKernelPackage = lib.last (
|
||||||
|
lib.sort (a: b: (lib.versionOlder a.kernel.version b.kernel.version)) (builtins.attrValues zfsCompatibleKernelPackages)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# Note this might jump back and worth as kernel get added or removed.
|
||||||
|
boot.kernelPackages = latestKernelPackage;
|
||||||
|
}
|
Loading…
Reference in a new issue