mirror of
https://github.com/bartvdbraak/dotfiles.git
synced 2025-04-27 14:41:20 +00:00
Add out-of-tree kernel module for Motorcomm yt6801 Network Interface Card (NIC) driver (#7)
* Add initial test to run with the new driver install * Fix unpacking by using git source * Change buildinputs and patch commands * Working example of extra yt6801 module * Add fixes * Consolidate changes
This commit is contained in:
parent
ecfb278d2a
commit
6cbbb95810
2 changed files with 50 additions and 1 deletions
|
@ -3,6 +3,12 @@
|
||||||
# to /etc/nixos/configuration.nix instead.
|
# to /etc/nixos/configuration.nix instead.
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
{ config, lib, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
yt6801 = import ./yt6801/default.nix {
|
||||||
|
inherit (pkgs) lib stdenv fetchFromGitHub nukeReferences bc;
|
||||||
|
kernel = pkgs.linuxPackages.kernel;
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
imports =
|
imports =
|
||||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
[ (modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
@ -11,7 +17,7 @@
|
||||||
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" "sdhci_pci" ];
|
boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" "sdhci_pci" ];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.initrd.kernelModules = [ ];
|
||||||
boot.kernelModules = [ "kvm-amd" ];
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
boot.extraModulePackages = [ ];
|
boot.extraModulePackages = [ yt6801 ];
|
||||||
|
|
||||||
fileSystems."/" =
|
fileSystems."/" =
|
||||||
{ device = "/dev/disk/by-uuid/c7cf28c3-5744-45cc-8a81-456d24e44b7a";
|
{ device = "/dev/disk/by-uuid/c7cf28c3-5744-45cc-8a81-456d24e44b7a";
|
||||||
|
|
43
tongfang/nixos/yt6801/default.nix
Normal file
43
tongfang/nixos/yt6801/default.nix
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
{ lib, stdenv, fetchFromGitHub, nukeReferences, bc, kernel }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
pname = "yt6801";
|
||||||
|
version = "1.0.29";
|
||||||
|
name = "${pname}-${version}-${kernel.version}";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "bartvdbraak";
|
||||||
|
repo = pname;
|
||||||
|
rev = version;
|
||||||
|
sha256 = "sha256-VEBwcbJcLffIIAP+NIhjiuMkfR+PKybBDnIbxY6zBMA=";
|
||||||
|
};
|
||||||
|
|
||||||
|
patchPhase = ''
|
||||||
|
substituteInPlace ./src/Makefile \
|
||||||
|
--replace-fail 'KSRC_BASE = /lib/modules/$(shell uname -r)' "KSRC_BASE = ${KERNELDIR}"
|
||||||
|
'';
|
||||||
|
|
||||||
|
hardeningDisable = [ "pic" "format" ];
|
||||||
|
KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}";
|
||||||
|
nativeBuildInputs = [ bc ] ++ kernel.moduleBuildDependencies;
|
||||||
|
|
||||||
|
preBuild = "cd src";
|
||||||
|
buildFlags = [ "modules" ];
|
||||||
|
|
||||||
|
makeFlags = [
|
||||||
|
"ARCH=${stdenv.hostPlatform.linuxArch}"
|
||||||
|
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||||
|
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
|
||||||
|
];
|
||||||
|
|
||||||
|
installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ];
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Motorcomm yt6801 Network Interface Card (NIC) driver";
|
||||||
|
homepage = "https://www.motor-comm.com/product/ethernet-control-chip";
|
||||||
|
license = licenses.gpl2Only;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
maintainers = with maintainers; [ bartvdbraak ];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue