rustdesk-flutter: add pipewire gstreame plugin (#379587)
[NixPkgs.git] / pkgs / os-specific / linux / scx / scx_rustscheds.nix
blob2e4cabfb95eab12ff2e1ac1b3f4e61fedb92b0b5
2   lib,
3   rustPlatform,
4   llvmPackages,
5   pkg-config,
6   elfutils,
7   zlib,
8   zstd,
9   scx-common,
10   scx,
12 rustPlatform.buildRustPackage {
13   pname = "scx_rustscheds";
14   inherit (scx-common) version src;
16   useFetchCargoVendor = true;
17   inherit (scx-common.versionInfo.scx) cargoHash;
19   # Copy compiled headers and libs from scx.cscheds
20   postPatch = ''
21     mkdir bpftool libbpf
22     cp -r ${scx.cscheds.dev}/bpftool/* bpftool/
23     cp -r ${scx.cscheds.dev}/libbpf/* libbpf/
24   '';
26   nativeBuildInputs = [
27     pkg-config
28     rustPlatform.bindgenHook
29   ];
30   buildInputs = [
31     elfutils
32     zlib
33     zstd
34   ];
36   env = {
37     BPF_CLANG = lib.getExe llvmPackages.clang;
38     BPF_EXTRA_CFLAGS_PRE_INCL = lib.concatStringsSep " " [
39       "-I${scx.cscheds.dev}/libbpf/src/usr/include"
40       "-I${scx.cscheds.dev}/libbpf/include/uapi"
41       "-I${scx.cscheds.dev}/libbpf/include/linux"
42     ];
43     RUSTFLAGS = lib.concatStringsSep " " [
44       "-C relocation-model=pic"
45       "-C link-args=-lelf"
46       "-C link-args=-lz"
47       "-C link-args=-lzstd"
48       "-L ${scx.cscheds.dev}/libbpf/src"
49     ];
50   };
52   hardeningDisable = [
53     "stackprotector"
54     "zerocallusedregs"
55   ];
57   # Enable this when default kernel in nixpkgs is 6.12+
58   doCheck = false;
60   meta = scx-common.meta // {
61     description = "Sched-ext Rust userspace schedulers";
62     longDescription = ''
63       This includes Rust based schedulers such as
64       scx_rustland, scx_bpfland, scx_lavd, scx_layered, scx_rlfifo.
66       ::: {.note}
67       Sched-ext schedulers are only available on kernels version 6.12 or later.
68       It is recommended to use the latest kernel for the best compatibility.
69       :::
70     '';
71   };