Skip to content

Commit 1663e57

Browse files
committed
nixos/linuxcnc: init module
Add a LinuxCNC module for real-time control of CNC machines from NixOS. Signed-off-by: wucke13 <wucke13+github@gmail.com>
1 parent 0520f18 commit 1663e57

3 files changed

Lines changed: 56 additions & 0 deletions

File tree

doc/release-notes/rl-2605.section.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@
286286
287287
- Switch inhibitors were introduced, which add a pre-switch check that compares a list of strings between the previous and the new generation, and refuses to switch into the new generation when there is a difference between the two lists. This allows to avoid switching into a system when for instance the systemd version changed by adding `config.systemd.package.version` to the switch inhibitors for your system. You can still forcefully switch into any generation by setting `NIXOS_NO_CHECK=1`.
288288
289+
- A LinuxCNC module has been added. This provides a notable alternative to Debian based distros for CNC machine control.
290+
289291
- GNU Taler has been updated to version 1.3.
290292
This release focuses on getting everything ready for a deployment of GNU Taler by Magnet bank.
291293
For more details, see the [upstream release notes](https://www.taler.net/en/news/2025-13.html).

nixos/modules/module-list.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@
259259
./programs/less.nix
260260
./programs/liboping.nix
261261
./programs/librepods.nix
262+
./programs/linuxcnc.nix
262263
./programs/lix.nix
263264
./programs/localsend.nix
264265
./programs/mdevctl.nix
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
...
6+
}:
7+
8+
let
9+
cfg = config.programs.${moduleName};
10+
moduleName = "linuxcnc";
11+
in
12+
{
13+
meta.maintainers = with lib.maintainers; [ wucke13 ];
14+
15+
options.programs.${moduleName} = {
16+
17+
enable = lib.options.mkEnableOption moduleName;
18+
19+
package =
20+
(lib.options.mkPackageOption pkgs "linuxcnc" {
21+
default = [ "linuxcnc" ];
22+
})
23+
// {
24+
apply = p: p.override { enableSetuidWrapperRedirection = true; };
25+
};
26+
27+
};
28+
29+
config = lib.mkIf cfg.enable {
30+
# use RT_PREEMPT kernel
31+
boot.kernelPackages = pkgs.linuxKernel.packagesFor pkgs.linux-rt;
32+
33+
# create wrapper with setuid bit set
34+
security.wrappers = lib.mkIf cfg.enable (
35+
lib.attrsets.genAttrs' cfg.package.setuidApps (program: {
36+
name = "linuxcnc-${program}";
37+
value = {
38+
owner = "root";
39+
group = "root";
40+
inherit program;
41+
setuid = true;
42+
source = lib.meta.getExe' cfg.package "${program}-nosetuid";
43+
};
44+
})
45+
);
46+
47+
# Make all LinuxCNC programs and required tools available
48+
environment.systemPackages = [
49+
cfg.package
50+
pkgs.iptables
51+
];
52+
};
53+
}

0 commit comments

Comments
 (0)