mobile-nixos icon indicating copy to clipboard operation
mobile-nixos copied to clipboard

add a .dev output to the kernel derivation, so we can use headers

Open telent opened this issue 4 years ago • 1 comments

In order to build the poetically named "libqipcrtr4msmipc" project (relevant to modem support on Qualcomm) I need headers files from the vendor kernel that don't exist in mainline. What do you think about making the kernel builder into a multi-output derivation?

How I use it:

  let libqipcrtr4msmipc = kernel:
    let pname = "libqipcrtr4msmipc";
    in pkgs.stdenv.mkDerivation {
      inherit pname;
      buildInputs = [ kernel ];
      version = "0.1";
      preConfigure = ''
        makeFlags="prefix=$out CFLAGS=-I${kernel}/include"
      '';
      src = pkgs.fetchFromGitHub {
        repo = pname;
        owner = "telent";
        rev = "061c63c246ff6a29de899621a095696b08b3d1a3";
        sha256 = "197kd1bjhcaq1lh91abng8fx00a7fsnx5hs6prr0fdnwwmdriqh4";
      };
      installPhase = ''
        mkdir -p $out/lib
        cp ${pname}.so $out/lib
      '';
  };
  
 # [ ..... ]
in {
      environment.systemPackages = [(libqipcrtr4msmipc config.mobile.boot.stage-1.kernel.package.dev)]
 }

I'm by no means wedded to this solution, so feel free to suggest alternatives

telent avatar Jun 10 '21 16:06 telent

Any reasons this is a draft still?

You did verify it is working, didn't you?

samueldr avatar Jun 17 '21 21:06 samueldr