From fbcb0826d2a520fdd43ea2593beb66f7d04d24df Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 19 Dec 2024 17:33:21 -0500 Subject: [PATCH] Extremely minimal sway setup. --- nix/configuration/roles/sway/default.nix | 22 +++++++++++----- nix/configuration/roles/sway/files/config | 32 +++++++++++++++++++++++ nix/virtual_machine/nix_vm.bash | 13 +++++++++ 3 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 nix/configuration/roles/sway/files/config diff --git a/nix/configuration/roles/sway/default.nix b/nix/configuration/roles/sway/default.nix index 4370d73..95fc58e 100644 --- a/nix/configuration/roles/sway/default.nix +++ b/nix/configuration/roles/sway/default.nix @@ -4,17 +4,27 @@ imports = []; environment.systemPackages = with pkgs; [ - grim # screenshot functionality - slurp # screenshot functionality - wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout - mako # notification system developed by swaywm maintainer + alacritty + firefox ]; - # enable Sway window manager + environment.sessionVariables = { + WLR_RENDERER_ALLOW_SOFTWARE = "1"; + }; + programs.sway = { enable = true; wrapperFeatures.gtk = true; + extraOptions = [ + "--debug" + "--config" + "${./files/config}" + "--unsupported-gpu" + ]; }; - # foo + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; } diff --git a/nix/configuration/roles/sway/files/config b/nix/configuration/roles/sway/files/config new file mode 100644 index 0000000..525c388 --- /dev/null +++ b/nix/configuration/roles/sway/files/config @@ -0,0 +1,32 @@ +# Default config for sway +# +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 +# set $mod Mod1 +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l +# Your preferred terminal emulator +set $term alacritty +# Your preferred application launcher +# Note: it's recommended that you pass the final command to sway +# set $menu dmenu_path | dmenu | xargs swaymsg exec +set $menu wofi --show drun --gtk-dark + +# Do not show a title bar on windows +default_border pixel 2 + +bindsym $mod+grave exec $term + +exec alacritty + +include ~/.config/sway/config.d/*.conf +include /etc/sway/config.d/* diff --git a/nix/virtual_machine/nix_vm.bash b/nix/virtual_machine/nix_vm.bash index 736a11c..3ddc73e 100755 --- a/nix/virtual_machine/nix_vm.bash +++ b/nix/virtual_machine/nix_vm.bash @@ -41,6 +41,10 @@ function main { vm_iso_ssh "${@}" elif [ "$cmd" = "iso_sync" ]; then vm_iso_sync "${@}" + elif [ "$cmd" = "ssh" ]; then + vm_ssh "${@}" + elif [ "$cmd" = "sync" ]; then + vm_sync "${@}" else die 1 "Unknown command: $cmd" fi @@ -97,4 +101,13 @@ function vm_iso_sync { gpg_auth ssh -t -p 60022 nixos@127.0.0.1 sudo nixos-install --flake ./configuration#odovm } +function vm_ssh { + exec gpg_auth ssh -p 60022 127.0.0.1 +} + +function vm_sync { + gpg_auth rsync -av --delete --progress -e 'ssh -p 60022' "$DIR/../configuration" 127.0.0.1:~/ + gpg_auth ssh -t -p 60022 127.0.0.1 doas nixos-rebuild boot --flake ./configuration#odovm +} + main "${@}"