Skip to content

Commit

Permalink
scx: init at 1.0.5 (#351746)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRTitor authored Oct 29, 2024
2 parents 173536e + c42882f commit 9147b2d
Show file tree
Hide file tree
Showing 15 changed files with 8,396 additions and 0 deletions.
74 changes: 74 additions & 0 deletions pkgs/os-specific/linux/scx/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
lib,
callPackage,
pkg-config,
rustPlatform,
llvmPackages,
elfutils,
zlib,
fetchFromGitHub,
}:
let
versionInfo = lib.importJSON ./version.json;
mkScxScheduler =
packageType:
args@{ schedulerName, ... }:
(if packageType == "rust" then rustPlatform.buildRustPackage else llvmPackages.stdenv.mkDerivation)
(
args
// {
pname = "${schedulerName}";
version = args.version or versionInfo.scx.version;

src = args.src or fetchFromGitHub {
owner = "sched-ext";
repo = "scx";
rev = "refs/tags/v${versionInfo.scx.version}";
inherit (versionInfo.scx) hash;
};

nativeBuildInputs = [
pkg-config
llvmPackages.clang
] ++ (args.nativeBuildInputs or [ ]);
buildInputs = [
elfutils
zlib
] ++ (args.buildInputs or [ ]);

env.LIBCLANG_PATH = args.env.LIBCLANG_PATH or "${llvmPackages.libclang.lib}/lib";

# Needs to be disabled in BPF builds
hardeningDisable = [
"zerocallusedregs"
] ++ (args.hardeningDisable or [ ]);

meta = args.meta // {
description = args.meta.description or "";
longDescription =
(args.meta.longDescription or "")
+ ''
\n\nSched-ext schedulers are only available on supported kernels
(6.12 and above or any kernel with the scx patchset applied).'';

homepage = args.meta.homepage or "https://github.com/sched-ext/scx";
license = args.meta.license or lib.licenses.gpl2Only;
platforms = args.meta.platforms or lib.platforms.linux;
maintainers = (args.meta.maintainers or [ ]) ++ (with lib.maintainers; [ johnrtitor ]);
};
}
);

schedulers = lib.mergeAttrsList [
{ bpfland = import ./scx_bpfland; }
{ lavd = import ./scx_lavd; }
{ layered = import ./scx_layered; }
{ rlfifo = import ./scx_rlfifo; }
{ rustland = import ./scx_rustland; }
{ csheds = import ./scx_csheds.nix; }
];
in
(lib.mapAttrs (name: scheduler: callPackage scheduler { inherit mkScxScheduler; }) schedulers)
// {
inherit mkScxScheduler;
}
Loading

0 comments on commit 9147b2d

Please sign in to comment.