Created
April 30, 2020 21:33
-
-
Save erikarvstedt/db6410924ebde429841b7b8661181f12 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vm=$(nix-build --no-out-link - <<'EOF' | |
(import <nixpkgs/nixos> { | |
configuration = { pkgs, lib, ... }: with lib; { | |
users.users.me.isNormalUser = true; | |
services.xserver = { | |
enable = true; | |
desktopManager.xterm.enable = true; | |
displayManager.lightdm = { | |
enable = true; | |
autoLogin.enable = true; | |
autoLogin.user = "me"; | |
}; | |
displayManager.sessionCommands = '' | |
keyboardId=$( | |
${pkgs.xorg.xinput}/bin/xinput | | |
sed -nE 's/.*?Virtual core keyboard.*?id=([0-9]+).*?master keyboard.*/\1/p' | |
) | |
if [[ $keyboardId ]]; then | |
${pkgs.xorg.setxkbmap}/bin/setxkbmap -device $keyboardId -option caps:swapescape | |
fi | |
''; | |
}; | |
}; | |
}).vm | |
EOF | |
) | |
export NIX_DISK_IMAGE=/tmp/vmimg; rm -f $NIX_DISK_IMAGE; QEMU_OPTS='-m 1024 -smp 3' $vm/bin/run-*-vm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment