I figured out how to build locally.
First, I needed to move my default.nix over to another .nix file (I moved it to build.nix).
Then, I made a default.nix with the following:
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-22.11" # You can probably use a newer nixpkgs here
pkgs = import nixpkgs { config = {}; overlays = []; };
in
{
vrsff = pkgs.callPackage ./build.nix { };
}
Then, in build.nix since kernel wasn’t passed in and I don’t understand how parameters are passed, I changed parameters to the following
{
stdenv,
lib,
fetchFromGitHub,
pkgs,
kernel ? pkgs.linuxPackages_latest.kernel,
}:
Additionally, taking inspiration from this thread , I reformatted my build.nix to the following:
stdenv.mkDerivation rec {
name = "vrs-ff-${version}-${kernel.version}";
pname = "vrs-ff";
version = "0.0.1";
src = fetchFromGitHub {
owner = "JacKeTUs";
repo = "vrs-ff";
rev = "main";
sha256 = "iaN1qGj0hGfyCDUgpGofC91nRw6f1SW+7U6wDdO6NLc=";
};
setSourceRoot = ''
export sourceRoot=$(pwd)/source
'';
nativeBuildInputs = kernel.moduleBuildDependencies;
makeFlags = kernel.makeFlags ++ [
"-C"
"${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
"M=$(sourceRoot)"
];
buildFlags = [ "modules" ];
installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ];
installTargets = [ "modules_install" ];
meta = with lib; {
description = "A kernel module to support VRS Direct Force Pro";
homepage = "https://github.com/JacKeTUs/vrs-ff";
license = licenses.gpl2;
maintainers = [ maintainers.ccalhoun1999 ];
platforms = platforms.linux;
};
}
Running nix-build -A vrsff created a result folder with the hid-vrs-ff.ko.xz file at result/lib/modules/6.3.10/updates/hid-vrs-ff.ko.xz.