Я следую этой инструкции: https://github.com/nns779/px4_drv
make
в каталоге fwtool
builds it930x-firmware.bin
и make
в driver
builds px4_drv
модуль ядра.
Я написал эти два nix-выражения:
$ cat ./it930x.nix
{ stdenv, fetchFromGitHub, fetchzip }:
stdenv.mkDerivation rec {
pname = "it930x-firmware";
version = "1";
src = fetchFromGitHub {
owner = "nns779";
repo = "px4_drv";
rev = "90e0a4b30b812e7e5fff4483144f165de8914157";
sha256 = "1s9y5szv9i8dj6pnbkph48nikzf1bhkj592pczbq7hy31xr60hmw";
};
plexSrc = fetchzip {
url = "http://plex-net.co.jp/plex/pxw3u4/pxw3u4_BDA_ver1x64.zip";
sha256 = "1ky28m8hv86vivk2clps5qpmlrmlvfya8qcfmcvpd3n2kisbqsrl";
};
sourceRoot = "fwtool/";
postUnpack = ''
cp "$plexSrc/pxw3u4_BDA_ver1x64/PXW3U4.sys" .
'';
installPhase = ''
mkdir -p $out/lib/firmware/
./fwtool PXW3U4.sys $out/lib/firmware/it930x-firmware.bin
'';
meta = with stdenv.lib; {
description = "it930x-firmware for px4_drv";
homepage = https://github.com/nns779/px4_drv;
license = licenses.gpl2;
};
}
$ cat ./px4_drv.nix
{ stdenv, fetchFromGitHub, kernel, it930x-firmware }:
stdenv.mkDerivation rec {
pname = "px4_drv";
version = "1";
src = fetchFromGitHub {
owner = "nns779";
repo = "px4_drv";
rev = "90e0a4b30b812e7e5fff4483144f165de8914157";
sha256 = "1s9y5szv9i8dj6pnbkph48nikzf1bhkj592pczbq7hy31xr60hmw";
};
sourceRoot = "driver/";
hardeningDisable = [ "pic" ];
KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
INSTALL_MOD_PATH = "\${out}";
NIX_CFLAGS = ["-Wno-error=cpp"];
nativeBuildInputs = [ it930x-firmware ] ++ kernel.moduleBuildDependencies;
buildFlags = [ "module" ];
installTargets = [ "module-install" ];
meta = with stdenv.lib; {
description = "Kernel module px4_drv";
homepage = https://github.com/nns779/px4_drv;
license = licenses.gpl2;
platforms = platforms.linux;
};
}
(Оригинальные два кода заимствованы из b43-firmware
и wireguard
.)
и включите их следующим образом:
$ cat ./configuration.nix
{ config, lib, pkgs, ... }:
let
px4_drv = pkgs.callPackage ./px4_drv.nix;
it930x = pkgs.callPackage ./it930x.nix;
in {
boot.extraModulePackages = [
(px4_drv {
it930x-firmware = it930x;
kernel = pkgs.linux_4_19;
})
];
boot.kernelPackages = pkgs.linuxPackages_4_19;
...
}
Результат:
$ sudo nixos-rebuild test
error: cannot coerce a function to a string, at /nix/store/8zwm55m0754cn9cv6inwm469h0my219r-nixos-20.09pre218482.3320a06049f/nixos/pkgs/stdenv/generic/make-derivation.nix:191:11
(use '--show-trace' to show detailed location information)
nix-shell -E "with import <nixpkgs> {}; callPackage ./px4_drv.nix { it930x-firmware = callPackage ./it930x.nix; kernel = linux_4_19; }"
результат тот же.
Как это исправить?