Commit 74351caf authored by K900's avatar K900
Browse files

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
parent 748361e0
Loading
Loading
Loading
Loading
+2 −25
Original line number Diff line number Diff line
@@ -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;
  };
}
+28 −3
Original line number Diff line number Diff line
@@ -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";
  };
}
})
+12 −7
Original line number Diff line number Diff line
{
  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;

  paths = [
    scx.cscheds
    scx.rustscheds
  ];

  passthru.schedulers = scx.cscheds.schedulers ++ scx.rustscheds.schedulers;

  meta = oldAttrs.meta // {
  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";
  };
})
}
+40 −0
Original line number Diff line number Diff line
@@ -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";