diff --git a/config/nix/Makefile b/config/nix/Makefile index 586b054b..72f9cd81 100644 --- a/config/nix/Makefile +++ b/config/nix/Makefile @@ -1,11 +1,9 @@ -.PHONY: run build genzai +.PHONY: darwin build default default: build +darwin: + nix run nix-darwin -- switch --flake ~/.local/share/dotfiles/config/nix -switch: +home: nix run home-manager/master -- switch --flake ~/.local/share/dotfiles/config/nix -build: - nix run home-manager/master -- build --flake ~/.local/share/dotfiles/config/nix -genzai: - nix build .#homeConfigurations.genzai diff --git a/config/nix/darwin.nix b/config/nix/darwin.nix index 20cb6ce8..39c621e5 100644 --- a/config/nix/darwin.nix +++ b/config/nix/darwin.nix @@ -1,10 +1,38 @@ -{pkgs, ...}: { +{ + pkgs, + device, + ... +}: { + imports = [ + ./yabai.nix + ./skhd.nix + ]; + + environment.systemPackages = with pkgs; [ + nix + neovim + ]; nix = { settings = { experimental-features = "nix-command flakes repl-flake"; max-jobs = 8; + trusted-users = ["root" "fs0c131y"]; }; + extraOptions = '' + build-users-group = nixbld + extra-nix-path = nixpkgs=flake:nixpkgs + ''; + package = pkgs.nix; }; + + programs.bash.enable = true; + programs.zsh.enable = true; + programs.fish.enable = true; + + nixpkgs.hostPlatform = device.system; + services.nix-daemon.enable = true; + system.stateVersion = 4; + system.keyboard.enableKeyMapping = true; system.keyboard.remapCapsLockToControl = true; system.keyboard.swapLeftCommandAndLeftAlt = true; diff --git a/config/nix/flake.nix b/config/nix/flake.nix index 3e949c6f..f05c3e27 100644 --- a/config/nix/flake.nix +++ b/config/nix/flake.nix @@ -16,118 +16,89 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { - nixpkgs, - home-manager, - nix-darwin, - flake-utils, - ... - } @ inputs: let - devices = [ - { - name = "mirai"; - system = "x86_64-linux"; - user = "fs0c131y"; - } - { - name = "genzai"; - system = "x86_64-linux"; - user = "fs0c131y"; - } - { - name = "Uttarayans-MacBook-Pro"; - system = "aarch64-darwin"; - user = "fs0c131y"; - } - { - name = "SteamDeck"; - system = "x86_64-linux"; - user = "deck"; - } - ]; - linux = builtins.filter (x: x.system == "x86_64-linux") devices; - darwin = builtins.filter (x: x.system == "aarch64-darwin") devices; - in { - homeConfigurations = builtins.listToAttrs (builtins.map (device: { - name = device.user; - value = let - pkgs = nixpkgs.legacyPackages.${device.system}; - overlays = [inputs.neovim-nightly-overlay.overlay]; - in - home-manager.lib.homeManagerConfiguration { - inherit pkgs; - modules = [ - ./home.nix - { - nixpkgs.overlays = overlays; - } - ]; - }; - }) - linux); + outputs = + { nixpkgs + , home-manager + , nix-darwin + , flake-utils + , ... + } @ inputs: + let + devices = [ + { + name = "mirai"; + system = "x86_64-linux"; + user = "fs0c131y"; + } + { + name = "genzai"; + system = "x86_64-linux"; + user = "fs0c131y"; + } + { + name = "Uttarayans-MacBook-Pro"; + system = "aarch64-darwin"; + user = "fs0c131y"; + } + { + name = "SteamDeck"; + system = "x86_64-linux"; + user = "deck"; + } + ]; + linux = builtins.filter (x: x.system == "x86_64-linux") devices; + darwin = builtins.filter (x: x.system == "aarch64-darwin") devices; + in + { + homeConfigurations = builtins.listToAttrs (builtins.map + (device: { + name = device.user; + value = + let + pkgs = nixpkgs.legacyPackages.${device.system}; + overlays = [ inputs.neovim-nightly-overlay.overlay ]; + in + home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ + ./home.nix + { + nixpkgs.overlays = overlays; + } + ]; + }; + }) + linux); - darwinConfigurations = builtins.listToAttrs (builtins.map (device: { - name = device.name; - value = let - pkgs = nixpkgs.legacyPackages.${device.system}; - in { - "Uttarayans-MacBook-Pro" = nix-darwin.lib.darwinSystem { - modules = [ - home-manager.darwinModules.home-manager - ./darwin.nix - ({config, ...}: { - home-manager = { - users = { - fs0c131y = { - home = "/Users/${device.user}"; - stateVersion = "21.05"; - configuration = home-manager.configurations.fs0c131y; - }; - }; + darwinConfigurations = + builtins.listToAttrs + (builtins.map + (device: { + name = device.name; + value = + let + pkgs = nixpkgs.legacyPackages.${device.system}; + overlays = [ inputs.neovim-nightly-overlay.overlay ]; + in + nix-darwin.lib.darwinSystem { + inherit pkgs; + modules = [ + ./darwin.nix + home-manager.darwinModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit device; + inherit overlays; + }; + users.${device.user}.imports = [ ./home.nix ]; + }; + } + ]; }; - }) - ]; - }; - }; - }) - darwin); - }; + }) + darwin); + }; } -# "fs0c131y" = let -# system = "x86_64-linux"; -# overlays = [inputs.neovim-nightly-overlay.overlay]; -# pkgs = nixpkgs.legacyPackages.${system}; -# in -# home-manager.lib.homeManagerConfiguration -# { -# inherit pkgs; -# modules = [ -# ./home.nix -# { -# nixpkgs.overlays = overlays; -# } -# ]; -# }; -# darwinConfigurations = let -# system = "aarch64-darwin"; -# pkgs = nixpkgs.legacyPackages.${system}; -# in { -# "Uttarayans-MacBook-Pro" = darwin.lib.darwinSystem { -# modules = [ -# home-manager.darwinModules.home-manager -# ./darwin.nix -# ({config, ...}: { -# home-manager = { -# users = { -# fs0c131y = { -# home = "/Users/fs0c131y"; -# stateVersion = "21.05"; -# configuration = home-manager.configurations.fs0c131y; -# }; -# }; -# }; -# }) -# ]; -# }; -# }; - diff --git a/config/nix/home.nix b/config/nix/home.nix index 8addd756..d7c4f401 100644 --- a/config/nix/home.nix +++ b/config/nix/home.nix @@ -1,179 +1,193 @@ -{ - config, - pkgs, - ... -}: let +{ config +, pkgs +, lib +, device +, overlays +, ... + +}: +let start-tmux = (import ./scripts/start-tmux.nix) pkgs; in - # https://mipmip.github.io/home-manager-option-search/ - { - imports = [ - # Include the results of the hardware scan. - ./tmux.nix - ./wezterm.nix - ./hyprland.nix +# https://mipmip.github.io/home-manager-option-search/ +{ + nixpkgs.overlays = [ + (self: super: { + neovim-nightly = overlays.neovim-nightly; + }) + ]; + imports = [ + # Include the results of the hardware scan. + ./tmux.nix + ./wezterm.nix + ./hyprland.nix + ]; + + programs = { + fish = { + enable = true; + shellAbbrs = { + vim = "nvim"; + vi = "nvim"; + nv = "nvim"; + g = "git"; + cd = "z"; + ls = "exa"; + t = "${start-tmux}"; + }; + interactiveShellInit = '' + set fish_greeting + ${pkgs.macchina.outPath}/bin/macchina + ''; + }; + + nushell = { + enable = true; + shellAliases = { + "cd" = "z"; + }; + package = pkgs.nushellFull; + configFile.text = '' + $env.config = { + show_banner: false, + } + ''; + }; + zoxide = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + }; + starship = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + }; + eza = { + enable = true; + enableAliases = true; + git = true; + icons = true; + }; + carapace = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + }; + fzf = { + enable = true; + package = pkgs.fzf; + enableFishIntegration = true; + tmux.enableShellIntegration = true; + }; + keychain = { + enable = true; + # keys = [ "id_ed25519" ]; + enableFishIntegration = true; + enableNushellIntegration = true; + }; + yazi = { + enable = true; + enableFishIntegration = true; + enableNushellIntegration = true; + }; + foot = { + enable = pkgs.stdenv.isLinux; + server.enable = true; + settings = { + main = { + shell = "${pkgs.fish.outPath}/bin/fish"; + font = "Hasklug Nerd Font Mono:size=13"; + initial-window-size-pixels = "1440x800"; + }; + colors = { + foreground = "f8f8f2"; + background = 000000; + alpha = 0.8; + + "136" = "af8700"; + + regular0 = "21222c"; + regular1 = "ff5555"; + regular2 = "50fa7b"; + regular3 = "f1fa8c"; + regular4 = "bd93f9"; + regular5 = "ff79c6"; + regular6 = "8be9fd"; + regular7 = "f8f8f2"; + + bright0 = "6272a4"; + bright1 = "ff6e6e"; + bright2 = "69ff94"; + bright3 = "ffffa5"; + bright4 = "d6acff"; + bright5 = "ff92df"; + bright6 = "a4ffff"; + bright7 = "ffffff"; + }; + }; + }; + + # Let Home Manager install and manage itself. + home-manager = { + enable = true; + }; + }; + + home = { + # Home Manager needs a bit of information about you and the paths it should + # manage. + username = device.user; + homeDirectory = + if device.system == "x86-64-linux" then + lib.mkForce "/home/${device.user}" + else + lib.mkForce "/Users/${device.user}"; + + + stateVersion = "23.11"; + + packages = [ + pkgs.macchina + pkgs.alejandra + # pkgs.neovim-nightly + pkgs.cachix + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') ]; - programs = { - fish = { - enable = true; - shellAbbrs = { - vim = "nvim"; - vi = "nvim"; - nv = "nvim"; - g = "git"; - cd = "z"; - ls = "exa"; - t = "${start-tmux}"; - }; - interactiveShellInit = '' - set fish_greeting - ${pkgs.macchina.outPath}/bin/macchina - ''; - }; + file = { + ".config/tmux/sessions".source = ../tmux/sessions; + ".config/nvim".source = ../nvim; - nushell = { - enable = true; - shellAliases = { - "cd" = "z"; - }; - package = pkgs.nushellFull; - configFile.text = '' - $env.config = { - show_banner: false, - } - ''; - }; - zoxide = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = true; - }; - starship = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = true; - }; - eza = { - enable = true; - enableAliases = true; - git = true; - icons = true; - }; - carapace = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = true; - }; - fzf = { - enable = true; - package = pkgs.fzf; - enableFishIntegration = true; - tmux.enableShellIntegration = true; - }; - keychain = { - enable = true; - keys = ["id_ed25519"]; - enableFishIntegration = true; - enableNushellIntegration = true; - }; - yazi = { - enable = true; - enableFishIntegration = true; - enableNushellIntegration = true; - }; - foot = { - enable = pkgs.stdenv.isLinux; - server.enable = true; - settings = { - main = { - shell = "${pkgs.fish.outPath}/bin/fish"; - font = "Hasklug Nerd Font Mono:size=13"; - initial-window-size-pixels = "1440x800"; - }; - colors = { - foreground = "f8f8f2"; - background = 000000; - alpha = 0.8; - - "136" = "af8700"; - - regular0 = "21222c"; - regular1 = "ff5555"; - regular2 = "50fa7b"; - regular3 = "f1fa8c"; - regular4 = "bd93f9"; - regular5 = "ff79c6"; - regular6 = "8be9fd"; - regular7 = "f8f8f2"; - - bright0 = "6272a4"; - bright1 = "ff6e6e"; - bright2 = "69ff94"; - bright3 = "ffffa5"; - bright4 = "d6acff"; - bright5 = "ff92df"; - bright6 = "a4ffff"; - bright7 = "ffffff"; - }; - }; - }; - - # Let Home Manager install and manage itself. - home-manager = { - enable = true; - }; + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; }; - home = { - # Home Manager needs a bit of information about you and the paths it should - # manage. - username = "fs0c131y"; - homeDirectory = "/home/fs0c131y"; - - stateVersion = "23.11"; - - packages = [ - pkgs.macchina - pkgs.alejandra - pkgs.neovim-nightly - pkgs.cachix - # # Adds the 'hello' command to your environment. It prints a friendly - # # "Hello, world!" when run. - # pkgs.hello - - # # It is sometimes useful to fine-tune packages, for example, by applying - # # overrides. You can do that directly here, just don't forget the - # # parentheses. Maybe you want to install Nerd Fonts with a limited number of - # # fonts? - # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) - - # # You can also create simple shell scripts directly inside your - # # configuration. For example, this adds a command 'my-hello' to your - # # environment: - # (pkgs.writeShellScriptBin "my-hello" '' - # echo "Hello, ${config.home.username}!" - # '') - ]; - - file = { - ".config/tmux/sessions".source = ../tmux/sessions; - ".config/nvim".source = ../nvim; - - # # You can also set the file content immediately. - # ".gradle/gradle.properties".text = '' - # org.gradle.console=verbose - # org.gradle.daemon.idletimeout=3600000 - # ''; - }; - - sessionVariables = { - EDITOR = "nvim"; - SHELL = "${pkgs.fish.outPath}/bin/fish"; - }; - sessionPath = [ - "${config.home.homeDirectory}/.local/bin" - "${config.home.homeDirectory}/.nix-profile/bin" - ]; + sessionVariables = { + EDITOR = "nvim"; + SHELL = "${pkgs.fish.outPath}/bin/fish"; }; - } + sessionPath = [ + "${config.home.homeDirectory}/.local/bin" + "${config.home.homeDirectory}/.nix-profile/bin" + ]; + }; +} diff --git a/config/nix/nix.conf b/config/nix/nix.conf index 4acf5539..55a2da16 100644 --- a/config/nix/nix.conf +++ b/config/nix/nix.conf @@ -1,2 +1,9 @@ -substituters = https://cache.nixos.org https://nix-community.cachix.org -trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= +# Generated by https://github.com/DeterminateSystems/nix-installer. +# See `/nix/nix-installer --version` for the version details. + +build-users-group = nixbld +experimental-features = nix-command flakes repl-flake +bash-prompt-prefix = (nix:$name)\040 +max-jobs = auto +extra-nix-path = nixpkgs=flake:nixpkgs +upgrade-nix-store-path-url = https://install.determinate.systems/nix-upgrade/stable/universal diff --git a/config/nix/scripts/start-tmux.nix b/config/nix/scripts/start-tmux.nix index abca617a..89a0465d 100644 --- a/config/nix/scripts/start-tmux.nix +++ b/config/nix/scripts/start-tmux.nix @@ -1,48 +1,49 @@ -{ - pkgs, - ... +{ pkgs +, ... }: pkgs.writeShellScript "start-tmux" '' - live_sessions=$(${pkgs.tmux}/bin/tmux list-sessions 2>/dev/null) - all_sessions=$(${pkgs.findutils}/bin/find -L ~/.config/tmux/sessions -type f -executable -printf '%f\n'| sort) - TMUX_SESSIONS="$HOME/.config/tmux/sessions" - # for some reason ~/.config/tmux/session doesn't work if made with quotes - # TMUX_SESSIONS=$XDG_CONFIG_HOME/tmux/sessions - if ! [ -z "$TMUX" ];then - echo "Nested tmux sessions are a bad idea?" - echo "If you want to really do this unset TMUX environment variable" - exit 1 - fi - IFS=$'\n' - for live_session in $live_sessions;do - live_session_name=$(echo $live_session | ${pkgs.coreutils}/bin/cut -d: -f1) - if [ -z "''\${all_sessions##*$live_session_name*}" ];then # see https://stackoverflow.com/questions/229551/how-to-check-if-a-string-contains-a-substring-in-bash - all_sessions="$(echo "$all_sessions" | sed "s/$live_session_name/$live_session/g")" - else - all_sessions=$(echo -e "$all_sessions\n$live_session") - # Okay I know this is ugly it is 5:13 my brain is not working - fi - session=$(echo "''\$all_sessions" | fzf) - session_name=$(echo $session | cut -d: -f1) - if [ -z "$session" ];then - exit 0 - fi - if ! [ -z "''\${session##*created*}" ];then - if [ -x "$TMUX_SESSIONS/$session_name" ];then - source $TMUX_SESSIONS/$session_name - else - echo $TMUX_SESSIONS/$session_name not found or is not executable - exit 1 - fi - fi - if [ -z "''\${session##*attached*}" ];then - read -r -p "The session is already attached somewhere else. Attach it here too ? (y/N): " choice - if [ "$choice" == "y" ] || [ "$choice" == "Y" ];then - tmux attach-session -t$session_name - fi - else - tmux attach-session -t$session_name - fi - done + live_sessions=$(${pkgs.tmux}/bin/tmux list-sessions 2>/dev/null) + all_sessions=$(${pkgs.findutils}/bin/find -L ~/.config/tmux/sessions -type f -executable -printf '%f\n'| sort) + TMUX_SESSIONS="$HOME/.config/tmux/sessions" + # for some reason ~/.config/tmux/session doesn't work if made with quotes + # TMUX_SESSIONS=$XDG_CONFIG_HOME/tmux/sessions + if ! [ -z "$TMUX" ];then + echo "Nested tmux sessions are a bad idea?" + echo "If you want to really do this unset TMUX environment variable" + exit 1 + fi + IFS=$'\n' + for live_session in $live_sessions; + do + live_session_name=$(echo $live_session | ${pkgs.coreutils}/bin/cut -d: -f1) + if [ -z "''\${all_sessions##*$live_session_name*}" ];then # see https://stackoverflow.com/questions/229551/how-to-check-if-a-string-contains-a-substring-in-bash + all_sessions="$(echo "$all_sessions" | sed "s/$live_session_name/$live_session/g")" + else + all_sessions="$(echo -e "$all_sessions\n$live_session")" + fi + done + session=$(echo "''\$all_sessions" | ${pkgs.fzf}/bin/fzf) + session_name=$(echo $session | cut -d: -f1) + if [ -z "$session" ];then + exit 0 + fi + if ! [ -z "''\${session##*created*}" ];then + if [ -x "$TMUX_SESSIONS/$session_name" ];then + source $TMUX_SESSIONS/$session_name + else + echo $TMUX_SESSIONS/$session_name not found or is not executable + exit 1 + fi + fi + if [ -z "''\${session##*attached*}" ];then + read -r -p "The session is already attached somewhere else. Attach it here too ? (y/N): " choice + if [ "$choice" == "y" ] || [ "$choice" == "Y" ];then + ${pkgs.tmux}/bin/tmux attach-session -t$session_name + fi + else + ${pkgs.tmux}/bin/tmux attach-session -t$session_name + fi '' + + diff --git a/config/nix/skhd.nix b/config/nix/skhd.nix new file mode 100644 index 00000000..4024cf35 --- /dev/null +++ b/config/nix/skhd.nix @@ -0,0 +1,77 @@ +{...}: { + services = { + skhd = { + enable = true; + skhdConfig = '' + # open terminal, blazingly fast compared to iTerm/Hyper + # alt - return : /Applications/kitty.app/Contents/MacOS/kitty --single-instance -d ~ + alt - return : /Applications/WezTerm.app/Contents/MacOS/wezterm + shift + alt - return: pkill mpv + # alt + \ : pkill mpv + + # open qutebrowser + # alt + shift - return : ~/Scripts/qtb.sh + + # open mpv + alt - m : open -na /Applications/mpv.app $(pbpaste) + + # close focused window + # alt - w : yabai -m window --close + + alt - d : open -na "$(ls /Applications /System/Applications/ /System/Applications/Utilities/ | choose)" + + # focus window + alt - h : yabai -m window --focus west + alt - j : yabai -m window --focus south + alt - k : yabai -m window --focus north + alt - l : yabai -m window --focus east + + # alt - j : yabai -m window --focus prev + # alt - k : yabai -m window --focus next + + # Float + shift + alt - f: yabai -m window --toggle float + alt - f: yabai -m window --toggle native-fullscreen + + # swap window + # shift + alt - h : yabai -m window --swap west + # shift + alt - j : yabai -m window --swap south + # shift + alt - k : yabai -m window --swap north + # shift + alt - l : yabai -m window --swap east + + # move window + shift + alt - h : yabai -m window --warp west + shift + alt - j : yabai -m window --warp south + shift + alt - k : yabai -m window --warp north + shift + alt - l : yabai -m window --warp east + + # restart skhd + shift + alt - r : pkill skhd + + # fast focus desktop + alt - 1 : yabai -m space --focus 1 + alt - 2 : yabai -m space --focus 2 + alt - 3 : yabai -m space --focus 3 + alt - 4 : yabai -m space --focus 4 + alt - 5 : yabai -m space --focus 5 + alt - 6 : yabai -m space --focus 6 + alt - 7 : yabai -m space --focus 7 + alt - 8 : yabai -m space --focus 8 + alt - 9 : yabai -m space --focus 9 + alt - 0 : yabai -m space --focus 10 + + # Move window to desktop + shift + alt - 1 : yabai -m window --space 1 + shift + alt - 2 : yabai -m window --space 2 + shift + alt - 3 : yabai -m window --space 3 + shift + alt - 4 : yabai -m window --space 4 + shift + alt - 5 : yabai -m window --space 5 + shift + alt - 6 : yabai -m window --space 6 + shift + alt - 7 : yabai -m window --space 7 + shift + alt - 8 : yabai -m window --space 8 + shift + alt - 9 : yabai -m window --space 9 + shift + alt - 0 : yabai -m window --space 10 + ''; + }; + }; +} diff --git a/config/nix/tmux.nix b/config/nix/tmux.nix index 3a6dae13..372bc351 100644 --- a/config/nix/tmux.nix +++ b/config/nix/tmux.nix @@ -1,26 +1,28 @@ -{pkgs, ...}: let +{ pkgs, ... }: +let tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin - { - pluginName = "tmux-super-fingers"; - version = "v1-2024-02-14"; - src = pkgs.fetchFromGitHub { - owner = "artemave"; - repo = "tmux_super_fingers"; - rev = "518044ef78efa1cf3c64f2e693fef569ae570ddd"; - sha256 = "sha256-iKfx9Ytk2vSuINvQTB6Kww8Vv7i51cFEnEBHLje+IJw="; + { + pluginName = "tmux-super-fingers"; + version = "v1-2024-02-14"; + src = pkgs.fetchFromGitHub { + owner = "artemave"; + repo = "tmux_super_fingers"; + rev = "518044ef78efa1cf3c64f2e693fef569ae570ddd"; + sha256 = "sha256-iKfx9Ytk2vSuINvQTB6Kww8Vv7i51cFEnEBHLje+IJw="; + }; }; - }; scratchpad = pkgs.writeShellScript "scratchpad" '' - width=''\${2:-95%} - height=''\${2:-95%} - if [ "$(tmux display-message -p -F "#{session_name}")" = "scratch" ];then - tmux detach-client - else - tmux popup -d '#{pane_current_path}' -xC -yC -w$width -h$height -E "tmux attach -t scratch || tmux new -s scratch" - fi - ''; -in { + width=''\${2:-95%} + height=''\${2:-95%} + if [ "$(tmux display-message -p -F "#{session_name}")" = "scratch" ];then + tmux detach-client + else + tmux popup -d '#{pane_current_path}' -xC -yC -w$width -h$height -E "tmux attach -t scratch || tmux new -s scratch" + fi + ''; +in +{ programs.tmux = { enable = true; shell = "${pkgs.nushellFull}/bin/nu"; @@ -38,15 +40,12 @@ in { plugin = tmuxPlugins.catppuccin; extraConfig = '' set -g @catppuccin_flavour 'mocha' - set -g @catppuccin_window_tabs_enabled on - set -g @catppuccin_status_modules_right "" - set -g @catppuccin_status_modules_right "battery application session date_time" ''; } { plugin = tmuxPlugins.battery; extraConfig = '' - set -g @catppuccin_status_modules_right "application session user host date_time" + set -g @catppuccin_status_modules_right "battery application session date_time" ''; } ]; diff --git a/config/nix/yabai.nix b/config/nix/yabai.nix new file mode 100644 index 00000000..7e2e9bc9 --- /dev/null +++ b/config/nix/yabai.nix @@ -0,0 +1,44 @@ +{...}: { + services = { + yabai = { + enable = true; + enableScriptingAddition = true; + config = { + mouse_follows_focus = "on"; + focus_follows_mouse = "on"; + window_origin_display = "default"; + window_placement = "second_child"; + window_topmost = "off"; + window_shadow = "on"; + window_opacity = "off"; + window_opacity_duration = "0.0"; + active_window_opacity = "1.0"; + normal_window_opacity = "0.90"; + window_border = "off"; + window_border_width = "6"; + active_window_border_color = "0xff775759"; + normal_window_border_color = "0xff555555"; + insert_feedback_color = "0xffd75f5f"; + split_ratio = "0.50"; + auto_balance = "off"; + mouse_modifier = "fn"; + mouse_action1 = "move"; + mouse_action2 = "resize"; + mouse_drop_action = "swap"; + layout = "bsp"; + top_padding = "5"; + bottom_padding = "5"; + left_padding = "5"; + right_padding = "5"; + window_gap = "06"; + }; + + extraConfig = '' + yabai -m rule --add app='System Preferences' manage=off + yabai -m rule --add app="choose" manage=off + yabai -m rule --add app="barrier" manage=off + yabai -m rule --add app="steam" manage=off + ''; + }; + }; +}