Skip to content

Commit

Permalink
Merge pull request #130 from epics-extensions/backport/112-to-nixos-2…
Browse files Browse the repository at this point in the history
…3.11

[Backport nixos-23.11] linuxPackages.mrf: init at 2.6.0
  • Loading branch information
minijackson authored Jul 29, 2024
2 parents 11e0903 + 199cd04 commit 02c3866
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;});

Expand Down
9 changes: 9 additions & 0 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
43 changes: 43 additions & 0 deletions pkgs/epnix/kernel-modules/mrf/default.nix
Original file line number Diff line number Diff line change
@@ -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;
};
})
8 changes: 8 additions & 0 deletions pkgs/tests/default.nix
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 02c3866

Please sign in to comment.