My Nix Configuration
1{ 2 pkgs, 3 config, 4 lib, 5 ... 6}: 7let 8 term = config.wayland.windowManager.sway.config.terminal; 9 homeDir = config.home.homeDirectory; 10 cfg = config.py.gui; 11in 12{ 13 options.py.gui = { 14 enable = lib.mkEnableOption "GUI Configuration"; 15 }; 16 config = lib.mkIf cfg.enable { 17 catppuccin = { 18 sway.enable = true; 19 }; 20 home.sessionVariables = { 21 XDG_CURRENT_DESKTOP = "sway"; 22 }; 23 wayland.windowManager.sway = { 24 enable = lib.mkDefault true; 25 package = null; 26 # nix-community/home-manager/issues/5311 27 checkConfig = false; 28 wrapperFeatures.base = true; 29 wrapperFeatures.gtk = true; 30 extraConfig = '' 31 default_border pixel 32 focus_on_window_activation smart 33 ''; 34 systemd = { 35 enable = true; 36 xdgAutostart = true; 37 }; 38 config = { 39 terminal = lib.getExe pkgs.ghostty; 40 menu = "exec ${lib.getExe pkgs.onagre}"; 41 modifier = "Mod4"; 42 bars = [ { command = "true"; } ]; 43 focus = { 44 followMouse = true; 45 mouseWarping = true; 46 newWindow = "smart"; 47 }; 48 fonts = { 49 names = [ "Inter" ]; 50 style = "Regular"; 51 size = 12.0; 52 }; 53 gaps = { 54 inner = 1; 55 outer = 1; 56 smartBorders = "on"; 57 smartGaps = false; 58 }; 59 input = { 60 "type:keyboard" = { 61 xkb_options = "caps:escape"; 62 }; 63 "type:mouse" = { 64 accel_profile = "flat"; 65 }; 66 "type:touchpad" = { 67 accel_profile = "adaptive"; 68 scroll_factor = "1.5"; 69 tap = "enabled"; 70 }; 71 }; 72 modes = { 73 resize = { 74 Escape = "mode default"; 75 Return = "mode default"; 76 Up = "resize shrink height 10 px"; 77 Down = "resize grow height 10 px"; 78 Left = "resize shrink width 10 px"; 79 Right = "resize grow width 10 px"; 80 h = "resize shrink width 10 px"; 81 j = "resize grow height 10 px"; 82 k = "resize shrink height 10 px"; 83 l = "resize grow width 10 px"; 84 }; 85 }; 86 output = { 87 eDP-1 = { 88 scale = "1.2"; 89 }; 90 }; 91 startup = [ 92 { command = "${pkgs.dex}/bin/dex -a"; } 93 { command = "${homeDir}/scripts/unfuck-xdg-portals.fish"; } 94 { command = "wl-paste -t text --watch clipman store --no-persist"; } 95 ]; 96 window = { 97 commands = [ 98 { 99 command = "inhibit_idle fullscreen"; 100 criteria = { 101 class = "Chromium|zoom|Firefox"; 102 }; 103 } 104 { 105 command = "floating enable, sticky enable, resize set 20 ppt 40 ppt, border pixel 4"; 106 criteria = { 107 app_id = "^py.floating$"; 108 }; 109 } 110 { 111 command = "resize set 20 ppt"; 112 criteria = { 113 title = "Mumble PTT"; 114 }; 115 } 116 ]; 117 }; 118 colors = { 119 background = "$base"; 120 focused = { 121 border = "$pink"; 122 background = "$base"; 123 text = "$text"; 124 indicator = "$rosewater"; 125 childBorder = "$pink"; 126 }; 127 focusedInactive = { 128 border = "$mauve"; 129 background = "$base"; 130 text = "$text"; 131 indicator = "$rosewater"; 132 childBorder = "$mauve"; 133 }; 134 unfocused = { 135 border = "$mauve"; 136 background = "$base"; 137 text = "$text"; 138 indicator = "$rosewater"; 139 childBorder = "$mauve"; 140 }; 141 urgent = { 142 border = "$peach"; 143 background = "$base"; 144 text = "$peach"; 145 indicator = "$overlay0"; 146 childBorder = "$peach"; 147 }; 148 placeholder = { 149 border = "$overlay0"; 150 background = "$base"; 151 text = "$text"; 152 indicator = "$overlay0"; 153 childBorder = "$overlay0"; 154 }; 155 }; 156 }; 157 }; 158 }; 159}