working example for now

This commit is contained in:
Bart van der Braak 2025-01-21 02:01:48 +01:00
parent f87cbd8ad9
commit fd8292cd41
4 changed files with 153 additions and 101 deletions

View file

@ -3,6 +3,12 @@
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
let
yt6801 = import ./yt6801.nix {
inherit (pkgs) stdenv lib fetchzip;
kernel = pkgs.linuxPackages.kernel;
};
in
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
@ -35,4 +41,4 @@
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
}

51
nixos/hardware/yt6801.nix Normal file
View file

@ -0,0 +1,51 @@
{
kernel,
stdenv,
lib,
fetchzip,
}:
stdenv.mkDerivation {
pname = "yt6801";
version = "1.0.29";
src = fetchzip {
url = "https://www.motor-comm.com/Public/Uploads/uploadfile/files/20240812/yt6801-linux-driver-1.0.29.zip";
sha256 = "sha256-oz6CeOUN6QWKXxe3WUZljhGDTFArsknjzBuQ4IchGeU=";
stripRoot = false;
};
nativeBuildInputs = kernel.moduleBuildDependencies;
preConfigure = "cd src";
configurePhase = "true";
buildFlags = [ "modules" ];
makeFlags =
[
"ARCH=${stdenv.hostPlatform.linuxArch}"
"KSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
]
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"CROSS_COMPILE=${stdenv.cc.targetPrefix}"
];
installPhase = ''
mkdir -p $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/ethernet/motorcomm
cp src/yt6801.ko $out/lib/modules/${kernel.modDirVersion}/kernel/drivers/net/ethernet/motorcomm/
'';
enableParallelBuilding = true;
meta = with lib; {
description = "Motorcomm yt6801 Network Interface Card driver";
homepage = "https://www.motor-comm.com/product/ethernet-control-chip";
license = with licenses; [
gpl2Plus
gpl2Only
];
platforms = platforms.linux;
};
}