diff options
author | tzlil <tzlils@protonmail.com> | 2023-01-14 14:55:03 +0200 |
---|---|---|
committer | tzlil <tzlils@protonmail.com> | 2023-01-14 14:55:03 +0200 |
commit | 5c2c785818f31e5aba2781e1b4c237d7db51a919 (patch) | |
tree | 7ef215664a2371d9e1e716adde8df28f6be4d8f4 | |
parent | 3251c991e9eb9357e5f8e02b5ddbd7acae056d35 (diff) |
add serial mon:stdio to run script, change sw and sb fish functions to use remote sudo, add i3status-rust config to sway
-rw-r--r-- | mixins/cli.nix | 4 | ||||
-rw-r--r-- | mixins/sway.nix | 448 | ||||
-rwxr-xr-x | run.sh | 2 |
3 files changed, 230 insertions, 224 deletions
diff --git a/mixins/cli.nix b/mixins/cli.nix index 6560e4b..9d2ba95 100644 --- a/mixins/cli.nix +++ b/mixins/cli.nix @@ -31,8 +31,8 @@ l = "ls -alh"; }; functions = { - sb.body = "sudo nixos-rebuild build --flake git+ssh://tzlil@100.99.246.128/home/tzlil/newflake"; - sw.body = "sudo nixos-rebuild switch --flake git+ssh://tzlil@100.99.246.128/home/tzlil/newflake"; + sb.body = "nixos-rebuild build --flake git+ssh://tzlil@100.99.246.128/home/tzlil/newflake --use-remote-sudo"; + sw.body = "nixos-rebuild switch --flake git+ssh://tzlil@100.99.246.128/home/tzlil/newflake --use-remote-sudo"; }; }; }; diff --git a/mixins/sway.nix b/mixins/sway.nix index c1dffa4..c614d49 100644 --- a/mixins/sway.nix +++ b/mixins/sway.nix @@ -30,255 +30,261 @@ ${pkgs.slurp}/bin/slurp ''; in { - config.home-manager.users.tzlil.xdg.configFile."i3status-rust/config.toml".text = '' - icons = "awesome6" + config = { + security.pam.services.swaylock = {}; + home-manager.users.tzlil = { + xdg.configFile."i3status-rust/config.toml".text = '' + icons = "awesome6" - [theme] - name = "native" + [theme] + name = "native" - [[block]] - block = "music" - hide_when_empty = true - marquee = false - on_click = "playerctl play-pause" - dynamic_width = true + [[block]] + block = "music" + hide_when_empty = true + marquee = false + on_click = "playerctl play-pause" + dynamic_width = true - [[block]] - block = "networkmanager" + [[block]] + block = "networkmanager" - [[block]] - block = "sound" - on_click = "pavucontrol" + [[block]] + block = "sound" + on_click = "pavucontrol" - [[block]] - block = "time" - interval = 60 - format = "%a %Y-%m-%d %H:%M" - ''; - config.security.pam.services.swaylock = {}; - config.home-manager.users.tzlil.programs.mako.enable = true; - config.home-manager.users.tzlil.home.packages = with pkgs; [ - grim - slurp - wf-recorder - font-awesome_6 - waypipe - foot - ]; - config.home-manager.users.tzlil.services.swayidle = let - pgrep = "${pkgs.procps}/bin/pgrep"; - dpms_check = s: - pkgs.writeShellScript "dpms_check_${s}" '' - set -x - if ${pgrep} swaylock; then ${pkgs.sway}/bin/swaymsg 'output * dpms ${s}'; fi + [[block]] + block = "time" + interval = 60 + format = "%a %Y-%m-%d %H:%M" ''; - dpms_set = s: - pkgs.writeShellScript "dpms_set_${s}" '' - set -x - "${pkgs.sway}/bin/swaymsg" 'output * dpms ${s}' - ''; - fadelock = pkgs.writeShellScript "fadelock.sh" '' - set -x - exec "${pkgs.swaylock}/bin/swaylock" - ''; - in { - enable = false; - systemdTarget = "graphical-session.target"; - # timeouts = [ - # # auto-lock after 30 seconds - # { - # timeout = 30; - # command = fadelock.outPath; - # } - # ]; - events = [ - { - event = "before-sleep"; - command = fadelock.outPath; - } - ]; - extraArgs = [ - "idlehint 30" - ]; - }; - config.home-manager.users.tzlil.wayland.windowManager.sway = rec { - enable = true; - wrapperFeatures.gtk = true; - config = rec { - fonts = { - names = ["Iosevka"]; - style = "Regular"; - size = 11.0; - }; - output = { - "DP-1" = { - resolution = "1920x1080@166Hz"; - }; + programs.mako.enable = true; + home.packages = with pkgs; [ + grim + slurp + wf-recorder + font-awesome_6 + waypipe + foot + ]; + + services.swayidle = let + pgrep = "${pkgs.procps}/bin/pgrep"; + dpms_check = s: + pkgs.writeShellScript "dpms_check_${s}" '' + set -x + if ${pgrep} swaylock; then ${pkgs.sway}/bin/swaymsg 'output * dpms ${s}'; fi + ''; + dpms_set = s: + pkgs.writeShellScript "dpms_set_${s}" '' + set -x + "${pkgs.sway}/bin/swaymsg" 'output * dpms ${s}' + ''; + fadelock = pkgs.writeShellScript "fadelock.sh" '' + set -x + exec "${pkgs.swaylock}/bin/swaylock" + ''; + in { + enable = false; + systemdTarget = "graphical-session.target"; + # timeouts = [ + # # auto-lock after 30 seconds + # { + # timeout = 30; + # command = fadelock.outPath; + # } + # ]; + events = [ + { + event = "before-sleep"; + command = fadelock.outPath; + } + ]; + extraArgs = [ + "idlehint 30" + ]; }; - bars = [ - { + + wayland.windowManager.sway = rec { + enable = true; + wrapperFeatures.gtk = true; + config = rec { fonts = { - names = ["Iosevka" "FontAwesome"]; + names = ["Iosevka"]; style = "Regular"; size = 11.0; }; - position = "top"; - statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs"; - colors = { - statusline = "#ffffff"; - background = "#323232"; - inactiveWorkspace = { - background = "#323232"; - border = "#323232"; - text = "#5c5c5c"; + output = { + "DP-1" = { + resolution = "1920x1080@166Hz"; }; }; - } - ]; + bars = [ + { + fonts = { + names = ["Iosevka" "FontAwesome"]; + style = "Regular"; + size = 11.0; + }; + position = "top"; + statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs"; + colors = { + statusline = "#ffffff"; + background = "#323232"; + inactiveWorkspace = { + background = "#323232"; + border = "#323232"; + text = "#5c5c5c"; + }; + }; + } + ]; - modifier = "Mod5"; - left = "h"; - down = "n"; - up = "e"; - right = "i"; - keybindings = { - "${modifier}+Return" = "exec $term"; - "${modifier}+q" = "kill"; - "${modifier}+space" = "exec ${pkgs.dmenu}/bin/dmenu_path | ${menuscript} | xargs swaymsg exec --"; - "${modifier}+Shift+c" = "reload"; - "${modifier}+Shift+q" = "exit"; - "${modifier}+Shift+p" = "exec systemctl poweroff"; - "${modifier}+Shift+s" = "exec systemctl suspend"; - "${modifier}+${left}" = "focus left"; - "${modifier}+${down}" = "focus down"; - "${modifier}+${up}" = "focus up"; - "${modifier}+${right}" = "focus right"; - "${modifier}+Left" = "focus left"; - "${modifier}+Down" = "focus down"; - "${modifier}+Up" = "focus up"; - "${modifier}+Right" = "focus right"; - "${modifier}+Shift+${left}" = "move left"; - "${modifier}+Shift+${down}" = "move down"; - "${modifier}+Shift+${up}" = "move up"; - "${modifier}+Shift+${right}" = "move right"; - "${modifier}+Shift+Left" = "move left"; - "${modifier}+Shift+Down" = "move down"; - "${modifier}+Shift+Up" = "move up"; - "${modifier}+Shift+Right" = "move right"; - "${modifier}+1" = "workspace number 1"; - "${modifier}+2" = "workspace number 2"; - "${modifier}+3" = "workspace number 3"; - "${modifier}+4" = "workspace number 4"; - "${modifier}+5" = "workspace number 5"; - "${modifier}+6" = "workspace number 6"; - "${modifier}+7" = "workspace number 7"; - "${modifier}+8" = "workspace number 8"; - "${modifier}+9" = "workspace number 9"; - "${modifier}+0" = "workspace number 10"; - "${modifier}+Tab" = "workspace back_and_forth"; - "${modifier}+Shift+1" = "move container to workspace number 1"; - "${modifier}+Shift+2" = "move container to workspace number 2"; - "${modifier}+Shift+3" = "move container to workspace number 3"; - "${modifier}+Shift+4" = "move container to workspace number 4"; - "${modifier}+Shift+5" = "move container to workspace number 5"; - "${modifier}+Shift+6" = "move container to workspace number 6"; - "${modifier}+Shift+7" = "move container to workspace number 7"; - "${modifier}+Shift+8" = "move container to workspace number 8"; - "${modifier}+Shift+9" = "move container to workspace number 9"; - "${modifier}+Shift+0" = "move container to workspace number 10"; - "${modifier}+b" = "splith"; - "${modifier}+v" = "splitv"; - "${modifier}+s" = "layout stacking"; - "${modifier}+w" = "layout tabbed"; - "${modifier}+k" = "layout toggle split"; - "${modifier}+f" = "fullscreen"; - "${modifier}+Shift+space" = "floating toggle"; - "${modifier}+t" = "focus mode_toggle"; - "${modifier}+a" = "focus parent"; - "${modifier}+shift+a" = "focus child"; - "${modifier}+Shift+minus" = "move scratchpad"; - "${modifier}+minus" = "scratchpad show"; - "${modifier}+m" = "mode notifications"; - }; - input = { - "type:keyboard" = { - xkb_layout = "us"; - xkb_variant = "colemak_dh"; - xkb_options = "altwin:swap_lalt_lwin,caps:backspace"; - }; - "type:touchpad" = { - tap = "enabled"; + modifier = "Mod4"; + left = "h"; + down = "n"; + up = "e"; + right = "i"; + keybindings = { + "${modifier}+Return" = "exec $term"; + "${modifier}+q" = "kill"; + "${modifier}+space" = "exec ${pkgs.dmenu}/bin/dmenu_path | ${menuscript} | xargs swaymsg exec --"; + "${modifier}+Shift+c" = "reload"; + "${modifier}+Shift+q" = "exit"; + "${modifier}+Shift+p" = "exec systemctl poweroff"; + "${modifier}+Shift+s" = "exec systemctl suspend"; + "${modifier}+${left}" = "focus left"; + "${modifier}+${down}" = "focus down"; + "${modifier}+${up}" = "focus up"; + "${modifier}+${right}" = "focus right"; + "${modifier}+Left" = "focus left"; + "${modifier}+Down" = "focus down"; + "${modifier}+Up" = "focus up"; + "${modifier}+Right" = "focus right"; + "${modifier}+Shift+${left}" = "move left"; + "${modifier}+Shift+${down}" = "move down"; + "${modifier}+Shift+${up}" = "move up"; + "${modifier}+Shift+${right}" = "move right"; + "${modifier}+Shift+Left" = "move left"; + "${modifier}+Shift+Down" = "move down"; + "${modifier}+Shift+Up" = "move up"; + "${modifier}+Shift+Right" = "move right"; + "${modifier}+1" = "workspace number 1"; + "${modifier}+2" = "workspace number 2"; + "${modifier}+3" = "workspace number 3"; + "${modifier}+4" = "workspace number 4"; + "${modifier}+5" = "workspace number 5"; + "${modifier}+6" = "workspace number 6"; + "${modifier}+7" = "workspace number 7"; + "${modifier}+8" = "workspace number 8"; + "${modifier}+9" = "workspace number 9"; + "${modifier}+0" = "workspace number 10"; + "${modifier}+Tab" = "workspace back_and_forth"; + "${modifier}+Shift+1" = "move container to workspace number 1"; + "${modifier}+Shift+2" = "move container to workspace number 2"; + "${modifier}+Shift+3" = "move container to workspace number 3"; + "${modifier}+Shift+4" = "move container to workspace number 4"; + "${modifier}+Shift+5" = "move container to workspace number 5"; + "${modifier}+Shift+6" = "move container to workspace number 6"; + "${modifier}+Shift+7" = "move container to workspace number 7"; + "${modifier}+Shift+8" = "move container to workspace number 8"; + "${modifier}+Shift+9" = "move container to workspace number 9"; + "${modifier}+Shift+0" = "move container to workspace number 10"; + "${modifier}+b" = "splith"; + "${modifier}+v" = "splitv"; + "${modifier}+s" = "layout stacking"; + "${modifier}+w" = "layout tabbed"; + "${modifier}+k" = "layout toggle split"; + "${modifier}+f" = "fullscreen"; + "${modifier}+Shift+space" = "floating toggle"; + "${modifier}+t" = "focus mode_toggle"; + "${modifier}+a" = "focus parent"; + "${modifier}+shift+a" = "focus child"; + "${modifier}+Shift+minus" = "move scratchpad"; + "${modifier}+minus" = "scratchpad show"; + "${modifier}+m" = "mode notifications"; + }; + input = { + "type:keyboard" = { + xkb_layout = "us"; + xkb_variant = "colemak_dh"; + xkb_options = "altwin:swap_lalt_lwin,caps:backspace"; + }; + "type:touchpad" = { + tap = "enabled"; + }; + }; }; - }; - }; - extraConfig = '' - exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway - # exec ${pkgs.swayidle}/bin/swayidle -w \ - # timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' \ - # timeout 600 'swaymsg "output * dpms off"' \ - # resume 'swaymsg "output * dpms on"' \ - # before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000' - # exec ${pkgs.polkit_gnome}/polkit-gnome/polkit-gnome-authentication-agent-1 + extraConfig = '' + exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + # exec ${pkgs.swayidle}/bin/swayidle -w \ + # timeout 300 '${pkgs.swaylock}/bin/swaylock -f -c 000000' \ + # timeout 600 'swaymsg "output * dpms off"' \ + # resume 'swaymsg "output * dpms on"' \ + # before-sleep '${pkgs.swaylock}/bin/swaylock -f -c 000000' + # exec ${pkgs.polkit_gnome}/polkit-gnome/polkit-gnome-authentication-agent-1 - #set $mod Alt - set $mod Mod4 - set $left h - set $down n - set $up e - set $right i - set $term ${pkgs.foot}/bin/foot + #set $mod Alt + set $mod Mod4 + set $left h + set $down n + set $up e + set $right i + set $term ${pkgs.foot}/bin/foot - default_border pixel - hide_edge_borders smart - smart_borders on + default_border pixel + hide_edge_borders smart + smart_borders on - output * bg ~/tmp/graveyard.png fill + output * bg ~/tmp/graveyard.png fill - floating_modifier $mod normal - mode notifications { - bindsym Escape mode default - bindsym Return exec ${pkgs.mako}/bin/makoctl invoke; exec ${pkgs.mako}/bin/makoctl dismiss; mode default - bindsym d exec ${pkgs.mako}/bin/makoctl dismiss; mode default - bindsym Shift+d exec ${pkgs.mako}/bin/makoctl dismiss -a; mode default - } + floating_modifier $mod normal + mode notifications { + bindsym Escape mode default + bindsym Return exec ${pkgs.mako}/bin/makoctl invoke; exec ${pkgs.mako}/bin/makoctl dismiss; mode default + bindsym d exec ${pkgs.mako}/bin/makoctl dismiss; mode default + bindsym Shift+d exec ${pkgs.mako}/bin/makoctl dismiss -a; mode default + } - font Iosevka 10 + font Iosevka 10 - bindsym $mod+p exec passmenu $menu_args - bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle - bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% - bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% - bindsym --locked XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle + bindsym $mod+p exec passmenu $menu_args + bindsym --locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle + bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% + bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% + bindsym --locked XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle - bindsym --locked XF86AudioNext exec playerctl next - bindsym --locked XF86AudioPlay exec playerctl play-pause - bindsym --locked XF86AudioPrev exec playerctl previous - bindsym --locked XF86AudioStop exec playerctl stop + bindsym --locked XF86AudioNext exec playerctl next + bindsym --locked XF86AudioPlay exec playerctl play-pause + bindsym --locked XF86AudioPrev exec playerctl previous + bindsym --locked XF86AudioStop exec playerctl stop - for_window [app_id="^menu$"] floating enable, border none - for_window [app_id="mpv"] sticky enable - for_window [floating] border csd - for_window [app_id="firefox" title="Picture-in-Picture"] floating enable, sticky enable, border none - for_window [app_id="imv"] floating enable - for_window [app_id="imv"] floating enable - for_window [class="PacketTracer"] floating enable + for_window [app_id="^menu$"] floating enable, border none + for_window [app_id="mpv"] sticky enable + for_window [floating] border csd + for_window [app_id="firefox" title="Picture-in-Picture"] floating enable, sticky enable, border none + for_window [app_id="imv"] floating enable + for_window [app_id="imv"] floating enable + for_window [class="PacketTracer"] floating enable - bindsym XF86MonBrightnessUp exec light -A 5 - bindsym XF86MonBrightnessDown exec light -U 5 + bindsym XF86MonBrightnessUp exec light -A 5 + bindsym XF86MonBrightnessDown exec light -U 5 - bindsym Print exec ${pkgs.grim}/bin/grim - | tee $(xdg-user-dir PICTURES)/$(date +'%s_grim.png') | wl-copy - bindsym Shift+Print exec ${pkgs.grim}/bin/grim -g "$(${sel})" - | tee $(xdg-user-dir PICTURES)/$(date +'%s_grim.png') | wl-copy - bindsym Ctrl+Print exec ${pkgs.grim}/bin/grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" - |tee $(xdg-user-dir PICTURES)/$(date +'%s_grim.png') | wl-copy + bindsym Print exec ${pkgs.grim}/bin/grim - | tee $(xdg-user-dir PICTURES)/$(date +'%s_grim.png') | wl-copy + bindsym Shift+Print exec ${pkgs.grim}/bin/grim -g "$(${sel})" - | tee $(xdg-user-dir PICTURES)/$(date +'%s_grim.png') | wl-copy + bindsym Ctrl+Print exec ${pkgs.grim}/bin/grim -g "$(swaymsg -t get_tree | jq -j '.. | select(.type?) | select(.focused).rect | "\(.x),\(.y) \(.width)x\(.height)"')" - |tee $(xdg-user-dir PICTURES)/$(date +'%s_grim.png') | wl-copy - bindsym $mod+l exec ${pkgs.swaylock}/bin/swaylock -c 070D0D + bindsym $mod+l exec ${pkgs.swaylock}/bin/swaylock -c 070D0D - exec ${pkgs.mako}/bin/mako >/tmp/mako.log 2>&1 - exec_always kanshi >/tmp/kanshi.log 2>&1 + exec ${pkgs.mako}/bin/mako >/tmp/mako.log 2>&1 + exec_always kanshi >/tmp/kanshi.log 2>&1 - include /etc/sway/config.d/* - ''; - }; -} \ No newline at end of file + include /etc/sway/config.d/* + ''; + }; + } + } +3} \ No newline at end of file diff --git a/run.sh b/run.sh index 7e89e0d..5844710 100755 --- a/run.sh +++ b/run.sh @@ -1,2 +1,2 @@ #!/bin/sh -qemu-kvm -enable-kvm -m 4G -cpu host -smp 2 -hda nixos-test.img -virtfs local,path=/home/tzlil/newflake,mount_tag=host0,security_model=passthrough,id=host0 -bios OVMF.fd -vga virtio -display gtk,gl=on,show-cursor=on -usb -device usb-mouse +qemu-kvm -enable-kvm -m 4G -cpu host -smp 2 -hda nixos-test.img -serial mon:stdio -virtfs local,path=/home/tzlil/newflake,mount_tag=host0,security_model=passthrough,id=host0 -bios OVMF.fd -vga virtio -display gtk,gl=on,show-cursor=on -usb -device usb-mouse |