From 4ef4631356f191f0c7e8c40278354dcf949a990d Mon Sep 17 00:00:00 2001 From: Florian Schmitt Date: Sat, 29 Mar 2025 19:12:38 +0300 Subject: [PATCH] home: wip refact for modular home-manager --- dotfiles/kitty/kitty.conf | 2 +- machines/ace/home.nix | 22 +- modules/home-config.nix | 434 ------------------ modules/home-manager/dotfiles.nix | 30 ++ modules/home-manager/hyprland.nix | 135 ++++++ .../kde-plasma.nix} | 0 modules/home-manager/tmux.nix | 166 +++++++ modules/local-dev.nix | 8 +- users/mrflos.nix | 285 ++++++++++++ 9 files changed, 622 insertions(+), 460 deletions(-) delete mode 100644 modules/home-config.nix create mode 100644 modules/home-manager/dotfiles.nix create mode 100644 modules/home-manager/hyprland.nix rename modules/{home-plasma.nix => home-manager/kde-plasma.nix} (100%) create mode 100644 modules/home-manager/tmux.nix create mode 100644 users/mrflos.nix diff --git a/dotfiles/kitty/kitty.conf b/dotfiles/kitty/kitty.conf index 6fcd693..9040f34 100644 --- a/dotfiles/kitty/kitty.conf +++ b/dotfiles/kitty/kitty.conf @@ -85,7 +85,7 @@ confirm_os_window_close 0 enable_audio_bell no window_padding_width 4 font_size 14.0 -background_opacity 0.94 +background_opacity 0.95 paste_actions filter #hide_window_decorations yes #background_image ~/Nextcloud/Images/Wallpapers/kitty-bg.png diff --git a/machines/ace/home.nix b/machines/ace/home.nix index c9c67c9..f19faee 100644 --- a/machines/ace/home.nix +++ b/machines/ace/home.nix @@ -115,27 +115,7 @@ ]; fonts.fontconfig.enable = true; - home.file = { - "./.config/kitty/" = { - source = ../../dotfiles/kitty; - recursive = true; - }; - - "./.config/nvim/" = { - source = ../../dotfiles/nvim; - recursive = true; - }; - - "./.config/lazygit/" = { - source = ../../dotfiles/lazygit; - recursive = true; - }; - - "./.config/tmux/" = { - source = ../../dotfiles/tmux; - recursive = true; - }; - }; + imports = [ ../../modules/home-manager/dotfiles.nix ]; home.sessionVariables = { EDITOR = "nvim"; }; diff --git a/modules/home-config.nix b/modules/home-config.nix deleted file mode 100644 index 0d3296b..0000000 --- a/modules/home-config.nix +++ /dev/null @@ -1,434 +0,0 @@ -# Inject the right home-manager config for the machine. -{ - pkgs, - ... -}: -let - # plasma-manager = pkgs.fetchFromGitHub { - # owner = "pjones"; - # repo = "plasma-manager"; - # rev = "4e56cfeb95081a43cb49487d0996dc936d6201e5"; - # sha256 = "sha256-LJ/lFEupLSi7xtUps234hhMk7ZdVLRoYeU7KiCFaoGw="; - # }; - startupScript = pkgs.pkgs.writeShellScriptBin "hyprland-start" '' - ${pkgs.waybar}/bin/waybar & - ${pkgs.swww}/bin/swww init & - - sleep 1 - - ${pkgs.swww}/bin/swww img /home/mrflos/Nextcloud/Images/Wallpapers/chihiro014.jpg & - ''; -in -{ - imports = [ ]; - - home-manager.useGlobalPkgs = true; - users.users.mrflos = { - isNormalUser = true; - description = "mrflos"; - createHome = true; - extraGroups = [ - "users" - "docker" - "libvirtd" - "lxd" - "networkmanager" - "wheel" - ]; - uid = 1000; - shell = pkgs.zsh; - }; - - nix.settings.trusted-users = [ "mrflos" ]; - home-manager.backupFileExtension = "backup"; - home-manager.users.mrflos = - { pkgs, ... }: - { - home.stateVersion = "23.05"; - home.packages = with pkgs; [ - gcc - cmake - ripgrep - fd - lua-language-server - rust-analyzer-unwrapped - php83Packages.composer - nodejs_20 - swww - grimblast - swaylock - waybar - yarn - ]; - xdg = { - enable = true; - desktopEntries."zen" = { - name = "Zen Browser"; - genericName = "Web Browser"; - exec = "zen"; - terminal = false; - mimeType = [ - "text/html" - "text/xml" - ]; - }; - }; - - # imports = [ - # (plasma-manager + "/modules") - # ./home-plasma.nix - # ]; - home.file = { - "./.config/kitty/" = { - force = true; - source = ../dotfiles/kitty; - recursive = true; - }; - - "./.config/lazygit/" = { - force = true; - source = ../dotfiles/lazygit; - recursive = true; - }; - - "./.config/niri/" = { - force = true; - source = ../dotfiles/niri; - recursive = true; - }; - - "./.config/nvim/" = { - force = true; - source = ../dotfiles/nvim; - recursive = true; - }; - - "./.config/tmux/" = { - force = true; - source = ../dotfiles/tmux; - recursive = true; - }; - - "./.config/waybar/" = { - force = true; - source = ../dotfiles/waybar; - recursive = true; - }; - }; - home.sessionVariables = { - EDITOR = "nvim"; - #LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib"; - }; - home.sessionPath = [ - "$HOME/Code/nixos-config/scripts" - "$HOME/.local/bin" - "$HOME/go/bin" - ]; - accounts.email.accounts = { - "mrflos@chmok.net" = { - realName = "Florian Schmitt"; - userName = "mrflos@chmok.net"; - address = "mrflos@chmok.net"; - - primary = true; - thunderbird = { - enable = true; - }; - imap = { - host = "mail.infomaniak.com"; - port = 993; - }; - - smtp = { - host = "mail.infomaniak.com"; - port = 465; - }; - }; - "mrflos@yeswiki.pro" = { - realName = "Florian Schmitt - Yeswiki.pro"; - userName = "mrflos@yeswiki.pro"; - address = "mrflos@yeswiki.pro"; - - thunderbird = { - enable = true; - }; - imap = { - host = "mail.infomaniak.com"; - port = 993; - }; - - smtp = { - host = "mail.infomaniak.com"; - port = 465; - }; - }; - "mrflos@mrflos.pw" = { - realName = "Florian Schmitt"; - userName = "mrflos"; - address = "mrflos@mrflos.pw"; - - primary = false; - thunderbird = { - enable = true; - }; - imap = { - host = "mrflos.pw"; - port = 993; - #tls.enable = true; - #tls.useStartTls = true; - }; - - smtp = { - host = "mrflos.pw"; - port = 587; - #tls.useStartTls = true; - }; - }; - "contact@yeswiki.pro" = { - realName = "YesWiki.pro"; - userName = "contact@yeswiki.pro"; - address = "contact@yeswiki.pro"; - - primary = false; - thunderbird = { - enable = true; - }; - imap = { - host = "mail.infomaniak.com"; - port = 993; - }; - - smtp = { - host = "mail.infomaniak.com"; - port = 465; - }; - }; - "contact@yeswiki.net" = { - realName = "YesWiki.net"; - userName = "contact@yeswiki.net"; - address = "contact@yeswiki.net"; - - primary = false; - thunderbird = { - enable = true; - }; - imap = { - host = "mail.infomaniak.com"; - port = 993; - }; - - smtp = { - host = "mail.infomaniak.com"; - port = 465; - }; - }; - }; - - programs = { - direnv = { - enable = true; - enableZshIntegration = true; - nix-direnv.enable = true; - }; - - git = { - enable = true; - userName = "Florian Schmitt"; - userEmail = "mrflos@gmail.com"; - aliases = { - fa = "fetch --all --tags --prune --recurse-submodules --force"; - }; - extraConfig = { - pull.rebase = true; - init.defaultBranch = "main"; - core.editor = "nvim"; - core.fileMode = false; - }; - }; - mpv = { - enable = true; - package = ( - pkgs.mpv-unwrapped.wrapper { - scripts = with pkgs.mpvScripts; [ - mpris - sponsorblock - thumbfast - #uosc - #modernx - mpv-osc-tethys - visualizer - ]; - - mpv = pkgs.mpv-unwrapped.override { - waylandSupport = true; - }; - } - ); - - config = { - profile = "high-quality"; - ytdl-format = "bestvideo+bestaudio"; - }; - }; - neovim = { - defaultEditor = true; - viAlias = true; - vimAlias = true; - }; - - starship = { - enable = true; - settings = with builtins; fromTOML (readFile ../dotfiles/starship/starship.toml); - }; - - zsh = { - enable = true; - autosuggestion.enable = true; - enableCompletion = true; - shellAliases = { - #tmux = "tmux -f ~/.config/tmux/tmux.conf attach || tmux -f ~/.config/tmux/tmux.conf new"; - bunx = "bun --bun x"; - c = "/home/mrflos/Code/nixos-config/scripts/tmux-sessionizer"; - g = "lazygit"; - n = "/home/mrflos/Code/nixos-config/scripts/open-notes"; - s = "/home/mrflos/Code/nixos-config/scripts/ssh-connect"; - t = "/home/mrflos/Code/nixos-config/scripts/tmux-sessionizer"; - kdenix = "nix run github:pjones/plasma-manager --extra-experimental-features nix-command --extra-experimental-features flakes > /home/mrflos/Developpements/nixos-config/modules/home-plasma.nix"; - icat = "kitty +kitten icat"; - nixedit = "vi /etc/nixos"; - nixupdate = "sudo nix-channel --update && sudo nixos-rebuild switch"; - nixclean = "sudo nix-env --delete-generations old --profile /nix/var/nix/profiles/system && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch && sudo nix-store --gc"; - socks = "ssh -N -f -C -D 9090 mrflos@yunohost.yeswiki.net -p 6742"; - vi = "/run/current-system/sw/bin/nvim"; - vim = "/run/current-system/sw/bin/nvim"; - yeswiki-updater = "cd /home/mrflos/Code/yeswiki-installer/ && sudo php yeswiki-updater.php"; - }; - initExtra = '' - export BUN_INSTALL="$HOME/.bun" - export PHP_CS_FIXER_IGNORE_ENV=1 - export PATH="$HOME/.local/bin:$BUN_INSTALL/bin:$PATH" - eval "$(atuin init zsh)" - eval "$(zoxide init zsh)" - ''; - oh-my-zsh = { - enable = true; - extraConfig = '' - zstyle :omz:plugins:ssh-agent helper ksshaskpass - zstyle :omz:plugins:ssh-agent agent-forwarding yes - zstyle :omz:plugins:ssh-agent lazy yes - ''; - plugins = [ - "git" - "ssh-agent" - ]; - # theme = "robbyrussell"; - }; - }; - }; - - services.ssh-agent.enable = true; - wayland.windowManager.hyprland.enable = true; - wayland.windowManager.hyprland.settings = { - exec-once = ''${startupScript}/bin/hyprland-start''; - "$mod" = "SUPER"; - - # assign apps - "$term" = "kitty"; - "$editor" = "nvim"; - "$file" = "dolphin"; - "$browser" = "firefox"; - - bind = - [ - ", Print, exec, grimblast copy area" - # Window/Session actions - "$mod, Q, killactive" - "ALT, F4, killactive" - "$mod, delete, exit" # kill hyperland session - "$mod, W, togglefloating" # toggle the window on focus to float - "$mod, G, togglegroup" # toggle the window on focus to float - "ALT, return, fullscreen" # toggle the window on focus to fullscreen - "$mod, L, exec, swaylock" # lock screen - # "$mod, backspace, exec, wlogout-launcher-hyprland 1" # logout menu - "$CONTROL, ESCAPE, exec, systemctl-toggle --user waybar.service" - - # Application shortcuts - "$mod, T, exec, $term" # open terminal - "$mod, E, exec, $file" # open file manager - "$mod, C, exec, $editor" # open vscode - "$mod, F, exec, $browser" # open browser - - # Move focus with mainMod + arrow keys - "$mod, left, movefocus, l" - "$mod, right, movefocus, r" - "$mod, up, movefocus, u" - "$mod, down, movefocus, d" - "ALT, Tab, movefocus, d" - - # Switch workspaces relative to the active workspace with mainMod + CTRL + [←→] - "$mod CTRL, right, workspace, r+1" - "$mod CTRL, left, workspace, r-1" - - # move to the first empty workspace instantly with mainMod + CTRL + [↓] - "$mod CTRL, down, workspace, empty" - - # Move active window to a relative workspace with mainMod + CTRL + ALT + [←→] - "$mod CTRL ALT, right, movetoworkspace, r+1" - "$mod CTRL ALT, left, movetoworkspace, r-1" - - # Move active window around current workspace with mainMod + SHIFT + CTRL [←→↑↓] - "$mod SHIFT $CONTROL, left, movewindow, l" - "$mod SHIFT $CONTROL, right, movewindow, r" - "$mod SHIFT $CONTROL, up, movewindow, u" - "$mod SHIFT $CONTROL, down, movewindow, d" - - # Scroll through existing workspaces with mainMod + scroll - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - - # Special workspaces (scratchpad) - "$mod ALT, S, movetoworkspacesilent, special" - "$mod, S, togglespecialworkspace," - - # Toggle Layout - "$mod, J, togglesplit," # dwindle - ] - ++ ( - # workspaces - # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} - builtins.concatLists ( - builtins.genList ( - x: - let - ws = - let - c = (x + 1) / 10; - in - builtins.toString (x + 1 - (c * 10)); - in - [ - "$mod, ${ws}, workspace, ${toString (x + 1)}" - "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" - "$mod ALT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}" # Move window silently to workspace Super + Alt + [0-9] - ] - ) 10 - ) - ); - - # Move/Resize windows with mainMod + LMB/RMB and dragging - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - ]; - - # Resize windows - binde = [ - "$mod SHIFT, right, resizeactive, 30 0" - "$mod SHIFT, left, resizeactive, -30 0" - "$mod SHIFT, up, resizeactive, 0 -30" - "$mod SHIFT, down, resizeactive, 0 30" - ]; - }; - - }; -} diff --git a/modules/home-manager/dotfiles.nix b/modules/home-manager/dotfiles.nix new file mode 100644 index 0000000..cfea8dd --- /dev/null +++ b/modules/home-manager/dotfiles.nix @@ -0,0 +1,30 @@ +{ + lib, + ... +}: +{ + home.file = + let + listFilesRecursive = + dir: acc: + lib.flatten ( + lib.mapAttrsToList ( + k: v: if v == "regular" then "${acc}${k}" else listFilesRecursive dir "${acc}${k}/" + ) (builtins.readDir "${dir}/${acc}") + ); + + toHomeFiles = + dir: + builtins.listToAttrs ( + map (x: { + name = "./.config/${x}"; + value = { + source = "${dir}/${x}"; + force = true; + recursive = true; + }; + }) (listFilesRecursive dir "") + ); + in + toHomeFiles ../../dotfiles; +} diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix new file mode 100644 index 0000000..bcd93a6 --- /dev/null +++ b/modules/home-manager/hyprland.nix @@ -0,0 +1,135 @@ +{ + pkgs, + ... +}: +let + startupScript = pkgs.pkgs.writeShellScriptBin "hyprland-start" '' + ${pkgs.waybar}/bin/waybar & + ${pkgs.swww}/bin/swww init & + + sleep 1 + + ${pkgs.swww}/bin/swww img /home/mrflos/Nextcloud/Images/Wallpapers/chihiro014.jpg & + ''; +in +{ + imports = [ ]; + + home-manager.users.mrflos = + { pkgs, ... }: + { + home.stateVersion = "23.05"; + home.packages = with pkgs; [ + swww + grimblast + swaylock + waybar + yarn + ]; + programs = { + wayland.windowManager.hyprland.enable = true; + wayland.windowManager.hyprland.settings = { + exec-once = ''${startupScript}/bin/hyprland-start''; + "$mod" = "SUPER"; + + # assign apps + "$term" = "kitty"; + "$editor" = "nvim"; + "$file" = "dolphin"; + "$browser" = "zen"; + + bind = + [ + ", Print, exec, grimblast copy area" + # Window/Session actions + "$mod, Q, killactive" + "ALT, F4, killactive" + "$mod, delete, exit" # kill hyperland session + "$mod, W, togglefloating" # toggle the window on focus to float + "$mod, G, togglegroup" # toggle the window on focus to float + "ALT, return, fullscreen" # toggle the window on focus to fullscreen + "$mod, L, exec, swaylock" # lock screen + # "$mod, backspace, exec, wlogout-launcher-hyprland 1" # logout menu + "$CONTROL, ESCAPE, exec, systemctl-toggle --user waybar.service" + + # Application shortcuts + "$mod, T, exec, $term" # open terminal + "$mod, E, exec, $file" # open file manager + "$mod, C, exec, $editor" # open vscode + "$mod, F, exec, $browser" # open browser + + # Move focus with mainMod + arrow keys + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + "ALT, Tab, movefocus, d" + + # Switch workspaces relative to the active workspace with mainMod + CTRL + [←→] + "$mod CTRL, right, workspace, r+1" + "$mod CTRL, left, workspace, r-1" + + # move to the first empty workspace instantly with mainMod + CTRL + [↓] + "$mod CTRL, down, workspace, empty" + + # Move active window to a relative workspace with mainMod + CTRL + ALT + [←→] + "$mod CTRL ALT, right, movetoworkspace, r+1" + "$mod CTRL ALT, left, movetoworkspace, r-1" + + # Move active window around current workspace with mainMod + SHIFT + CTRL [←→↑↓] + "$mod SHIFT $CONTROL, left, movewindow, l" + "$mod SHIFT $CONTROL, right, movewindow, r" + "$mod SHIFT $CONTROL, up, movewindow, u" + "$mod SHIFT $CONTROL, down, movewindow, d" + + # Scroll through existing workspaces with mainMod + scroll + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + + # Special workspaces (scratchpad) + "$mod ALT, S, movetoworkspacesilent, special" + "$mod, S, togglespecialworkspace," + + # Toggle Layout + "$mod, J, togglesplit," # dwindle + ] + ++ ( + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + builtins.concatLists ( + builtins.genList ( + x: + let + ws = + let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in + [ + "$mod, ${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + "$mod ALT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}" # Move window silently to workspace Super + Alt + [0-9] + ] + ) 10 + ) + ); + + # Move/Resize windows with mainMod + LMB/RMB and dragging + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + + # Resize windows + binde = [ + "$mod SHIFT, right, resizeactive, 30 0" + "$mod SHIFT, left, resizeactive, -30 0" + "$mod SHIFT, up, resizeactive, 0 -30" + "$mod SHIFT, down, resizeactive, 0 30" + ]; + }; + + }; + }; +} diff --git a/modules/home-plasma.nix b/modules/home-manager/kde-plasma.nix similarity index 100% rename from modules/home-plasma.nix rename to modules/home-manager/kde-plasma.nix diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix new file mode 100644 index 0000000..4b18c97 --- /dev/null +++ b/modules/home-manager/tmux.nix @@ -0,0 +1,166 @@ +{ pkgs, ... }: +let + t-smart-manager = pkgs.tmuxPlugins.mkTmuxPlugin + { + pluginName = "t-smart-tmux-session-manager"; + version = "unstable-2023-01-06"; + rtpFilePath = "t-smart-tmux-session-manager.tmux"; + src = pkgs.fetchFromGitHub { + owner = "joshmedeski"; + repo = "t-smart-tmux-session-manager"; + rev = "a1e91b427047d0224d2c9c8148fb84b47f651866"; + sha256 = "sha256-HN0hJeB31MvkD12dbnF2SjefkAVgtUmhah598zAlhQs="; + }; + }; + tmux-nvim = pkgs.tmuxPlugins.mkTmuxPlugin + { + pluginName = "tmux.nvim"; + version = "unstable-2023-01-06"; + src = pkgs.fetchFromGitHub { + owner = "aserowy"; + repo = "tmux.nvim/"; + rev = "57220071739c723c3a318e9d529d3e5045f503b8"; + sha256 = "sha256-zpg7XJky7PRa5sC7sPRsU2ZOjj0wcepITLAelPjEkSI="; + }; + }; + tmux-browser = pkgs.tmuxPlugins.mkTmuxPlugin + { + pluginName = "tmux-browser"; + version = "unstable-2023-01-06"; + src = pkgs.fetchFromGitHub { + owner = "ofirgall"; + repo = "tmux-browser"; + rev = "c3e115f9ebc5ec6646d563abccc6cf89a0feadb8"; + sha256 = "sha256-ngYZDzXjm4Ne0yO6pI+C2uGO/zFDptdcpkL847P+HCI="; + }; + }; + + tmux-super-fingers = pkgs.tmuxPlugins.mkTmuxPlugin + { + pluginName = "tmux-super-fingers"; + version = "unstable-2023-01-06"; + src = pkgs.fetchFromGitHub { + owner = "artemave"; + repo = "tmux_super_fingers"; + rev = "2c12044984124e74e21a5a87d00f844083e4bdf7"; + sha256 = "sha256-cPZCV8xk9QpU49/7H8iGhQYK6JwWjviL29eWabuqruc="; + }; + }; + + +in +{ + # TODO: what if this is defined in another file? Merge it! + programs.fish = { + shellInit = '' + fish_add_path ${t-smart-manager}/share/tmux-plugins/t-smart-tmux-session-manager/bin/ + ''; + }; + + home.packages = with pkgs; [ + lsof + ]; + + programs.tmux = { + enable = true; + shell = "${pkgs.fish}/bin/fish"; + terminal = "tmux-256color"; + historyLimit = 100000; + plugins = with pkgs; + [ + tmux-nvim + tmuxPlugins.tmux-thumbs + # TODO: why do I have to manually set this + { + plugin = t-smart-manager; + extraConfig = '' + set -g @t-fzf-prompt ' ' + set -g @t-bind "T" + ''; + } + { + plugin = tmux-super-fingers; + extraConfig = "set -g @super-fingers-key f"; + } + { + plugin = tmux-browser; + extraConfig = '' + set -g @browser_close_on_deattach '1' + ''; + } + + tmuxPlugins.sensible + # must be before continuum edits right status bar + { + plugin = tmuxPlugins.catppuccin; + extraConfig = '' + set -g @catppuccin_flavour 'frappe' + set -g @catppuccin_window_tabs_enabled on + set -g @catppuccin_date_time "%H:%M" + ''; + } + { + plugin = tmuxPlugins.resurrect; + extraConfig = '' + set -g @resurrect-strategy-vim 'session' + set -g @resurrect-strategy-nvim 'session' + set -g @resurrect-capture-pane-contents 'on' + ''; + } + { + plugin = tmuxPlugins.continuum; + extraConfig = '' + set -g @continuum-restore 'on' + set -g @continuum-boot 'on' + set -g @continuum-save-interval '10' + ''; + } + tmuxPlugins.better-mouse-mode + tmuxPlugins.yank + ]; + extraConfig = '' + set -g default-terminal "tmux-256color" + set -ag terminal-overrides ",xterm-256color:RGB" + + set-option -g prefix C-a + unbind-key C-b + bind-key C-a send-prefix + + set -g mouse on + + # Change splits to match nvim and easier to remember + # Open new split at cwd of current split + unbind % + unbind '"' + bind | split-window -h -c "#{pane_current_path}" + bind - split-window -v -c "#{pane_current_path}" + + # Use vim keybindings in copy mode + set-window-option -g mode-keys vi + + # v in copy mode starts making selection + bind-key -T copy-mode-vi v send-keys -X begin-selection + bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle + bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + + # Escape turns on copy mode + bind Escape copy-mode + + # Easier reload of config + bind r source-file ~/.config/tmux/tmux.conf + + set-option -g status-position top + + # make Prefix p paste the buffer. + unbind p + bind p paste-buffer + + # Bind Keys + bind-key -T prefix C-g split-window \ + "$SHELL --login -i -c 'navi --print | head -c -1 | tmux load-buffer -b tmp - ; tmux paste-buffer -p -t {last} -b tmp -d'" + bind-key -T prefix C-l switch -t notes + bind-key -T prefix C-d switch -t dotfiles + bind-key e send-keys "tmux capture-pane -p -S - | nvim -c 'set buftype=nofile' +" Enter + ''; + }; +} diff --git a/modules/local-dev.nix b/modules/local-dev.nix index 570eb8e..fd69b6d 100644 --- a/modules/local-dev.nix +++ b/modules/local-dev.nix @@ -6,10 +6,6 @@ { virtualisation = { docker.enable = true; - #docker.rootless = { - # enable = true; - # setSocketVariable = true; - #}; libvirtd.enable = true; lxd.enable = true; #waydroid.enable = true @@ -86,10 +82,12 @@ bruno bruno-cli #clang + cmake dart-sass dbeaver-bin docker-compose eris-go + fd gcc go nixfmt-rfc-style @@ -108,6 +106,8 @@ php83Packages.php-cs-fixer python3 python311Packages.virtualenv + rust-analyzer-unwrapped + ripgrep rpi-imager ruff-lsp stdenvNoCC diff --git a/users/mrflos.nix b/users/mrflos.nix new file mode 100644 index 0000000..f2a4d75 --- /dev/null +++ b/users/mrflos.nix @@ -0,0 +1,285 @@ +{ + pkgs, + ... +}: +let +in +{ + imports = [ + + ../dotfiles/dotfiles.nix + ]; + + home-manager.useGlobalPkgs = true; + users.users.mrflos = { + isNormalUser = true; + description = "mrflos"; + createHome = true; + extraGroups = [ + "users" + "docker" + "libvirtd" + "lxd" + "networkmanager" + "wheel" + ]; + uid = 1000; + shell = pkgs.zsh; + }; + + nix.settings.trusted-users = [ "mrflos" ]; + home-manager.backupFileExtension = "backup"; + home-manager.users.mrflos = { + home.stateVersion = "23.05"; + }; + + # home.file = { + #"./.config/kitty/" = { + # force = true; + # source = ../dotfiles/kitty; + # recursive = true; + #}; + # + #"./.config/lazygit/" = { + # force = true; + # source = ../dotfiles/lazygit; + # recursive = true; + #}; + # + #"./.config/niri/" = { + # force = true; + # source = ../dotfiles/niri; + # recursive = true; + #}; + # + #"./.config/nvim/" = { + # force = true; + # source = ../dotfiles/nvim; + # recursive = true; + #}; + # + #"./.config/tmux/" = { + # force = true; + # source = ../dotfiles/tmux; + # recursive = true; + #}; + # + #"./.config/waybar/" = { + # force = true; + # source = ../dotfiles/waybar; + # recursive = true; + #}; + #}; + home.sessionVariables = { + EDITOR = "nvim"; + #LD_LIBRARY_PATH = "${pkgs.stdenv.cc.cc.lib}/lib"; + }; + home.sessionPath = [ + "$HOME/Code/nixos-config/scripts" + "$HOME/.local/bin" + "$HOME/go/bin" + ]; + accounts.email.accounts = { + "mrflos@chmok.net" = { + realName = "Florian Schmitt"; + userName = "mrflos@chmok.net"; + address = "mrflos@chmok.net"; + + primary = true; + thunderbird = { + enable = true; + }; + imap = { + host = "mail.infomaniak.com"; + port = 993; + }; + + smtp = { + host = "mail.infomaniak.com"; + port = 465; + }; + }; + "mrflos@yeswiki.pro" = { + realName = "Florian Schmitt - Yeswiki.pro"; + userName = "mrflos@yeswiki.pro"; + address = "mrflos@yeswiki.pro"; + + thunderbird = { + enable = true; + }; + imap = { + host = "mail.infomaniak.com"; + port = 993; + }; + + smtp = { + host = "mail.infomaniak.com"; + port = 465; + }; + }; + "mrflos@mrflos.pw" = { + realName = "Florian Schmitt"; + userName = "mrflos"; + address = "mrflos@mrflos.pw"; + + primary = false; + thunderbird = { + enable = true; + }; + imap = { + host = "mrflos.pw"; + port = 993; + #tls.enable = true; + #tls.useStartTls = true; + }; + + smtp = { + host = "mrflos.pw"; + port = 587; + #tls.useStartTls = true; + }; + }; + "contact@yeswiki.pro" = { + realName = "YesWiki.pro"; + userName = "contact@yeswiki.pro"; + address = "contact@yeswiki.pro"; + + primary = false; + thunderbird = { + enable = true; + }; + imap = { + host = "mail.infomaniak.com"; + port = 993; + }; + + smtp = { + host = "mail.infomaniak.com"; + port = 465; + }; + }; + "contact@yeswiki.net" = { + realName = "YesWiki.net"; + userName = "contact@yeswiki.net"; + address = "contact@yeswiki.net"; + + primary = false; + thunderbird = { + enable = true; + }; + imap = { + host = "mail.infomaniak.com"; + port = 993; + }; + + smtp = { + host = "mail.infomaniak.com"; + port = 465; + }; + }; + }; + + programs = { + direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + }; + + git = { + enable = true; + userName = "Florian Schmitt"; + userEmail = "mrflos@gmail.com"; + aliases = { + fa = "fetch --all --tags --prune --recurse-submodules --force"; + }; + extraConfig = { + pull.rebase = true; + init.defaultBranch = "main"; + core.editor = "nvim"; + core.fileMode = false; + }; + }; + mpv = { + enable = true; + package = ( + pkgs.mpv-unwrapped.wrapper { + scripts = with pkgs.mpvScripts; [ + mpris + sponsorblock + thumbfast + #uosc + #modernx + mpv-osc-tethys + visualizer + ]; + + mpv = pkgs.mpv-unwrapped.override { + waylandSupport = true; + }; + } + ); + + config = { + profile = "high-quality"; + ytdl-format = "bestvideo+bestaudio"; + }; + }; + neovim = { + defaultEditor = true; + viAlias = true; + vimAlias = true; + }; + + starship = { + enable = true; + settings = with builtins; fromTOML (readFile ../dotfiles/starship/starship.toml); + }; + + zsh = { + enable = true; + autosuggestion.enable = true; + enableCompletion = true; + shellAliases = { + #tmux = "tmux -f ~/.config/tmux/tmux.conf attach || tmux -f ~/.config/tmux/tmux.conf new"; + bunx = "bun --bun x"; + c = "/home/mrflos/Code/nixos-config/scripts/tmux-sessionizer"; + g = "lazygit"; + n = "/home/mrflos/Code/nixos-config/scripts/open-notes"; + s = "/home/mrflos/Code/nixos-config/scripts/ssh-connect"; + t = "/home/mrflos/Code/nixos-config/scripts/tmux-sessionizer"; + kdenix = "nix run github:pjones/plasma-manager --extra-experimental-features nix-command --extra-experimental-features flakes > /home/mrflos/Developpements/nixos-config/modules/home-plasma.nix"; + icat = "kitty +kitten icat"; + nixedit = "vi /etc/nixos"; + nixupdate = "sudo nix-channel --update && sudo nixos-rebuild switch"; + nixclean = "sudo nix-env --delete-generations old --profile /nix/var/nix/profiles/system && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration switch && sudo nix-store --gc"; + socks = "ssh -N -f -C -D 9090 mrflos@yunohost.yeswiki.net -p 6742"; + vi = "/run/current-system/sw/bin/nvim"; + vim = "/run/current-system/sw/bin/nvim"; + yeswiki-updater = "cd /home/mrflos/Code/yeswiki-installer/ && sudo php yeswiki-updater.php"; + }; + initExtra = '' + export BUN_INSTALL="$HOME/.bun" + export PHP_CS_FIXER_IGNORE_ENV=1 + export PATH="$HOME/.local/bin:$BUN_INSTALL/bin:$PATH" + eval "$(atuin init zsh)" + eval "$(zoxide init zsh)" + ''; + oh-my-zsh = { + enable = true; + extraConfig = '' + zstyle :omz:plugins:ssh-agent helper ksshaskpass + zstyle :omz:plugins:ssh-agent agent-forwarding yes + zstyle :omz:plugins:ssh-agent lazy yes + ''; + plugins = [ + "git" + "ssh-agent" + ]; + # theme = "robbyrussell"; + }; + }; + }; + + services.ssh-agent.enable = true; +}