l xjails: add vglrun option

This commit is contained in:
lassulus 2018-06-27 23:59:14 +02:00
parent 17e9d3156e
commit dac47a8abd

View File

@ -41,6 +41,10 @@ with import <stockholm/lib>;
type = types.path; type = types.path;
default = pkgs.writeScript "echo_lol" "echo lol"; default = pkgs.writeScript "echo_lol" "echo lol";
}; };
vglrun = mkOption {
type = types.bool;
default = false;
};
wm = mkOption { wm = mkOption {
#TODO find type #TODO find type
type = types.string; type = types.string;
@ -116,9 +120,11 @@ with import <stockholm/lib>;
${pkgs.coreutils}/bin/kill $WM_PID ${pkgs.coreutils}/bin/kill $WM_PID
${pkgs.coreutils}/bin/kill $XEPHYR_PID ${pkgs.coreutils}/bin/kill $XEPHYR_PID
''; '';
sudo_ = pkgs.writeDash "${cfg.name}-sudo" '' sudo_ = pkgs.writeDash "${cfg.name}-sudo" (if cfg.vglrun then ''
/var/run/wrappers/bin/sudo -u ${cfg.name} -i ${vglrun_} "$@" /var/run/wrappers/bin/sudo -u ${cfg.name} -i ${vglrun_} "$@"
''; '' else ''
/var/run/wrappers/bin/sudo -u ${cfg.name} -i env DISPLAY=:${cfg.display} ${cfg.script} "$@"
'');
vglrun_ = pkgs.writeDash "${cfg.name}-vglrun" '' vglrun_ = pkgs.writeDash "${cfg.name}-vglrun" ''
DISPLAY=:${cfg.display} ${pkgs.virtualgl}/bin/vglrun ${cfg.extraVglrunArgs} ${cfg.script} "$@" DISPLAY=:${cfg.display} ${pkgs.virtualgl}/bin/vglrun ${cfg.extraVglrunArgs} ${cfg.script} "$@"
''; '';