Out-of-tree kernel module fails to build (Permission denied)

I’m trying to build the fliusb kernel module for using FLI cameras (FLI Software and Documentation) but I keep running into a slew of permission denied errors. I had originally found this git issue for the 6.13 kernel (Tracking Issue: out-of-tree modules failing to build on Linux 6.13 · Issue #375605 · NixOS/nixpkgs · GitHub), but most of the issues mentioned here seem resolved now.

For some reason I’m still running into issues when I try to install the FLI kernel module. Its the first time I’m trying to install a kernel module with nixos and I effectively frankensteined my way to a script that looks reasonable, but I’m by no means in expert in what I’m doing. So maybe this looks completely off to you but here’s what I’m doing:

# configuration.nix
let
  fliusb = config.boot.kernelPackages.callPackage ../../modules/kernal/modules/fliusb.nix {};
in
{
  # ...
  boot.extraModulePackages = [
    fliusb
  ];
  # ...
}
# fliusb.nix
{ stdenv, lib, kernel, kmod, ... }:

stdenv.mkDerivation rec {
  pname = "fliusb";
  version = "1.3.2";

  src = fetchTarball {
    url = "https://www.flicamera.com/downloads/sdk/fliusb-1.3.2.tgz";
    sha256 = "1gdk58nj7vjl5px4b6yinlqbp7smq2hyblqcb1nhjqw16hvkvfcb";
  };

  hardeningDisable = [ "pic" "format" ];
  nativeBuildInputs = kernel.moduleBuildDependencies;

  setSourceRoot = ''
    export sourceRoot=$(pwd)/source
  '';

  makeFlags = kernel.makeFlags ++ [
    "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
  ];

  buildFlag = ["modules"];
  installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ];
  install_targets = [ "modules_install" ];
  meta = {
    description = "A kernel module for FLI usb devices";
    homepage = "https://www.flicamera.com/support/support.php";
    platforms = lib.platforms.linux;
  };
}

If anyone has an idea why this keeps churning out permission denied errors I would be happy to hear from you.

cheers

1 Like