From 814a9866e5f88b21fa1255e0592ea8221c539d2b Mon Sep 17 00:00:00 2001 From: Minijackson Date: Mon, 8 Jul 2024 14:28:16 +0200 Subject: [PATCH 1/2] linuxPackages.mrf: init at 2.6.0 same version as mrfioc2 (cherry picked from commit fb0f666092eee696f2e7816b66296ae633177c74) --- pkgs/default.nix | 9 +++++ pkgs/epnix/kernel-modules/mrf/default.nix | 43 +++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 pkgs/epnix/kernel-modules/mrf/default.nix diff --git a/pkgs/default.nix b/pkgs/default.nix index c7260268..a285c58d 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -19,6 +19,15 @@ in }) ]; + linuxKernel = + prev.linuxKernel + // { + packagesFor = kernel: + (prev.linuxKernel.packagesFor kernel).extend (final: _prev: { + mrf = final.callPackage ./epnix/kernel-modules/mrf {}; + }); + }; + epnix = recurseExtensible (self: { # EPICS base diff --git a/pkgs/epnix/kernel-modules/mrf/default.nix b/pkgs/epnix/kernel-modules/mrf/default.nix new file mode 100644 index 00000000..2da2ef49 --- /dev/null +++ b/pkgs/epnix/kernel-modules/mrf/default.nix @@ -0,0 +1,43 @@ +{ + stdenv, + lib, + kernel, + epnix, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "mrf-driver"; + + inherit (epnix.support.mrfioc2) version src; + + # Needed for kernel modules + hardeningDisable = ["format" "pic"]; + + nativeBuildInputs = kernel.moduleBuildDependencies; + + enableParallelBuilding = true; + + setSourceRoot = '' + export sourceRoot="$(pwd)/${finalAttrs.src.name}/mrmShared/linux"; + ''; + + makeFlags = + kernel.makeFlags + ++ [ + "-C" + "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "KERNELRELEASE=${kernel.modDirVersion}" + "INSTALL_MOD_PATH=$(out)" + "VERSION=${finalAttrs.version}" + "M=$(sourceRoot)" + # Uncomment this line to enable debugging + # "KCFLAGS=-DDBG" + ]; + + buildFlags = ["modules"]; + installTargets = ["modules_install"]; + + meta = { + description = "MRF kernel driver"; + inherit (epnix.support.mrfioc2.meta) homepage license maintainers; + }; +}) From 199cd047a03c8b6250b85daffd91fcaa15e8a513 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Mon, 8 Jul 2024 14:28:53 +0200 Subject: [PATCH 2/2] pkgs/tests: init for testing build of unexposed packages (cherry picked from commit 34d14bdca2e0b6d85f3ff80370002297d2541401) --- flake.nix | 1 + pkgs/tests/default.nix | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 pkgs/tests/default.nix diff --git a/flake.nix b/flake.nix index 63c68160..2a73ab8b 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,7 @@ constituents = builtins.attrValues self.packages.${system}; }; } + // (import ./pkgs/tests {inherit pkgs self;}) // (import ./ioc/tests {inherit pkgs self;}) // (import ./nixos/tests/all-tests.nix {inherit nixpkgs pkgs self system;}); diff --git a/pkgs/tests/default.nix b/pkgs/tests/default.nix new file mode 100644 index 00000000..bb76486b --- /dev/null +++ b/pkgs/tests/default.nix @@ -0,0 +1,8 @@ +# For packages that are not directly exposed to the user, +# but should still work. +# +# For example kernel modules, which depend on the kernel version, +# or Python libraries, which depend on the Python version. +{pkgs, ...}: { + mrf-driver-default-linux = pkgs.linuxPackages.mrf; +}