1
0
Fork 0

Implements generation of monitor section

master
dump_stack() 2018-06-30 21:56:43 +00:00
parent 1d9c9c2196
commit 802c70e0ec
4 changed files with 32 additions and 4 deletions

View File

@ -4,8 +4,6 @@ Simple application VM's based on Nix package manager.
Designed primarily for full screen usage without guest additions.
By default uses 3840x2160, so you need to change `appvm/nix/base.nix` monitorSection. Autodetection based on host resolution will be done after.
It's a proof-of-concept, but you can still use it. Also there is a lot of strange things inside, don't afraid of :)
## Install Nix package manager
@ -23,9 +21,17 @@ It's a proof-of-concept, but you can still use it. Also there is a lot of strang
(if you clone appvm to home directory)
## Generate resolution
By default uses 3840x2160. If you need to regenerate `appvm/nix/monitor.nix`:
$ appvm/appvm.sh generate-resolution 1920 1080 > appvm/nix/monitor.nix
Autodetection is a bash-spaghetti, so you need to check results. BTW it's just a X.org monitor section.
## Create VM
$ $HOME/appvm/appvm.sh chromium
$ $HOME/appvm/appvm.sh build chromium
## Run application

View File

@ -19,6 +19,17 @@ if [[ "$1" == "build" && "$2" != "" ]]; then
chmod +x ${VM_BIN_PATH}
chmod +x bin/appvm.${2}
unlink result
elif [[ "$1" == "generate-resolution" && "$2" != "" && "$3" != "" ]]; then
MONITOR_SIZE="$(xrandr | grep mm | head -n 1 | awk '{ print $(NF-2) " " $(NF) }' | sed 's/mm//g')"
CVT="$(cvt ${2} ${3} | grep Modeline)"
echo "{"
echo " services.xserver.monitorSection = ''"
echo " " ${CVT}
echo " " Option '"PreferredMode"' $(echo ${CVT} | awk '{ print $2 }')
echo " " DisplaySize ${MONITOR_SIZE} # In millimeters
echo " '';"
echo "}"
else
echo "Usage: $0 build APPLICATION"
echo -e "Usage:\t$0 build APPLICATION"
echo -e "or:\t$0 generate-resolution X Y"
fi

View File

@ -1,4 +1,8 @@
{
imports = [
<nix/monitor.nix>
];
system.nixos.stateVersion = "18.03";
services.xserver = {

7
nix/monitor.nix Normal file
View File

@ -0,0 +1,7 @@
{
services.xserver.monitorSection = ''
Modeline "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
Option "PreferredMode" "3840x2160_60.00"
DisplaySize 610 350
'';
}