diff --git a/modules/services/x11/display-managers/default.nix b/modules/services/x11/display-managers/default.nix index 2261d417d04f..cdfd271ee65c 100644 --- a/modules/services/x11/display-managers/default.nix +++ b/modules/services/x11/display-managers/default.nix @@ -80,6 +80,8 @@ let source /etc/profile + ${cfg.displayManager.sessionCommands} + # Allow the user to setup a custom session type. if test -x ~/.xsession; then exec ~/.xsession @@ -164,6 +166,16 @@ in apply = toString; }; + sessionCommands = mkOption { + default = ""; + example = + '' + xmessage "Hello World!" & + ''; + type = types.string; + description = "Shell commands executed just before the window or desktop manager is started."; + }; + session = mkOption { default = []; example = [ diff --git a/modules/virtualisation/virtualbox-guest.nix b/modules/virtualisation/virtualbox-guest.nix index 9f215e816563..04fca1eb4e98 100644 --- a/modules/virtualisation/virtualbox-guest.nix +++ b/modules/virtualisation/virtualbox-guest.nix @@ -60,6 +60,11 @@ in InputDevice "VBoxMouse" ''; + services.xserver.displayManager.sessionCommands = + '' + PATH=${makeSearchPath "bin" [ pkgs.gnugrep pkgs.which pkgs.xorg.xorgserver ]}:$PATH \ + ${kernel.virtualboxGuestAdditions}/bin/VBoxClient-all + ''; }; }