From 8f1b798f6a2d53e153703a439f7d2fe80935df85 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:47:37 +0200 Subject: [PATCH 1/3] nixos/firmware: simplify hardware.enableAllFirmware assertion condition --- nixos/modules/hardware/all-firmware.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix index 0b946052b9d3..152b750edd08 100644 --- a/nixos/modules/hardware/all-firmware.nix +++ b/nixos/modules/hardware/all-firmware.nix @@ -76,7 +76,7 @@ in (lib.mkIf cfg.enableAllFirmware { assertions = [ { - assertion = !cfg.enableAllFirmware || pkgs.config.allowUnfree; + assertion = cfg.enableAllFirmware -> pkgs.config.allowUnfree; message = '' the list of hardware.enableAllFirmware contains non-redistributable licensed firmware files. This requires nixpkgs.config.allowUnfree to be true. From aa047cc668e925fe6dbc8c4e5b166ff07fc0c038 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Mon, 8 Sep 2025 20:38:44 +0200 Subject: [PATCH 2/3] nixos/firmware: mention enableAllFirmware including unfree packages --- nixos/modules/hardware/all-firmware.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix index 152b750edd08..3fea8fec4475 100644 --- a/nixos/modules/hardware/all-firmware.nix +++ b/nixos/modules/hardware/all-firmware.nix @@ -36,7 +36,18 @@ in options = { - hardware.enableAllFirmware = lib.mkEnableOption "all firmware regardless of license"; + hardware.enableAllFirmware = lib.mkOption { + default = false; + example = true; + + description = '' + Whether to enable all firmware, including [unfree packages that must be explictly allowed](https://nixos.org/manual/nixpkgs/unstable/#sec-allow-unfree). + + Alternatively, use the {option}`hardware.enableRedistributableFirmware` option. + ''; + + type = lib.types.bool; + }; hardware.enableRedistributableFirmware = lib.mkEnableOption "firmware with a license allowing redistribution" From ea7e940d6fbcbed1a4a92b8eed0198543b7c3261 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Mon, 8 Sep 2025 17:47:38 +0200 Subject: [PATCH 3/3] nixos/firmware: remove restrictive hardware.enableAllFirmware assertion Remove the too restrictive hardware.enableAllFirmware assertion introduced in commit 05aa80c06ab4 ("hardware: add enableRedistributalFirmware"). This assertion is too restrictive because it enforces globally enabling unfree packages without allowing explicit whitelisting: hardware.enableAllFirmware = true; -nixpkgs.config.allowUnfree = true; +nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "b43-firmware" + "broadcom-bt-firmware" + "facetimehd-calibration" + "facetimehd-firmware" + "xow_dongle-firmware" + ]; Declaring neither nixpkgs.config.allowUnfree nor nixpkgs.config.allowUnfreePredicate without this hardware.enableAllFirmware assertion results in detailed and instructive evaluation error messages. --- nixos/modules/hardware/all-firmware.nix | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix index 3fea8fec4475..fc93b74003d2 100644 --- a/nixos/modules/hardware/all-firmware.nix +++ b/nixos/modules/hardware/all-firmware.nix @@ -85,16 +85,6 @@ in ++ lib.optional pkgs.stdenv.hostPlatform.isAarch raspberrypiWirelessFirmware; }) (lib.mkIf cfg.enableAllFirmware { - assertions = [ - { - assertion = cfg.enableAllFirmware -> pkgs.config.allowUnfree; - message = '' - the list of hardware.enableAllFirmware contains non-redistributable licensed firmware files. - This requires nixpkgs.config.allowUnfree to be true. - An alternative is to use the hardware.enableRedistributableFirmware option. - ''; - } - ]; hardware.firmware = with pkgs; [