Edit: I just realized that kernelPackages = pkgs.linuxPackages_5_14;
is available, and using that in my config instead of pkgs.linuxPackages
or pkgs.linuxPackages_latest
solves the problem for now. Hopefully 5.14 isn’t EoL’d until a ZFS version compatible with linuxPackages_latest
makes into Nixpkgs.
Looks like it’s that time in the release cycle when ZFS builds temporarily fail to build. Based on last time I expect this will resolve itself soon. Just recording here for posterity, and perhaps discussion on ways of preventing this temporary breakage.
$> nixos-rebuild -v --show-trace dry-build
...
evaluating file '/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/security/wrappers/wrapper.nix'
evaluating file '/nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/os-specific/linux/kmod/aggregator.nix'
error: while evaluating the attribute 'buildCommand' of the derivation 'nixos-system-z11pa-d8-21.05.4116.46251a79f75' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating 'optionalString' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/strings.nix:202:5, called from /nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix:36:9:
while evaluating the attribute 'passAsFile' of the derivation 'kernel-modules' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/make-derivation.nix:201:11:
while evaluating the attribute 'passAsFile' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/build-support/buildenv/default.nix:77:5:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:358:14, called from undefined position:
while evaluating the attribute 'value' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:570:27:
while evaluating anonymous function at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:559:17, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:559:12:
while evaluating 'check' at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/types.nix:349:15, called from /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:559:22:
while evaluating the attribute 'handled' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/check-meta.nix:302:7:
while evaluating 'handleEvalIssue' at /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/check-meta.nix:188:38, called from /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/stdenv/generic/check-meta.nix:303:14:
Package ‘zfs-kernel-2.0.6-5.15.2’ in /nix/store/vj38s3mv3gs11dcqv5ihsasjp7gqz7j8-nixos-21.05.4116.46251a79f75/nixos/pkgs/os-specific/linux/zfs/default.nix:175 is marked as broken, refusing to evaluate.
a) To temporarily allow broken packages, you can use an environment variable
for a single invocation of the nix tools.
$ export NIXPKGS_ALLOW_BROKEN=1
b) For `nixos-rebuild` you can set
{ nixpkgs.config.allowBroken = true; }
in configuration.nix to override this.
c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
{ allowBroken = true; }
to ~/.config/nixpkgs/config.nix.
$>
Relevant configuration.nix
settings:
boot = {
kernelPackages = pkgs.linuxPackages_latest;
supportedFilesystems = [ "vfat" "zfs" ];
initrd = {
network.ssh.enable = true;
supportedFilesystems = [ "vfat" "zfs" ];
};
zfs = {
requestEncryptionCredentials =
true;
};
loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables =
true; # required for mirroredBoots; must be disabled if efiInstallAsRemovable=true
efiSysMountPoint =
"/boot1"; # /boot is default for single-drive boot config, /boot1 or /boot2 for mirrored boots
};
grub = {
version = 2;
enable = true;
device = "nodev"; # "/dev/sdx", or "nodev" for efi only
efiSupport = true;
zfsSupport = true;
copyKernels = true; # https://nixos.wiki/wiki/NixOS_on_ZFS
mirroredBoots = [
{
devices = [ "nodev" ];
path = "/boot1";
}
{
devices = [ "nodev" ];
path = "/boot2";
}
];
};
};
};
Current versions:
$> zfs version
zfs-2.0.6-1
zfs-kmod-2.0.6-1
$> uname -a
Linux z11pa-d8 5.14.16 #1-NixOS SMP Tue Nov 2 18:51:02 UTC 2021 x86_64 GNU/Linux