From b7cd20c769f386d21c538339b919f54d6d3aacbc Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 6 May 2021 03:56:20 +0100 Subject: [PATCH] ops/nixos: refactoring for sway --- ops/nixos/lib/graphical-client-wayland.nix | 6 + .../home-manager/graphical-client-wayland.nix | 25 ++- .../lib/home-manager/graphical-client-x11.nix | 6 + .../lib/home-manager/graphical-client.nix | 184 +++++++++--------- 4 files changed, 127 insertions(+), 94 deletions(-) diff --git a/ops/nixos/lib/graphical-client-wayland.nix b/ops/nixos/lib/graphical-client-wayland.nix index b584995ae4..f49111ce47 100644 --- a/ops/nixos/lib/graphical-client-wayland.nix +++ b/ops/nixos/lib/graphical-client-wayland.nix @@ -13,5 +13,11 @@ in config = { my.home-manager.imports = lib.mkAfter [ ./home-manager/graphical-client-wayland.nix ]; + + xdg.portal = { + enable = true; + gtkUsePortal = true; + extraPortals = with depot.pkgs; [ xdg-desktop-portal-wlr ]; + }; }; } diff --git a/ops/nixos/lib/home-manager/graphical-client-wayland.nix b/ops/nixos/lib/home-manager/graphical-client-wayland.nix index a3cd1905d6..c8fee18996 100644 --- a/ops/nixos/lib/home-manager/graphical-client-wayland.nix +++ b/ops/nixos/lib/home-manager/graphical-client-wayland.nix @@ -9,24 +9,43 @@ waybar mako kanshi + + qt5.qtwayland ]); wayland.windowManager.sway = { enable = true; wrapperFeatures.gtk = true; + extraSessionCommands = '' + export SDL_VIDEODRIVER=wayland + export QT_QPA_PLATFORM=wayland + export QT_WAYLAND_DISABLE_WINDOWDECORATION="1" + export XDG_CURRENT_DESKTOP=sway + export MOZ_ENABLE_WAYLAND=1 + export MOZ_USE_XINPUT2=1 + ''; config = { modifier = "Mod4"; keybindings = let modifier = config.wayland.windowManager.sway.config.modifier; in lib.mkOptionDefault { - "${modifier}+l" = "exec loginctl lock-session"; + "${modifier}+l" = "exec ${pkgs.swaylock}/bin/swaylock"; "${modifier}+p" = "exec ${depot.nix.pkgs.flameshot}/bin/flameshot gui"; "${modifier}+Return" = "exec ${pkgs.alacritty}/bin/alacritty"; }; startup = [ - { command = "xss-lock --transfer-sleep-lock -- ${pkgs.swaylock}/bin/swaylock"; } - { command = "${pkgs.gnome3.networkmanagerapplet}/bin/nm-applet"; } ]; + + output."*".bg = "${depot.pkgs.lukegb-wallpapers}/lunik1-gruvbox-dark-rainbow.png fill"; + + # howl: tap-to-click + input."1739:24385:Synaptics_TM2438-005" = { + tap = "enabled"; + tap_button_map = "lrm"; + middle_emulation = "enabled"; + }; }; }; + + my.alacritty.fontSize = 12; } diff --git a/ops/nixos/lib/home-manager/graphical-client-x11.nix b/ops/nixos/lib/home-manager/graphical-client-x11.nix index bae68d6e34..8db047585b 100644 --- a/ops/nixos/lib/home-manager/graphical-client-x11.nix +++ b/ops/nixos/lib/home-manager/graphical-client-x11.nix @@ -19,4 +19,10 @@ ]; }; }; + + services.random-background = { + enable = true; + imageDirectory = "${depot.nix.pkgs.lukegb-wallpapers}"; + interval = null; + }; } diff --git a/ops/nixos/lib/home-manager/graphical-client.nix b/ops/nixos/lib/home-manager/graphical-client.nix index da8b707c84..f9e9c653e8 100644 --- a/ops/nixos/lib/home-manager/graphical-client.nix +++ b/ops/nixos/lib/home-manager/graphical-client.nix @@ -2,100 +2,102 @@ { imports = [ ./client.nix ]; - gtk = { - enable = true; - gtk3.extraConfig = { - gtk-application-prefer-dark-theme = 1; - }; - }; - qt = { - enable = true; - platformTheme = "gtk"; - }; - - home.packages = lib.mkAfter (with pkgs; [ - google-chrome-beta - firefox - mpv - dino - lutris - pavucontrol - pngquant - rxvt_unicode - teamspeak_client - virtmanager - xclip - xss-lock - yubioath-desktop - depot.nix.pkgs.flameshot - ]); - - programs.alacritty = { - enable = true; - settings.font = let - iosevka = style: { family = "Iosevka"; inherit style; }; - in { - normal = iosevka "Regular"; - bold = iosevka "Bold"; - italic = iosevka "Italic"; - bold_italic = iosevka "Bold Italic"; - - size = 6; - }; - settings.colors = { - # Ayu Dark, from https://github.com/alacritty/alacritty/wiki/Color-schemes - primary = { - background = "#0A0E14"; - foreground = "#B3B1AD"; - }; - - # Normal colors - normal = { - black = "#01060E"; - red = "#EA6C73"; - green = "#91B362"; - yellow = "#F9AF4F"; - blue = "#53BDFA"; - magenta = "#FAE994"; - cyan = "#90E1C6"; - white = "#C7C7C7"; - }; - - # Bright colors - bright = { - black = "#686868"; - red = "#F07178"; - green = "#C2D94C"; - yellow = "#FFB454"; - blue = "#59C2FF"; - magenta = "#FFEE99"; - cyan = "#95E6CB"; - white = "#FFFFFF"; - }; + options.my.alacritty = with lib; { + fontSize = mkOption { + default = 6; + type = types.int; }; }; - home.file."bin/screencap" = { - executable = true; - text = '' - #!/usr/bin/env bash - exec ${depot.nix.pkgs.flameshot}/bin/flameshot gui + config = { + gtk = { + enable = true; + gtk3.extraConfig = { + gtk-application-prefer-dark-theme = 1; + }; + }; + qt = { + enable = true; + platformTheme = "gtk"; + }; + + home.packages = lib.mkAfter (with pkgs; [ + google-chrome-beta + firefox + mpv + dino + lutris + pavucontrol + pngquant + rxvt_unicode + teamspeak_client + virtmanager + xclip + xss-lock + yubioath-desktop + depot.nix.pkgs.flameshot + ]); + + programs.alacritty = { + enable = true; + settings.font = let + iosevka = style: { family = "Iosevka"; inherit style; }; + in { + normal = iosevka "Regular"; + bold = iosevka "Bold"; + italic = iosevka "Italic"; + bold_italic = iosevka "Bold Italic"; + size = config.my.alacritty.fontSize; + }; + settings.colors = { + # Ayu Dark, from https://github.com/alacritty/alacritty/wiki/Color-schemes + primary = { + background = "#0A0E14"; + foreground = "#B3B1AD"; + }; + + # Normal colors + normal = { + black = "#01060E"; + red = "#EA6C73"; + green = "#91B362"; + yellow = "#F9AF4F"; + blue = "#53BDFA"; + magenta = "#FAE994"; + cyan = "#90E1C6"; + white = "#C7C7C7"; + }; + + # Bright colors + bright = { + black = "#686868"; + red = "#F07178"; + green = "#C2D94C"; + yellow = "#FFB454"; + blue = "#59C2FF"; + magenta = "#FFEE99"; + cyan = "#95E6CB"; + white = "#FFFFFF"; + }; + }; + }; + + home.file."bin/screencap" = { + executable = true; + text = '' + #!/usr/bin/env bash + exec ${depot.nix.pkgs.flameshot}/bin/flameshot gui + ''; + }; + home.file.".xprofile".text = '' + . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" + + if [ -e "$HOME/.profile" ]; then + . "$HOME/.profile" + fi + + systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY XDG_DATA_DIRS XDG_RUNTIME_DIR XDG_SESSION_ID + systemctl --user restart ssh-agent ''; }; - home.file.".xprofile".text = '' - . "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh" - - if [ -e "$HOME/.profile" ]; then - . "$HOME/.profile" - fi - - systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY XDG_DATA_DIRS XDG_RUNTIME_DIR XDG_SESSION_ID - systemctl --user restart ssh-agent - ''; - - services.random-background = { - enable = true; - imageDirectory = "${depot.nix.pkgs.lukegb-wallpapers}"; - interval = null; - }; }