Skip to content

Commit

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

[Backport nixos-23.05] linuxPackages.mrf: init at 2.6.0
  • Loading branch information
minijackson authored Jul 29, 2024
2 parents 82ff0db + b7279c1 commit c0618d1
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 @@ -32,6 +32,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 c0618d1

Please sign in to comment.