-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
linuxnc: module init #513364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
wucke13
wants to merge
5
commits into
NixOS:master
Choose a base branch
from
wucke13:dev/wucke13/add-linuxcnc
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
linuxnc: module init #513364
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4355011
gesaflash: init at 3.4.9-unstable-2025-08-10
wucke13 07bc916
python3Packages.yapps: init at 2.2.0
wucke13 8fd23e8
tclPackages.blt: init at 2.5.3
wucke13 f972ae8
linuxcnc: init at 2.9.8
wucke13 a61763e
nixos/linuxcnc: init module
wucke13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| { | ||
| config, | ||
| lib, | ||
| pkgs, | ||
| ... | ||
| }: | ||
|
|
||
| let | ||
| cfg = config.programs.linuxcnc; | ||
| in | ||
| { | ||
| meta.maintainers = with lib.maintainers; [ wucke13 ]; | ||
|
|
||
| options.programs.linuxcnc = { | ||
|
|
||
| enable = lib.options.mkEnableOption "linuxcnc"; | ||
|
|
||
| package = (lib.options.mkPackageOption pkgs "linuxcnc" { }) // { | ||
| apply = p: p.override { enableSetuidWrapperRedirection = true; }; | ||
| }; | ||
|
|
||
| }; | ||
|
|
||
| config = lib.mkIf cfg.enable { | ||
| security.wrappers = lib.mkIf cfg.enable ( | ||
| lib.attrsets.genAttrs' cfg.package.setuidApps (program: { | ||
| name = "linuxcnc-${program}"; | ||
| value = { | ||
| owner = "root"; | ||
| group = "root"; | ||
| inherit program; | ||
| setuid = true; | ||
| source = lib.meta.getExe' cfg.package "${program}-nosetuid"; | ||
| }; | ||
| }) | ||
| ); | ||
|
|
||
| environment.systemPackages = [ | ||
| cfg.package | ||
| pkgs.iptables | ||
| ]; | ||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,152 @@ | ||
| { hostPkgs, ... }: | ||
| { | ||
| name = "linuxcnc"; | ||
|
|
||
| nodes.machine = | ||
| { nodes, pkgs, ... }: | ||
| let | ||
| user = nodes.machine.users.users.alice; | ||
| in | ||
| { | ||
| imports = [ | ||
| ./common/user-account.nix | ||
| ./common/x11.nix | ||
| ]; | ||
| test-support.displayManager.auto.user = user.name; | ||
| virtualisation.memorySize = 4096; | ||
|
|
||
| programs.linuxcnc.enable = true; | ||
| environment = { | ||
| variables.LINUXCNC_FORCE_REALTIME = "1"; | ||
| systemPackages = [ pkgs.xdotool ]; | ||
| }; | ||
| }; | ||
|
|
||
| enableOCR = true; | ||
|
|
||
| testScript = | ||
| { nodes, ... }: | ||
| let | ||
| user = nodes.machine.users.users.alice; | ||
| in | ||
| '' | ||
| import shlex | ||
|
|
||
| machine.wait_for_x() | ||
|
|
||
| # required so that wait_for_window can access alice's X session | ||
| machine.succeed("xauth merge ~${user.name}/.Xauthority") | ||
|
|
||
| def spawn_as_user(command: str): | ||
| command += " >&2 &" | ||
| escaped_command = shlex.quote(command) | ||
| machine.succeed(f"su - ${user.name} -c -- {escaped_command}") | ||
|
|
||
| def window_close(): | ||
| machine.succeed("xdotool getactivewindow windowquit") | ||
|
|
||
| def window_maximize(): | ||
| machine.succeed("xdotool getactivewindow windowsize --sync 100% 100%") | ||
|
|
||
| screenshot_counter: int = 0 | ||
| def screenshot(name: str): | ||
| global screenshot_counter | ||
| machine.screenshot(f"{screenshot_counter:02d}-{name}") | ||
| screenshot_counter += 1 | ||
|
|
||
|
|
||
| with subtest("Test latency-test"): | ||
| spawn_as_user("latency-test") | ||
| machine.wait_for_window("LinuxCNC / HAL Latency Test") | ||
| machine.wait_for_text("Let this test run for a few minutes") | ||
| machine.wait_for_text("Reset Statistics") | ||
| screenshot("latency-test") | ||
| window_close() | ||
| machine.wait_until_fails("pgrep rtapi_app") | ||
|
|
||
| with subtest("Test latency-histogram"): | ||
| spawn_as_user("latency-histogram") | ||
| machine.wait_for_window("latency-histogram") | ||
| machine.wait_for_text("ylogscale") | ||
| machine.wait_for_text("binsize") | ||
| screenshot("latency-histogram") | ||
| window_close() | ||
| machine.wait_until_fails("pgrep rtapi_app") | ||
|
|
||
| with subtest("Test latency-plot"): | ||
| spawn_as_user("latency-plot") | ||
| machine.wait_for_window("latency-plot") | ||
| window_maximize() | ||
| machine.wait_for_text("Latency \\S+ vs Time \\S+") | ||
| machine.wait_for_text("Pts") | ||
| screenshot("latency-plot") | ||
| window_close() | ||
| machine.wait_until_fails("pgrep rtapi_app") | ||
|
|
||
|
|
||
| with subtest("Test LinuxCNC configuration selector"): | ||
| spawn_as_user("linuxcnc") | ||
| machine.wait_for_window("LinuxCNC Configuration Selector") | ||
| window_maximize() | ||
| machine.wait_for_text("Welcome to LinuxCNC.") | ||
| screenshot("linuxcnc-configuration-selector") | ||
|
|
||
| with subtest("Test copy to new AXIS config"): | ||
| machine.send_key("ret") | ||
| machine.wait_for_text("Would you like to copy the") | ||
| machine.send_key("ret") | ||
| machine.wait_for_text("The configuration file has been copied to") | ||
| machine.send_key("ret") | ||
|
|
||
| with subtest("Test AXIS GUI"): | ||
| # The "AXIS Manual Toolchanger" window will appear briefly | ||
| machine.wait_for_window("^axis.ngc") | ||
| window_maximize() | ||
| machine.wait_for_text("ESTOP") | ||
| screenshot("linuxcnc-axis") | ||
|
|
||
| # Basic test of AXIS | ||
| machine.send_key("f1") # toggle e-stop | ||
| machine.wait_for_text("OFF") | ||
| machine.send_key("f2") # toggle machine power to on | ||
| machine.wait_for_text("ON") | ||
| machine.send_key("f4") # switch from Preview to DRO | ||
| machine.send_key("ctrl-home") # home all axes | ||
| machine.sleep(5) # wait until homing is at least started | ||
| machine.wait_for_text("X:\\s+0.0000") # wait until homing is done | ||
| machine.wait_for_text("Y:\\s+0.0000") | ||
| machine.wait_for_text("Z:\\s+0.0000") | ||
| machine.send_key("f5") # switch from Manual Control to MDI | ||
| machine.send_chars("G0 X.1337 Y.42 Z-.13\n") # go to specific coordinates | ||
| machine.wait_for_text("0.1337") # wait until machine reached desired X coordinate | ||
| screenshot("linuxcnc-axis-moved-mdi-dro") | ||
| machine.send_key("f4") # switch from DRO to Preview | ||
| machine.sleep(5) # avoid the keys beeing eaten | ||
| machine.send_key("f3") # switch from MDI to Manual Control | ||
| machine.wait_for_text("Touch off") # wait for Manual Control to be rendered | ||
| screenshot("linuxcnc-axis-moved-manual-control-preview") | ||
|
|
||
| with subtest("Test image-to-gcode"): | ||
| machine.copy_from_host("${hostPkgs.nixos-icons}/share/icons/hicolor/128x128/apps/nix-snowflake.png", | ||
| "/home/${user.name}/linuxcnc/nc_files/test-image.png") | ||
| machine.send_key("o") | ||
| machine.wait_for_window("Open") | ||
| machine.send_chars("test-image.png\n") | ||
| machine.wait_for_window("Image to G-code") | ||
| screenshot("linuxcnc-axis-image-to-gcode") | ||
| machine.send_key("ret") | ||
| machine.wait_for_text("M3") | ||
| machine.wait_for_text("P3") | ||
| screenshot("linuxcnc-axis-image-to-gcode-preview") | ||
|
|
||
| with subtest("Test shutdown AXIS"): | ||
| window_close() | ||
| machine.wait_for_text("Do you really want to close LinuxCNC?") | ||
| machine.send_key("tab") | ||
| machine.send_key("ret") | ||
| machine.wait_until_fails("pgrep rtapi_app") | ||
|
|
||
|
|
||
| machine.shutdown() | ||
| ''; | ||
| } |
26 changes: 26 additions & 0 deletions
26
pkgs/by-name/li/linuxcnc/fix-hardcoded-executable-paths.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| diff --git a/tcl/bin/genedit.tcl b/tcl/bin/genedit.tcl | ||
| index 03eed07eb0..1dd7d26544 100755 | ||
| --- a/tcl/bin/genedit.tcl | ||
| +++ b/tcl/bin/genedit.tcl | ||
| @@ -150,7 +150,7 @@ proc geneditStart {name {ifilename "untitled.txt"} {itypes { {"All files" *} {"T | ||
| $menubar add cascade -label [msgcat::mc "Scripts"] -menu $scriptmenu -underline 1 | ||
| #replaced scriptdir | ||
| #set scriptdir tcl/scripts | ||
| - set files [exec /bin/ls $linuxcnc::TCL_SCRIPT_DIR] | ||
| + set files [exec ls $linuxcnc::TCL_SCRIPT_DIR] | ||
| foreach file $files { | ||
| if {[string match *.ncw $file]} { | ||
| set geneditfname [file rootname $file] | ||
| diff --git a/tcl/tklinuxcnc.tcl b/tcl/tklinuxcnc.tcl | ||
| index d35db33840..9030ca219e 100755 | ||
| --- a/tcl/tklinuxcnc.tcl | ||
| +++ b/tcl/tklinuxcnc.tcl | ||
| @@ -797,7 +797,7 @@ set scriptsmenu [menu $menubar.scripts -tearoff 1] | ||
| $menubar add cascade -label [msgcat::mc "Scripts"] -menu $scriptsmenu -underline 1 | ||
|
|
||
| if { $windows == 0 } { | ||
| - set files [exec /bin/ls $linuxcnc::TCL_SCRIPT_DIR] | ||
| + set files [exec ls $linuxcnc::TCL_SCRIPT_DIR] | ||
| foreach file $files { | ||
| if {[string match *.tcl $file]} { | ||
| set fname [file rootname $file] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.