From 5976b79b5e7e22c783fd3d6238f7967c50df9f41 Mon Sep 17 00:00:00 2001 From: Fabian Hauser Date: Sun, 6 Jun 2021 16:27:14 +0200 Subject: [PATCH] Add wsudo command --- .../fhauser/applications/scripts.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/defaults/user-configuration/fhauser/applications/scripts.nix b/defaults/user-configuration/fhauser/applications/scripts.nix index 0a8b434..4cb579c 100644 --- a/defaults/user-configuration/fhauser/applications/scripts.nix +++ b/defaults/user-configuration/fhauser/applications/scripts.nix @@ -59,7 +59,19 @@ let echo "Starting '$COMMAND' in env '$ENV_FILE'" ${pkgs.nix}/bin/nix-shell ''${ENV_FILE} --run "$COMMAND" ''; + + wsudo = with pkgs.xorg; pkgs.writeScriptBin "wsudo" '' + #!/usr/bin/env bash + #small script to enable root access to x-windows system + ${xhost}/bin/xhost +SI:localuser:root + sudo $1 + #disable root access after application terminates + ${xhost}/bin/xhost -SI:localuser:root + #print access status to allow verification that root access was remov + ed + ${xhost}/bin/xhost + ''; in { home-manager.users.fhauser.home.packages = - [ passbemenu threema-vpn threema-env ]; + [ passbemenu threema-vpn threema-env wsudo ]; }