From 0febbb4ff90f2bf7637567214b0bbf1de43ba461 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 21 Jul 2025 20:11:42 +0200 Subject: [PATCH] linux: remove assert on linux Asserting the hostplatform for `linux` is bad, because it can't be caught by CI. For the `linux` package itself, it doesn't make a difference, because it also has `meta.platforms = linux` set, so this will fail evaluation - and in a way that can nicely be caught by CI. --- pkgs/os-specific/linux/kernel/generic.nix | 2 -- pkgs/os-specific/linux/ply/default.nix | 1 + pkgs/test/nixos-functions/default.nix | 22 +++++++++++----------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index 50c5d9683760..71673921d238 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -94,8 +94,6 @@ let # cgit) that are needed here should be included directly in Nixpkgs as # files. - assert stdenv.hostPlatform.isLinux; - let # Dirty hack to make sure that `version` & `src` have # `` as position diff --git a/pkgs/os-specific/linux/ply/default.nix b/pkgs/os-specific/linux/ply/default.nix index 3e1dfa296706..53d3553afc0a 100644 --- a/pkgs/os-specific/linux/ply/default.nix +++ b/pkgs/os-specific/linux/ply/default.nix @@ -55,5 +55,6 @@ stdenv.mkDerivation rec { mic92 mbbx6spp ]; + platforms = lib.platforms.linux; }; } diff --git a/pkgs/test/nixos-functions/default.nix b/pkgs/test/nixos-functions/default.nix index dc8e0b3ead31..4cc738cfaebe 100644 --- a/pkgs/test/nixos-functions/default.nix +++ b/pkgs/test/nixos-functions/default.nix @@ -21,14 +21,14 @@ let label = "test"; }; in -pkgs.recurseIntoAttrs { - - nixos-test = - (pkgs.nixos { - system.nixos = dummyVersioning; - boot.loader.grub.enable = false; - fileSystems."/".device = "/dev/null"; - system.stateVersion = lib.trivial.release; - }).toplevel; - -} +lib.optionalAttrs (stdenv.hostPlatform.isLinux) ( + pkgs.recurseIntoAttrs { + nixos-test = + (pkgs.nixos { + system.nixos = dummyVersioning; + boot.loader.grub.enable = false; + fileSystems."/".device = "/dev/null"; + system.stateVersion = lib.trivial.release; + }).toplevel; + } +)