From 748361e0015ad1b259c70831c3aee38596e353b5 Mon Sep 17 00:00:00 2001 From: K900 Date: Tue, 17 Mar 2026 09:47:37 +0300 Subject: [PATCH 1/2] scx: split C and Rust versions, Rust 1.0.20 -> 1.1.0, C 1.0.20 -> unstable --- pkgs/os-specific/linux/scx/scx_cscheds.nix | 17 ++++++++++++---- pkgs/os-specific/linux/scx/scx_rustscheds.nix | 20 ++++++------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/pkgs/os-specific/linux/scx/scx_cscheds.nix b/pkgs/os-specific/linux/scx/scx_cscheds.nix index c9f419c59b3c..51f9431fbc27 100644 --- a/pkgs/os-specific/linux/scx/scx_cscheds.nix +++ b/pkgs/os-specific/linux/scx/scx_cscheds.nix @@ -1,4 +1,5 @@ { + fetchFromGitHub, llvmPackages, libbpf, pkg-config, @@ -12,7 +13,14 @@ llvmPackages.stdenv.mkDerivation { pname = "scx_cscheds"; - inherit (scx.rustscheds) version src; + version = "0-unstable-2026-01-13"; + + src = fetchFromGitHub { + owner = "sched-ext"; + repo = "scx-c-examples"; + rev = "82c692afe32ed4e79fd047a93d3ff316bf399287"; + hash = "sha256-buXwId/4TwDfo/5mApMAEWHri92bW9x3jLEE5rawS3w="; + }; postPatch = '' substituteInPlace ./scheds/c/Makefile \ @@ -47,10 +55,11 @@ llvmPackages.stdenv.mkDerivation { }; meta = scx.rustscheds.meta // { - description = "Sched-ext C userspace schedulers"; + description = "Sched-ext C example schedulers"; longDescription = '' - This includes C based schedulers such as scx_central, scx_flatcg, - scx_nest, scx_pair, scx_qmap, scx_simple, scx_userland. + This includes C based example schedulers such as scx_central, scx_flatcg, + scx_nest, scx_pair, scx_qmap, scx_simple, scx_userland. These are examples, + and generally not recommended for end users. ::: {.note} Sched-ext schedulers are only available on kernels version 6.12 or later. diff --git a/pkgs/os-specific/linux/scx/scx_rustscheds.nix b/pkgs/os-specific/linux/scx/scx_rustscheds.nix index 565a760563b6..9814a2b02149 100644 --- a/pkgs/os-specific/linux/scx/scx_rustscheds.nix +++ b/pkgs/os-specific/linux/scx/scx_rustscheds.nix @@ -14,16 +14,16 @@ }: rustPlatform.buildRustPackage (finalAttrs: { pname = "scx_rustscheds"; - version = "1.0.20"; + version = "1.1.0"; src = fetchFromGitHub { owner = "sched-ext"; repo = "scx"; tag = "v${finalAttrs.version}"; - hash = "sha256-MUWbNsxmbCRCOWB2dHpi5dEY2rNRrINxJSyl5SNSO9Y="; + hash = "sha256-kPOAiy2siIKZ6/zz43qPW7bp27T98MOhwmZMxpVpito="; }; - cargoHash = "sha256-H58wschck+l41fQh9W5SNVb5g9lAnw90SOSd/RtGXyw="; + cargoHash = "sha256-nXiprz5ryGJeTy9nnKaLSKE0FSl17YE88xFt9bUTTL8="; nativeBuildInputs = [ pkg-config @@ -51,17 +51,9 @@ rustPlatform.buildRustPackage (finalAttrs: { "zerocallusedregs" ]; - doCheck = true; - checkFlags = [ - "--skip=compat::tests::test_ksym_exists" - "--skip=compat::tests::test_read_enum" - "--skip=compat::tests::test_struct_has_field" - "--skip=cpumask" - "--skip=topology" - "--skip=proc_data::tests::test_thread_operations" - "--skip=json::tests::test_with_resources" - "--skip=json::tests::test_with_dir" - ]; + # most of the tests rely on system CPU topology info, + # which is not available in the sandbox + doCheck = false; passthru.tests.basic = nixosTests.scx; passthru.updateScript = nix-update-script { }; From 74351cafa544b8aaf1d2a1d2587e0adb07ee1a6f Mon Sep 17 00:00:00 2001 From: K900 Date: Wed, 18 Mar 2026 09:52:44 +0300 Subject: [PATCH 2/2] scx: big scheduler list cleanup - pull schedulers from the package definition - actually check we have the right lists at build time - make scx.full a simple buildEnv to not have to deal with the checks being different --- nixos/modules/services/scheduling/scx.nix | 27 +------------ pkgs/os-specific/linux/scx/scx_cscheds.nix | 31 ++++++++++++-- pkgs/os-specific/linux/scx/scx_full.nix | 19 +++++---- pkgs/os-specific/linux/scx/scx_rustscheds.nix | 40 +++++++++++++++++++ 4 files changed, 82 insertions(+), 35 deletions(-) diff --git a/nixos/modules/services/scheduling/scx.nix b/nixos/modules/services/scheduling/scx.nix index 612c4995879a..aba3bddceb0b 100644 --- a/nixos/modules/services/scheduling/scx.nix +++ b/nixos/modules/services/scheduling/scx.nix @@ -37,31 +37,7 @@ in }; scheduler = lib.mkOption { - type = lib.types.enum [ - "scx_beerland" - "scx_bpfland" - "scx_chaos" - "scx_cosmos" - "scx_central" - "scx_flash" - "scx_flatcg" - "scx_lavd" - "scx_layered" - "scx_mitosis" - "scx_nest" - "scx_p2dq" - "scx_pair" - "scx_prev" - "scx_qmap" - "scx_rlfifo" - "scx_rustland" - "scx_rusty" - "scx_sdt" - "scx_simple" - "scx_tickless" - "scx_userland" - "scx_wd40" - ]; + type = lib.types.enum cfg.package.schedulers; default = "scx_rustland"; example = "scx_bpfland"; description = '' @@ -125,5 +101,6 @@ in meta = { inherit (pkgs.scx.full.meta) maintainers; + buildDocsInSandbox = false; }; } diff --git a/pkgs/os-specific/linux/scx/scx_cscheds.nix b/pkgs/os-specific/linux/scx/scx_cscheds.nix index 51f9431fbc27..b23d424d0070 100644 --- a/pkgs/os-specific/linux/scx/scx_cscheds.nix +++ b/pkgs/os-specific/linux/scx/scx_cscheds.nix @@ -11,7 +11,7 @@ libseccomp, }: -llvmPackages.stdenv.mkDerivation { +llvmPackages.stdenv.mkDerivation (finalAttrs: { pname = "scx_cscheds"; version = "0-unstable-2026-01-13"; @@ -48,10 +48,35 @@ llvmPackages.stdenv.mkDerivation { "zerocallusedregs" ]; - doCheck = true; + __structuredAttrs = true; + EXPECTED_SCHEDULERS = finalAttrs.passthru.schedulers; + + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + + cd $out/bin + found=(scx_*) + if [[ "''${found[@]}" != "''${EXPECTED_SCHEDULERS[@]}" ]]; then + echo "List of available schedulers changed, expected: ''${EXPECTED_SCHEDULERS[@]}, found: ''${found[@]}" + exit 1 + fi + + runHook postInstallCheck + ''; passthru = { inherit (scx.rustscheds.passthru) tests; + schedulers = [ + "scx_central" + "scx_flatcg" + "scx_nest" + "scx_pair" + "scx_prev" + "scx_qmap" + "scx_simple" + "scx_userland" + ]; }; meta = scx.rustscheds.meta // { @@ -68,4 +93,4 @@ llvmPackages.stdenv.mkDerivation { ''; homepage = "https://github.com/sched-ext/scx/tree/main/scheds/c"; }; -} +}) diff --git a/pkgs/os-specific/linux/scx/scx_full.nix b/pkgs/os-specific/linux/scx/scx_full.nix index 8edcfbee8c70..e7134cf2792a 100644 --- a/pkgs/os-specific/linux/scx/scx_full.nix +++ b/pkgs/os-specific/linux/scx/scx_full.nix @@ -1,14 +1,19 @@ { - lib, + buildEnv, scx, }: -scx.cscheds.overrideAttrs (oldAttrs: { +buildEnv { pname = "scx_full"; - postInstall = (oldAttrs.postInstall or "") + '' - cp ${lib.getBin scx.rustscheds}/bin/* ${placeholder "out"}/bin/ - ''; + inherit (scx.rustscheds) version; - meta = oldAttrs.meta // { + paths = [ + scx.cscheds + scx.rustscheds + ]; + + passthru.schedulers = scx.cscheds.schedulers ++ scx.rustscheds.schedulers; + + meta = { description = "Sched-ext C and Rust userspace schedulers"; longDescription = '' This includes C based schedulers such as scx_central, scx_flatcg, @@ -22,4 +27,4 @@ scx.cscheds.overrideAttrs (oldAttrs: { ''; homepage = "https://github.com/sched-ext/scx"; }; -}) +} diff --git a/pkgs/os-specific/linux/scx/scx_rustscheds.nix b/pkgs/os-specific/linux/scx/scx_rustscheds.nix index 9814a2b02149..b866310550b4 100644 --- a/pkgs/os-specific/linux/scx/scx_rustscheds.nix +++ b/pkgs/os-specific/linux/scx/scx_rustscheds.nix @@ -55,8 +55,48 @@ rustPlatform.buildRustPackage (finalAttrs: { # which is not available in the sandbox doCheck = false; + # we don't need these + postInstall = '' + rm $out/bin/{scx_arena_selftests,vmlinux_docify,xtask} + ''; + + __structuredAttrs = true; + EXPECTED_SCHEDULERS = finalAttrs.passthru.schedulers; + + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck + + cd $out/bin + found=(scx_*) + if [[ "''${found[@]}" != "''${EXPECTED_SCHEDULERS[@]}" ]]; then + echo "List of available schedulers changed, expected: ''${EXPECTED_SCHEDULERS[@]}, found: ''${found[@]}" + exit 1 + fi + + runHook postInstallCheck + ''; + passthru.tests.basic = nixosTests.scx; passthru.updateScript = nix-update-script { }; + passthru.schedulers = [ + "scx_beerland" + "scx_bpfland" + "scx_cake" + "scx_chaos" + "scx_cosmos" + "scx_flash" + "scx_lavd" + "scx_layered" + "scx_mitosis" + "scx_p2dq" + "scx_pandemonium" + "scx_rlfifo" + "scx_rustland" + "scx_rusty" + "scx_tickless" + "scx_wd40" + ]; meta = { description = "Sched-ext Rust userspace schedulers";