26 lines
781 B
Nix
26 lines
781 B
Nix
{ config, lib, pkgs, ... }:
|
|
let
|
|
cfg = config.local.packages.linuxcnc;
|
|
inherit (builtins) filter map pathExists listToAttrs;
|
|
linuxcncEnv = pkgs.buildEnv {
|
|
name = "linuxcnc-env";
|
|
paths = with pkgs; [ linuxcnc hal-cia402 linuxcnc-ethercat ];
|
|
};
|
|
in {
|
|
options.local.packages.linuxcnc.enable = lib.mkEnableOption "Enable linuxcnc";
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
environment.systemPackages = with pkgs; [ linuxcncEnv ];
|
|
|
|
security.wrappers = listToAttrs (map (f: {
|
|
name = f;
|
|
value = {
|
|
setuid = true;
|
|
owner = "root";
|
|
group = "root";
|
|
source = "${linuxcncEnv.pkgs.linuxcnc}/bin/${f}-nosetuid";
|
|
};
|
|
}) (filter (f: pathExists "${linuxcncEnv.pkgs.linuxcnc}/bin/${f}-nosetuid") pkgs.linuxcnc.setuidApps));
|
|
};
|
|
}
|