You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6 KiB

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
lib = pkgs.lib;
kernel = pkgs.linuxPackages.kernel;
kmod = pkgs.stdenv.mkDerivation rec {
name = "cc1101-driver";
src = builtins.fetchGit {
url = "https://github.com/28757B2/cc1101-driver";
rev = "2d0293ee8afba84846da9ebdca2a718d6cc7a387";
};
patches = [
./0001-Replace-Windows-line-endings-with-Unix-ones.patch
./0002-Fix-build-errors-for-6.10.patch
./0003-Fix-Makefile-not-respecting-KDIR.patch
./0004-Update-to-6.12.patch
];
nativeBuildInputs = [ pkgs.kmod pkgs.ncurses pkgs.gnumake ];
makeFlags = [
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
buildPhase = ''
make ${lib.concatStringsSep " " makeFlags}
'';
installPhase = ''
mkdir -p $out/lib/modules/${kernel.modDirVersion}/extra
cp *.ko $out/lib/modules/${kernel.modDirVersion}/extra
'';
meta = {
description = "Linux device driver for the Texas Instruments CC1101 radio";
platforms = pkgs.lib.platforms.linux;
};
};
in {
packages.default = kmod;
});
}