diff --git a/home/common/default.nix b/home/common/default.nix index 56fc479..1f1b1eb 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -1,10 +1,9 @@ -_: -{ +_: { imports = [ ./core.nix ./automount.nix ./mime.nix - ./shell + ./shell ./programs ]; } diff --git a/home/common/mime.nix b/home/common/mime.nix index 7c8435f..01563b5 100644 --- a/home/common/mime.nix +++ b/home/common/mime.nix @@ -1,17 +1,16 @@ { ... }: { xdg.mimeApps = { - enable = true; + enable = true; defaultApplications = { - "default-web-browser" = [ "firefox.desktop" ]; - "text/html" = [ "firefox.desktop" ]; - "x-scheme-handler/http" = [ "firefox.desktop" ]; - "x-scheme-handler/https" = [ "firefox.desktop" ]; - "x-scheme-handler/about" = [ "firefox.desktop" ]; - "x-scheme-handler/unknown" = [ "firefox.desktop" ]; - "application/pdf" = [ "org.gnome.Evince.desktop" ]; - "audio/wav" = [ "rhythmbox" ]; + "default-web-browser" = [ "firefox.desktop" ]; + "text/html" = [ "firefox.desktop" ]; + "x-scheme-handler/http" = [ "firefox.desktop" ]; + "x-scheme-handler/https" = [ "firefox.desktop" ]; + "x-scheme-handler/about" = [ "firefox.desktop" ]; + "x-scheme-handler/unknown" = [ "firefox.desktop" ]; + "application/pdf" = [ "org.gnome.Evince.desktop" ]; + "audio/wav" = [ "rhythmbox" ]; }; }; } - diff --git a/home/common/programs/browsers.nix b/home/common/programs/browsers.nix index f817a9d..d6e9197 100644 --- a/home/common/programs/browsers.nix +++ b/home/common/programs/browsers.nix @@ -1,5 +1,4 @@ -_: -{ +_: { programs.chromium.enable = true; programs.firefox.enable = true; } diff --git a/home/common/programs/git.nix b/home/common/programs/git.nix index c758ec6..02676a0 100644 --- a/home/common/programs/git.nix +++ b/home/common/programs/git.nix @@ -1,9 +1,9 @@ -{ ... }: +{ ... }: { programs.git = { enable = true; - userName = "Anthony Rodriguez"; + userName = "Anthony Rodriguez"; userEmail = "anthony@nezia.dev"; signing = { signByDefault = true; diff --git a/home/common/programs/miscellaneous.nix b/home/common/programs/miscellaneous.nix index 29fc7aa..dc8a01b 100644 --- a/home/common/programs/miscellaneous.nix +++ b/home/common/programs/miscellaneous.nix @@ -3,5 +3,13 @@ { programs.fzf.enable = true; programs.fastfetch.enable = true; - home.packages = with pkgs; [ imhex obsidian proton-pass spotify vesktop wl-clipboard stremio ]; + home.packages = with pkgs; [ + imhex + obsidian + proton-pass + spotify + vesktop + wl-clipboard + stremio + ]; } diff --git a/home/common/programs/tmux.nix b/home/common/programs/tmux.nix index f3a54cc..b141ff6 100644 --- a/home/common/programs/tmux.nix +++ b/home/common/programs/tmux.nix @@ -7,7 +7,7 @@ escapeTime = 10; clock24 = true; keyMode = "vi"; - mouse = true; + mouse = true; baseIndex = 1; extraConfig = '' set-option -a terminal-features "''${TERM}:RGB" diff --git a/home/common/shell/default.nix b/home/common/shell/default.nix index da48e07..6d3e127 100644 --- a/home/common/shell/default.nix +++ b/home/common/shell/default.nix @@ -1,10 +1,9 @@ -_: -{ - imports = [ - ./fish.nix +_: { + imports = [ + ./fish.nix ./starship.nix - ./zoxide.nix - ./direnv.nix + ./zoxide.nix + ./direnv.nix ./zellij.nix ]; } diff --git a/home/common/shell/fish.nix b/home/common/shell/fish.nix index 7406f24..4375390 100644 --- a/home/common/shell/fish.nix +++ b/home/common/shell/fish.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, ... }: let catppuccin-fish = pkgs.fetchFromGitHub { @@ -8,7 +8,7 @@ let hash = "sha256-shQxlyoauXJACoZWtRUbRMxmm10R8vOigXwjxBhG8ng="; }; in - { +{ programs.fish = { enable = true; interactiveShellInit = '' @@ -16,9 +16,15 @@ in fish_vi_key_bindings # Enable Vi mode fish_config theme choose "Catppuccin Frappe" ''; - shellAbbrs = { cd = "z"; ngc = "sudo nix-collect-garbage -d"; }; - plugins = [ - { name = "fzf"; src = pkgs.fishPlugins.fzf.src; } + shellAbbrs = { + cd = "z"; + ngc = "sudo nix-collect-garbage -d"; + }; + plugins = [ + { + name = "fzf"; + src = pkgs.fishPlugins.fzf.src; + } ]; }; @@ -35,4 +41,3 @@ in xdg.configFile."fish/themes/Catppuccin Frappe.theme".source = "${catppuccin-fish}/themes/Catppuccin Frappe.theme"; } - diff --git a/home/common/shell/zoxide.nix b/home/common/shell/zoxide.nix index 5637fe5..20db39b 100644 --- a/home/common/shell/zoxide.nix +++ b/home/common/shell/zoxide.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ programs.zoxide = { enable = true; enableBashIntegration = false; diff --git a/home/desktop/default.nix b/home/desktop/default.nix index b286b8b..abc7036 100644 --- a/home/desktop/default.nix +++ b/home/desktop/default.nix @@ -1,5 +1,4 @@ -_: -{ +_: { imports = [ ../common ./gaming diff --git a/home/desktop/gaming/default.nix b/home/desktop/gaming/default.nix index 3d138a8..4d27f15 100644 --- a/home/desktop/gaming/default.nix +++ b/home/desktop/gaming/default.nix @@ -2,8 +2,8 @@ { - home.packages = with pkgs; [ - protonup-qt + home.packages = with pkgs; [ + protonup-qt bottles lutris path-of-building diff --git a/home/laptop/default.nix b/home/laptop/default.nix index ba12cd3..c2f9b5f 100644 --- a/home/laptop/default.nix +++ b/home/laptop/default.nix @@ -1,5 +1,4 @@ -_: -{ +_: { imports = [ ../common ]; diff --git a/hosts/common/default.nix b/hosts/common/default.nix index 96f836a..51668f9 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -1,8 +1,7 @@ -_: -{ +_: { imports = [ - ./system - ./syncthing + ./system + ./syncthing ./sops.nix ]; diff --git a/hosts/common/syncthing/default.nix b/hosts/common/syncthing/default.nix index 8b3fb7b..0556e94 100644 --- a/hosts/common/syncthing/default.nix +++ b/hosts/common/syncthing/default.nix @@ -1,16 +1,22 @@ -{ config, username, hostname, ... }: +{ + config, + username, + hostname, + ... +}: let homeDir = "/home/${username}"; devices = import ./devices.nix; - otherDevices = builtins.removeAttrs devices [hostname]; -in { + otherDevices = builtins.removeAttrs devices [ hostname ]; +in +{ services = { syncthing = { enable = true; user = "${username}"; dataDir = "${homeDir}/Documents"; - configDir = "${homeDir}/.config/syncthing"; # Folder for Syncthing's settings and keys + configDir = "${homeDir}/.config/syncthing"; # Folder for Syncthing's settings and keys key = "${config.sops.secrets."syncthing/${hostname}/key".path}"; cert = "${config.sops.secrets."syncthing/${hostname}/cert".path}"; settings = { diff --git a/hosts/common/syncthing/devices.nix b/hosts/common/syncthing/devices.nix index 9d3fb03..310dc69 100644 --- a/hosts/common/syncthing/devices.nix +++ b/hosts/common/syncthing/devices.nix @@ -1,5 +1,9 @@ # TODO: add to sops directly instead of relying on another nix file { - "vamos" = { id = "UO6JWVU-MTLZGVQ-Z3QAFYH-6PW2QR6-SBOVM6P-S6JXR2S-A7VYAU2-RLRXEQY"; }; - "solaire" = { id = "R5RK7CH-DRFXW4E-ARTPMHN-UMWYQ4O-QK7F3TA-EHVLDK4-DQ6CBT4-XRRWQQM"; }; + "vamos" = { + id = "UO6JWVU-MTLZGVQ-Z3QAFYH-6PW2QR6-SBOVM6P-S6JXR2S-A7VYAU2-RLRXEQY"; + }; + "solaire" = { + id = "R5RK7CH-DRFXW4E-ARTPMHN-UMWYQ4O-QK7F3TA-EHVLDK4-DQ6CBT4-XRRWQQM"; + }; } diff --git a/hosts/common/system/boot.nix b/hosts/common/system/boot.nix index 26825a0..f5cbe7a 100644 --- a/hosts/common/system/boot.nix +++ b/hosts/common/system/boot.nix @@ -14,8 +14,8 @@ plymouth = { enable = true; extraConfig = '' - [Daemon] - DeviceScale=2 + [Daemon] + DeviceScale=2 ''; }; consoleLogLevel = 0; diff --git a/hosts/common/system/core.nix b/hosts/common/system/core.nix index a5f65b5..b397877 100644 --- a/hosts/common/system/core.nix +++ b/hosts/common/system/core.nix @@ -1,7 +1,7 @@ { hostname, ... }: { - networking.hostName = hostname; + networking.hostName = hostname; networking.networkmanager.enable = true; services.xserver.xkb = { @@ -12,7 +12,10 @@ users.users.nezia = { isNormalUser = true; description = "Anthony Rodriguez"; - extraGroups = [ "networkmanager" "wheel" ]; + extraGroups = [ + "networkmanager" + "wheel" + ]; }; # automount @@ -23,7 +26,10 @@ nixpkgs.config.allowUnfree = true; hardware.enableAllFirmware = true; - system.stateVersion = "24.05"; + system.stateVersion = "24.05"; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; } diff --git a/hosts/common/system/default.nix b/hosts/common/system/default.nix index 643e19e..1079104 100644 --- a/hosts/common/system/default.nix +++ b/hosts/common/system/default.nix @@ -1,10 +1,9 @@ -_: -{ +_: { - imports = [ + imports = [ ./core.nix - ./boot.nix - ./locale.nix + ./boot.nix + ./locale.nix ./packages.nix ./printing.nix ./misc.nix diff --git a/hosts/common/system/packages.nix b/hosts/common/system/packages.nix index 25c4f65..8cd50a1 100644 --- a/hosts/common/system/packages.nix +++ b/hosts/common/system/packages.nix @@ -2,7 +2,7 @@ { environment.systemPackages = with pkgs; [ - vim + vim git wget curl diff --git a/hosts/common/system/printing.nix b/hosts/common/system/printing.nix index 82d674c..0b3da41 100644 --- a/hosts/common/system/printing.nix +++ b/hosts/common/system/printing.nix @@ -10,14 +10,20 @@ openFirewall = true; }; - services.printing.drivers = [ pkgs.gutenprint pkgs.hplip ]; + services.printing.drivers = [ + pkgs.gutenprint + pkgs.hplip + ]; hardware.sane.enable = true; # enables support for SANE scanners - hardware.sane.extraBackends = [ - pkgs.sane-airscan # generic - pkgs.hplip # HP - pkgs.epkowa # Epson - pkgs.utsushi # other printers + hardware.sane.extraBackends = [ + pkgs.sane-airscan # generic + pkgs.hplip # HP + pkgs.epkowa # Epson + pkgs.utsushi # other printers + ]; + services.udev.packages = [ + pkgs.sane-airscan + pkgs.utsushi ]; - services.udev.packages = [ pkgs.sane-airscan pkgs.utsushi ]; } diff --git a/hosts/solaire/default.nix b/hosts/solaire/default.nix index 6ea595d..6c0f5d7 100644 --- a/hosts/solaire/default.nix +++ b/hosts/solaire/default.nix @@ -1,8 +1,8 @@ { pkgs, ... }: { - imports = [ - ./hardware-configuration.nix + imports = [ + ./hardware-configuration.nix ]; hardware.uni-sync = { @@ -38,7 +38,7 @@ serviceConfig = { ExecStart = "${pkgs.uni-sync}/bin/uni-sync"; }; - wantedBy = ["multi-user.target"]; + wantedBy = [ "multi-user.target" ]; }; modules.nvidia.enable = true; modules.gaming.enable = true; @@ -46,4 +46,3 @@ stylix.image = ../../wallpapers/lucy-edgerunners-wallpaper.jpg; } - diff --git a/hosts/solaire/hardware-configuration.nix b/hosts/solaire/hardware-configuration.nix index 2ec5f92..c588a5c 100644 --- a/hosts/solaire/hardware-configuration.nix +++ b/hosts/solaire/hardware-configuration.nix @@ -1,28 +1,44 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usb_storage" + "usbhid" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-label/NIXROOT"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-label/NIXROOT"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-label/NIXBOOT"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; swapDevices = [ ]; diff --git a/hosts/vamos/default.nix b/hosts/vamos/default.nix index 5e72a07..d68a1dc 100644 --- a/hosts/vamos/default.nix +++ b/hosts/vamos/default.nix @@ -1,27 +1,25 @@ { inputs, ... }: { - imports = [ - ./hardware-configuration.nix - inputs.nixos-hardware.nixosModules.framework-13-7040-amd - ]; + imports = [ + ./hardware-configuration.nix + inputs.nixos-hardware.nixosModules.framework-13-7040-amd + ]; - services.fprintd.enable = true; - services.power-profiles-daemon.enable = true; - - services.keyd = { - enable = true; - keyboards = { - default = { - ids = [ "*" ]; - settings = { - main = { - capslock = "overload(control, esc)"; - }; - }; - }; - }; - }; - config.modules.neovim.enable = true; + services.fprintd.enable = true; + services.power-profiles-daemon.enable = true; + services.keyd = { + enable = true; + keyboards = { + default = { + ids = [ "*" ]; + settings = { + main = { + capslock = "overload(control, esc)"; + }; + }; + }; + }; + }; + modules.neovim.enable = true; } - diff --git a/hosts/vamos/hardware-configuration.nix b/hosts/vamos/hardware-configuration.nix index eceefba..ab8109a 100644 --- a/hosts/vamos/hardware-configuration.nix +++ b/hosts/vamos/hardware-configuration.nix @@ -1,29 +1,50 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "sd_mod" ]; - boot.initrd.kernelModules = [ "amdgpu" "dm-snapshot" ]; - boot.kernelModules = [ "kvm-amd" "cryptd" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "thunderbolt" + "usb_storage" + "sd_mod" + ]; + boot.initrd.kernelModules = [ + "amdgpu" + "dm-snapshot" + ]; + boot.kernelModules = [ + "kvm-amd" + "cryptd" + ]; boot.initrd.luks.devices."crypt".device = "/dev/disk/by-uuid/39d0e0c6-ea32-4ee4-ac76-b28fbff687f8"; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/4ef04567-9633-45b9-addc-55c3020f45b7"; - fsType = "ext4"; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/4ef04567-9633-45b9-addc-55c3020f45b7"; + fsType = "ext4"; + }; - fileSystems."/boot" = - { device = "/dev/disk/by-uuid/C519-2E55"; - fsType = "vfat"; - options = [ "fmask=0077" "dmask=0077" ]; - }; + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/C519-2E55"; + fsType = "vfat"; + options = [ + "fmask=0077" + "dmask=0077" + ]; + }; swapDevices = [ ]; diff --git a/modules/default.nix b/modules/default.nix index 910cbb6..f3f6215 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,9 +1,8 @@ -_: -{ - imports = [ +_: { + imports = [ ./docker.nix ./pipewire.nix - ./nvidia.nix + ./nvidia.nix ./gnome.nix ./gaming.nix ./wezterm.nix diff --git a/modules/docker.nix b/modules/docker.nix index e591292..28a22e1 100644 --- a/modules/docker.nix +++ b/modules/docker.nix @@ -1,8 +1,13 @@ -{ config, lib, username, ... }: -let +{ + config, + lib, + username, + ... +}: +let cfg = config.modules.docker; in - { +{ options.modules.docker.enable = lib.mkEnableOption "docker module"; config = lib.mkIf cfg.enable { virtualisation.docker = { diff --git a/modules/gaming.nix b/modules/gaming.nix index 2731b2b..cea3f08 100644 --- a/modules/gaming.nix +++ b/modules/gaming.nix @@ -1,8 +1,13 @@ -{ lib, config, pkgs, ... }: -let +{ + lib, + config, + pkgs, + ... +}: +let cfg = config.modules.gaming; in - { +{ options = { modules.gaming = { enable = lib.mkEnableOption "Enable the gaming module"; @@ -30,4 +35,3 @@ in services.udev.packages = [ pkgs.via ]; }; } - diff --git a/modules/gnome.nix b/modules/gnome.nix index 13e3a2c..9f567e7 100644 --- a/modules/gnome.nix +++ b/modules/gnome.nix @@ -1,9 +1,15 @@ -{ config, lib, pkgs, username, ... }: -let +{ + config, + lib, + pkgs, + username, + ... +}: +let cfg = config.modules.gnome; stylixEnabled = config.modules.stylix.enable or false; -in - { +in +{ options = { modules.gnome = { enable = lib.mkEnableOption "Enable Gnome"; @@ -17,17 +23,36 @@ in enable = true; extraGSettingsOverridePackages = [ pkgs.mutter ]; extraGSettingsOverrides = '' - [org.gnome.mutter] - experimental-features=['scale-monitor-framebuffer'] + [org.gnome.mutter] + experimental-features=['scale-monitor-framebuffer'] ''; }; }; - environment.gnome.excludePackages = - (with pkgs; [ gnome-console gnome-photos gnome-tour gnome-software iagno hitori atomix gnome-contacts gnome-initial-setup gnome-music gedit cheese tali epiphany geary yelp ]); + environment.gnome.excludePackages = ( + with pkgs; + [ + gnome-console + gnome-photos + gnome-tour + gnome-software + iagno + hitori + atomix + gnome-contacts + gnome-initial-setup + gnome-music + gedit + cheese + tali + epiphany + geary + yelp + ] + ); - environment.systemPackages = with pkgs; [ - gnome-tweaks + environment.systemPackages = with pkgs; [ + gnome-tweaks gnome-power-manager rhythmbox ]; @@ -67,12 +92,31 @@ in enable-hot-corners = false; }; "org/gnome/desktop/search-providers" = { - disabled=["org.gnome.Terminal.desktop" "org.gnome.Software.desktop" "org.gnome.seahorse.Application.desktop" "org.gnome.clocks.desktop" "org.gnome.Characters.desktop" "org.gnome.Calendar.desktop" "org.gnome.Calculator.desktop"]; + disabled = [ + "org.gnome.Terminal.desktop" + "org.gnome.Software.desktop" + "org.gnome.seahorse.Application.desktop" + "org.gnome.clocks.desktop" + "org.gnome.Characters.desktop" + "org.gnome.Calendar.desktop" + "org.gnome.Calculator.desktop" + ]; - enabled = ["org.gnome.Nautilus.desktop" "org.gnome.Settings.desktop"]; + enabled = [ + "org.gnome.Nautilus.desktop" + "org.gnome.Settings.desktop" + ]; }; "org/freedesktop/tracker/mine/files" = { - index-recursive-directories=["&DESKTOP" "&DOCUMENTS" "&MUSIC" "&PICTURES" "&VIDEOS" "/home/${username}/Notes" "/home/${username}/Projects"]; + index-recursive-directories = [ + "&DESKTOP" + "&DOCUMENTS" + "&MUSIC" + "&PICTURES" + "&VIDEOS" + "/home/${username}/Notes" + "/home/${username}/Projects" + ]; }; }; diff --git a/modules/nvidia.nix b/modules/nvidia.nix index f905563..80a09a6 100644 --- a/modules/nvidia.nix +++ b/modules/nvidia.nix @@ -1,15 +1,15 @@ { config, lib, ... }: -let +let cfg = config.modules.nvidia; -in - { +in +{ options = { modules.nvidia = { enable = lib.mkEnableOption "Enable the Nvidia module"; }; }; config = lib.mkIf cfg.enable { - services.xserver.videoDrivers = ["nvidia"]; + services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { # Modesetting is required. diff --git a/modules/pipewire.nix b/modules/pipewire.nix index e319ffa..a9117e6 100644 --- a/modules/pipewire.nix +++ b/modules/pipewire.nix @@ -1,9 +1,9 @@ { config, lib, ... }: -let +let cfg = config.modules.pipewire; -in - { +in +{ options.modules.pipewire.enable = lib.mkEnableOption "pipewire module"; options.modules.pipewire.latencyFix.enable = lib.mkEnableOption "enable latency fixes"; config = lib.mkIf cfg.enable { @@ -21,10 +21,10 @@ in services.pipewire.extraConfig.pipewire."92-low-latency" = lib.mkIf cfg.latencyFix.enable { "context.properties" = { - "default.clock.rate" = 48000; + "default.clock.rate" = 48000; "default.clock.allowed-rates" = [ 48000 ]; "default.clock.quantum" = 2048; - "default.clock.min-quantum" = 1024; + "default.clock.min-quantum" = 1024; }; }; diff --git a/modules/stylix.nix b/modules/stylix.nix index b335eb7..769bc45 100644 --- a/modules/stylix.nix +++ b/modules/stylix.nix @@ -1,8 +1,13 @@ -{ config, lib, pkgs, ... }: -let +{ + config, + lib, + pkgs, + ... +}: +let cfg = config.modules.stylix; -in - { +in +{ options = { modules.stylix = { enable = lib.mkEnableOption "Enable the stylix module"; diff --git a/modules/wezterm.nix b/modules/wezterm.nix index c7c564f..aff019d 100644 --- a/modules/wezterm.nix +++ b/modules/wezterm.nix @@ -1,6 +1,12 @@ -{ config, lib, inputs, username, ... }: -let -cfg = config.modules.wezterm; +{ + config, + lib, + inputs, + username, + ... +}: +let + cfg = config.modules.wezterm; in { options = { @@ -14,69 +20,69 @@ in enable = true; # package = inputs.wezterm.packages.${pkgs.system}.default; extraConfig = '' - local w = require('wezterm') + local w = require('wezterm') - local function is_vim(pane) - return pane:get_user_vars().IS_NVIM == 'true' + local function is_vim(pane) + return pane:get_user_vars().IS_NVIM == 'true' + end + + local direction_keys = { + h = 'Left', + j = 'Down', + k = 'Up', + l = 'Right', + } + + local function split_nav(resize_or_move, key) + return { + key = key, + mods = resize_or_move == 'resize' and 'META' or 'CTRL', + action = w.action_callback(function(win, pane) + if is_vim(pane) then + win:perform_action({ + SendKey = { key = key, mods = resize_or_move == 'resize' and 'META' or 'CTRL' }, + }, pane) + else + if resize_or_move == 'resize' then + win:perform_action({ AdjustPaneSize = { direction_keys[key], 3 } }, pane) + else + win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane) + end + end + end), + } end - local direction_keys = { - h = 'Left', - j = 'Down', - k = 'Up', - l = 'Right', - } + return { + enable_wayland = false, + front_end = "WebGpu", + hide_tab_bar_if_only_one_tab = true, + show_new_tab_button_in_tab_bar = false, + harfbuzz_features = { "ss01", "ss03" }, - local function split_nav(resize_or_move, key) - return { - key = key, - mods = resize_or_move == 'resize' and 'META' or 'CTRL', - action = w.action_callback(function(win, pane) - if is_vim(pane) then - win:perform_action({ - SendKey = { key = key, mods = resize_or_move == 'resize' and 'META' or 'CTRL' }, - }, pane) - else - if resize_or_move == 'resize' then - win:perform_action({ AdjustPaneSize = { direction_keys[key], 3 } }, pane) - else - win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane) - end - end - end), - } - end + leader = { key = " ", mods = "CTRL", timeout_milliseconds = 1000 }, - return { - enable_wayland = false, - front_end = "WebGpu", - hide_tab_bar_if_only_one_tab = true, - show_new_tab_button_in_tab_bar = false, - harfbuzz_features = { "ss01", "ss03" }, - - leader = { key = " ", mods = "CTRL", timeout_milliseconds = 1000 }, - - keys = { - { - mods = "LEADER", - key = "-", - action = wezterm.action.SplitVertical { domain = "CurrentPaneDomain" } + keys = { + { + mods = "LEADER", + key = "-", + action = wezterm.action.SplitVertical { domain = "CurrentPaneDomain" } + }, + { + mods = "LEADER", + key = "=", + action = wezterm.action.SplitHorizontal { domain = "CurrentPaneDomain" } + }, + split_nav('move', 'h'), + split_nav('move', 'j'), + split_nav('move', 'k'), + split_nav('move', 'l'), + split_nav('resize', 'h'), + split_nav('resize', 'j'), + split_nav('resize', 'k'), + split_nav('resize', 'l'), }, - { - mods = "LEADER", - key = "=", - action = wezterm.action.SplitHorizontal { domain = "CurrentPaneDomain" } - }, - split_nav('move', 'h'), - split_nav('move', 'j'), - split_nav('move', 'k'), - split_nav('move', 'l'), - split_nav('resize', 'h'), - split_nav('resize', 'j'), - split_nav('resize', 'k'), - split_nav('resize', 'l'), - }, - } + } ''; }; };