diff --git a/.gitignore b/.gitignore index b12e90ad5ad4ae77215e74cdf66de71da19ef3cc..fd9d1ca548f88694b09655ec42567e08161475b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -flake.lock .DS_STORE +.hostname +flake.lock result result-* diff --git a/flake.nix b/flake.nix index ed6d6e80d91b15e238205cedf6087c8fcf5d23ca..0d0144ab2ff35d0cb23500583c081d5ac9b5e065 100644 --- a/flake.nix +++ b/flake.nix @@ -134,6 +134,12 @@ host = "paperback"; system = "aarch64-darwin"; }; + # clover's work macbook pro + darwinConfigurations.clover-work-mac = mkSystem "clover-work-mac" { + user = "clover"; + host = "work"; + system = "aarch64-darwin"; + }; # fish's cattop nixosConfigurations.cattop = mkSystem "cattop" { diff --git a/modules/home/default.nix b/modules/home/default.nix index 09ddaee898e5e9bfc907f4e79de87ce51af4f6ad..64fbd631b34421db740a329ea8f752b863bf684d 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -77,6 +77,7 @@ in # ViM and Neovim ".*.swp" ".nvimlog" + ".jj" ]; }; @@ -134,6 +135,33 @@ in autocd = true; history.size = 10000; }; + jujutsu = { + settings = { + user = { + email = config.programs.git.userEmail; + name = config.programs.git.userName; + }; + signing = { + behavior = "own"; + backend = "ssh"; + key = "~/.ssh/id_ed25519.pub"; + }; + git = { + sign-on-push = true; + push-new-bookmarks = true; + }; + ui = { + default-command = "log"; + diff-formatter = [ + "${pkgs.difftastic}/bin/difft" + "--color=always" + "$left" + "$right" + ]; + pager = "${pkgs.bat}/bin/bat --style=plain"; + }; + }; + }; ghostty.settings.custom-shader = lib.mkIf ( cfg.ghostty.shader != null diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix index f982fab390bef61b56284ceb5d8d92281adfc658..6a31c91a848672da9814e0b6bd9e5c5ad48a29f8 100644 --- a/modules/neovim/default.nix +++ b/modules/neovim/default.nix @@ -131,6 +131,7 @@ hide_dotfiles = false; never_show = [ ".git" + ".jj" ".DS_Store" # macOS "thumbs.db" # Windows ]; diff --git a/switch b/switch index 3c267596a89ce1a79011f5431c6d73cc4e2a25ec..bf5697d655d9362730c9db9854db34b7950154fc 100755 --- a/switch +++ b/switch @@ -1,12 +1,23 @@ #!/bin/sh nh_subcommand="os" fallback_command="nixos-rebuild" -if [ "$(uname -o)" = "darwin" ]; then - nh_subcommand="darwin" - fallback_command="nix run .#darwin-rebuild" +hostname_file="$(dirname "$0")/.hostname" +if [ -n "$1" ]; then + hostname="$1" +elif [ -f "$hostname_file" ]; then + hostname=$(cat "$hostname_file") +fi +if [ -z "$hostname" ]; then + hostname="$(hostname)" +fi +printf "%s" "$hostname" >"$hostname_file" +if [ "$(uname -o)" = "Darwin" ]; then + nh_subcommand="darwin" + fallback_command="nix run .#darwin-rebuild" + hostname="darwinConfigurations.$hostname" fi if command -v nh >/dev/null; then - nh $nh_subcommand switch . + nh $nh_subcommand switch '.#'"$hostname" else - $fallback_command -- switch --flake . + $fallback_command -- switch --flake '.#'"$hostname" fi diff --git a/users/clover/configuration.nix b/users/clover/configuration.nix index 103b011a987ed79def16b4bae7aef256192e681d..a02a361b99dede3b63eeef4c137f3f6e12e9e63e 100644 --- a/users/clover/configuration.nix +++ b/users/clover/configuration.nix @@ -17,6 +17,14 @@ ]; }; + homebrew = { + enable = true; + casks = [ + "db-browser-for-sqlite" + "alt-tab" + ]; + }; + # system preferences system.defaults = { NSGlobalDomain = { diff --git a/users/clover/home.nix b/users/clover/home.nix index d256187bcf86ecfef122a919c5a267b79cf1739d..bf3d6838a0719a93f9c88a12d087b6345d6b36cd 100644 --- a/users/clover/home.nix +++ b/users/clover/home.nix @@ -10,9 +10,7 @@ in let # packages to always install all = [ - (ffmpeg.override { - withSvtav1 = true; - }) + ffmpeg-full ripgrep uv nh @@ -20,8 +18,8 @@ in ]; # packages to install for desktop environments (non-server) desktop = [ - git-town lazygit + jjui ]; # packages to install on all servers server = [ ]; @@ -31,7 +29,6 @@ in ]; # packages to install on linux desktops linux = [ - reaper # TODO: why does this break on macOS ]; in all ++ (if host.darwin then darwin else linux) ++ (if hostServer then server else desktop); @@ -49,7 +46,7 @@ in shader = "cursor-smear-black.glsl"; package = null; settings = { - theme = "light:catppuccin-latte,dark:catppuccin-macchiato"; + theme = "light:Farmhouse Light,dark:Challenger Deep"; font-family = "AT Name Mono"; adjust-cursor-thickness = 1; background-opacity = 0.9; @@ -61,13 +58,15 @@ in zsh = { enable = true; shellAliases = { - switch = "nh darwin switch ~/config"; + switch = "~/config/switch"; gg = "lazygit"; ga = "git add"; g = "git status"; gp = "git pull --rebase && git push"; }; - profileExtra = '' + initContent = '' + export PS1="%{$(tput setaf 207)%}%m%{$(tput setaf 15)%}:%{$(tput setaf 87)%}%~ %{$(tput sgr0)%}$ " + function python() { dirname=$(dirname $1 2>/dev/null) if [ -z "$dirname" ]; then @@ -81,8 +80,198 @@ in # use a git-specific email git.userEmail = "git@paperclover.net"; + jujutsu = { + enable = true; + # my workflow is based on creating changes and editing them. while they + # are in progress the description starts with "WIP: " + settings = rec { + colors = { + bookmark = "green"; + bookmarks = colors.bookmark; + local_bookmarks = colors.bookmarks; + remote_bookmarks = colors.bookmark; + "working_copy bookmark" = "bright green"; + "working_copy bookmarks" = colors."working_copy bookmark"; + "working_copy local_bookmarks" = colors."working_copy bookmark"; + "working_copy remote_bookmarks" = colors."working_copy bookmark"; + + "author" = { + fg = "white"; + bold = false; + italic = true; + }; + "working_copy author" = colors.author; + + desc = { + bold = false; + fg = "bright white"; + }; + description = colors.desc; + cc_wip = { + fg = "bright yellow"; + bold = true; + reverse = true; + }; + cc_header = { + bold = true; + fg = "bright white"; + }; + cc_feat = "green"; + cc_fix = "red"; + cc_hotfix = "red"; + cc_chore = "yellow"; + cc_test = "blue"; + cc_other = "blue"; + cc_scope = { + fg = "cyan"; + bold = false; + italic = true; + }; + + active_marker = { + fg = "bright magenta"; + bold = true; + reverse = true; + }; + conflict_marker = { + fg = "bright red"; + bold = true; + reverse = true; + }; + + timestamp = "bright black"; + commit_id = { + fg = "bright black"; + bold = false; + }; + muted = "bright black"; + }; + # ui.graph.style = "square"; + revsets = { + log = "ancestors(description(regex:\"^(WIP:|\\\\s+$)\"):: | working_copies() | bookmarks(\"master\")::remote_bookmarks(\"master\") | bookmarks(glob:\"clo/*\")::, 5)"; + short-prefixes = "(trunk()..@)::"; + }; + # templates.log = "hl_wip(self)"; + + template-aliases = { + # log template, highlighting the WIP commits by making everything else faded out + "hl_wip(commit)" = '' + if(commit.root(), format_root_commit(commit), + label("__commit__", + format_short_commit_header(commit) ++ "\n" ++ + format_commit_description(commit) + ) + ) + ''; + + "format_commit_description(commit)" = '' + label("desc", format_commit_firstline(commit.description().first_line())) ++ + "\n" ++ if( + commit.description().starts_with("WIP:") || commit.current_working_copy(), + commit.description().remove_prefix(commit.description().first_line()).remove_prefix("\n").trim_end() ++ "\n ", + if(commit.description().remove_prefix(commit.description().first_line()).trim().len() > 0, + label("muted", lines_collapsed(commit.description().lines().filter(|x| x.trim().len() > 0).len() - 1)), + " " + ) + ) + ''; + "lines_collapsed(count)" = + ''("[" ++ stringify(count ++ " line" ++ if(count == 1, "", "s")) ++ " collapsed]\n")''; + "format_commit_firstline(line)" = '' + if(line.starts_with("WIP:"), + label("cc_wip", " WIP ") ++ " " ++ format_commit_firstline_a_wip(line.remove_prefix("WIP:").trim()), + format_commit_firstline_a_wip(line) + ) + ''; + "format_commit_firstline_a_wip(line)" = '' + if(line.starts_with("feat:") || line.starts_with("feat("), + label("cc_feat", "feat") ++ format_commit_firstline_a_cc_type(line.remove_prefix("feat")), + if(line.starts_with("fix:") || line.starts_with("fix("), + label("cc_fix", "fix") ++ format_commit_firstline_a_cc_type(line.remove_prefix("fix")), + if(line.starts_with("hotfix:") || line.starts_with("hotfix("), + label("cc_hotfix", "hotfix") ++ format_commit_firstline_a_cc_type(line.remove_prefix("hotfix")), + if(line.starts_with("chore:") || line.starts_with("chore("), + label("cc_chore", "chore") ++ format_commit_firstline_a_cc_type(line.remove_prefix("chore")), + if(line.starts_with("test:") || line.starts_with("test("), + label("cc_other", "test") ++ format_commit_firstline_a_cc_type(line.remove_prefix("test")), + if(line.starts_with("refactor:") || line.starts_with("refactor("), + label("cc_other", "refactor") ++ format_commit_firstline_a_cc_type(line.remove_prefix("refactor")), + if(line.starts_with("perf:") || line.starts_with("perf("), + label("cc_other", "perf") ++ format_commit_firstline_a_cc_type(line.remove_prefix("perf")), + if(line.starts_with("lib:") || line.starts_with("lib("), + label("cc_other", "lib") ++ format_commit_firstline_a_cc_type(line.remove_prefix("lib")), + label("cc_header", line) + )))))))) + ''; + "format_commit_firstline_a_cc_type(rest)" = '' + if(rest.starts_with("(") && rest.contains(")"), + format_firstline_cc_scope(rest, index_of_close_paren(rest)), + format_firstline_a_cc(rest)) + ''; + "format_firstline_cc_scope(rest, index)" = '' + label("cc_scope", rest.substr(0, index)) ++ format_firstline_a_cc(rest.substr(index, rest.len())) + ''; + "format_firstline_a_cc(rest)" = '' + if(rest.starts_with(":"), + label("muted", ":") ++ label("cc_header", rest.remove_prefix(":")), + label("cc_header", rest) + ) + ''; + # sorry! + "index_of_close_paren(line)" = '' + stringify(if(line.substr(1, 2) == ")", "A", + if(line.substr(2, 3) == ")", "AA", + if(line.substr(3, 4) == ")", "AAA", + if(line.substr(4, 5) == ")", "AAAA", + if(line.substr(5, 6) == ")", "AAAAA", + if(line.substr(6, 7) == ")", "AAAAAA", + if(line.substr(7, 8) == ")", "AAAAAAA", + if(line.substr(8, 9) == ")", "AAAAAAAA", + if(line.substr(9, 10) == ")","AAAAAAAAA", + if(line.substr(10, 11) == ")", "AAAAAAAAAA", + if(line.substr(11, 12) == ")", "AAAAAAAAAAA", + if(line.substr(12, 13) == ")", "AAAAAAAAAAAA", + if(line.substr(13, 14) == ")", "AAAAAAAAAAAAA", + if(line.substr(14, 15) == ")", "AAAAAAAAAAAAAA", + if(line.substr(15, 16) == ")", "AAAAAAAAAAAAAAA", + if(line.substr(16, 17) == ")", "AAAAAAAAAAAAAAAA", + if(line.substr(17, 18) == ")", "AAAAAAAAAAAAAAAAA", + if(line.substr(18, 19) == ")", "AAAAAAAAAAAAAAAAAA", + if(line.substr(19, 20) == ")", "AAAAAAAAAAAAAAAAAAA", + if(line.substr(20, 21) == ")", "AAAAAAAAAAAAAAAAAAAA", + "AAAAAAAAAAAAAAAAAAAAA" + ))))))))))))))))))))).len() + 1 + ''; + + "format_short_signature(signature)" = "signature.name()"; + "format_timestamp(timestamp)" = "timestamp.ago()"; + "format_short_commit_header(commit)" = '' + separate(" ", + if(commit.current_working_copy(), label("active_marker", " ACTIVE ")), + if(commit.conflict(), label("conflict_marker", " CONFLICT ")), + format_short_change_id_with_hidden_and_divergent_info(commit), + format_short_signature(commit.author()), + label("muted", "|"), + if(commit.description().trim().len() > 0, label("muted", format_timestamp(commit_timestamp(commit)))), + commit.bookmarks(), + commit.tags(), + commit.working_copies(), + label("muted", "(") ++ + format_short_commit_id(commit.commit_id()) ++ + label("muted", ")"), + if(config("ui.show-cryptographic-signatures").as_boolean(), + format_short_cryptographic_signature(commit.signature())), + ) + ''; + }; + }; + }; + ssh = { enable = true; + extraConfig = '' + SetEnv TERM=xterm-color + ''; matchBlocks = rec { zenith = { user = "clo"; @@ -91,12 +280,5 @@ in "nas.paperclover.net" = zenith; }; }; - neovide = { - enable = !hostServer; - settings = { - font.normal = "AT Name Mono"; - font.size = 13; - }; - }; }; } diff --git a/users/clover/paperback/configuration.nix b/users/clover/paperback/configuration.nix index 3d94126693f8ab3136a138d8b013d6491e67fee4..87a13d7f8638f6a81a6931539129b22e07a0512c 100644 --- a/users/clover/paperback/configuration.nix +++ b/users/clover/paperback/configuration.nix @@ -1,9 +1,2 @@ _: { - homebrew = { - enable = true; - casks = [ - "eloston-chromium" - "db-browser-for-sqlite" - ]; - }; } diff --git a/users/clover/paperback/home.nix b/users/clover/paperback/home.nix index 711130f295df837f03f7c41ca2efc7cc64491798..47d88a2034872f1efc7c06355eef2e3b004436b3 100644 --- a/users/clover/paperback/home.nix +++ b/users/clover/paperback/home.nix @@ -3,7 +3,6 @@ # these programs are not globally installed to reduce distractions. # most of these are needed for my work environment. programs = { - bun.enable = true; zsh.profileExtra = '' _bun() { local context state line @@ -12,7 +11,6 @@ ''; }; home.packages = with pkgs; [ - doppler deno nodejs_22 rustup @@ -22,7 +20,5 @@ yt-dlp spotdl zig - ssm-session-manager-plugin - awscli ]; } diff --git a/users/clover/work/home.nix b/users/clover/work/home.nix new file mode 100644 index 0000000000000000000000000000000000000000..a5fb595349707f6b857c0e40e4208e08ccdeb756 --- /dev/null +++ b/users/clover/work/home.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: +{ + programs = { + zsh.profileExtra = '' + _bun() { + local context state line + _arguments -C '*:file:_files' + } + ''; + }; + home.packages = with pkgs; [ + (bun.overrideAttrs (_: rec { + version = "1.1.17"; + src = fetchurl { + url = "https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-darwin-aarch64.zip"; + hash = "sha256-aULgRZ9evcGUhKJ6slLJOg3IEzUeNfIkJF8RDP3YUlo="; + }; + })) + doppler + deno + nodejs_24 + rustup + typescript + ssm-session-manager-plugin + awscli + ]; +} diff --git a/users/fish/cattop/configuration.nix b/users/fish/cattop/configuration.nix index 66a59ef768a47e068342959655076b7c5807933f..510ebab44d3118f2dfbec63a6d960b799c4f099e 100644 --- a/users/fish/cattop/configuration.nix +++ b/users/fish/cattop/configuration.nix @@ -7,105 +7,110 @@ }: { imports = [ - # Include the results of the hardware scan. ./hardware-configuration.nix ]; - # Use the systemd-boot EFI boot loader. boot.loader.efi.canTouchEfiVariables = true; - # networking.hostName = "nixos"; # Define your hostname. - # Pick only one of the below networking options. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + networking.hostName = "cattop"; # networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. - # Set your time zone. - # time.timeZone = "Europe/Amsterdam"; - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Select internationalisation properties. - # i18n.defaultLocale = "en_US.UTF-8"; - # console = { - # font = "Lat2-Terminus16"; - # keyMap = "us"; - # useXkbConfig = true; # use xkb.options in tty. - # }; - - # Enable the X11 windowing system. services.xserver.enable = true; - # Enable the GNOME Desktop Environment. services.displayManager.gdm.enable = true; services.desktopManager.gnome.enable = true; environment.gnome.excludePackages = ( with pkgs; [ - atomix - cheese + adwaita-fonts + adwaita-icon-theme + baobab + decibels epiphany + evince + file-roller geary - gedit + gnome-backgrounds + gnome-calculator + gnome-calendar gnome-characters + gnome-clocks + gnome-connections + gnome-console + gnome-contacts + gnome-disk-utility + gnome-font-viewer + gnome-logs + gnome-maps gnome-music - gnome-photos - gnome-terminal + gnome-shell-extensions + gnome-system-monitor + gnome-screenshot + gnome-text-editor + gnome-themes-extra gnome-tour - hitori - iagno + gnome-user-docs + gnome-weather + loupe + nautilus + orca + seahorse + simple-scan + snapshot + sushi totem - + yelp ] ); - # Configure keymap in X11 - # services.xserver.xkb.layout = "us"; - # services.xserver.xkb.options = "eurosign:e,caps:escape"; - - # Enable CUPS to print documents. - # services.printing.enable = true; + services.printing.enable = true; # Enable sound. - # services.pulseaudio.enable = true; - # OR - # services.pipewire = { - # enable = true; - # pulse.enable = true; - # }; + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; # Enable touchpad support (enabled default in most desktopManager). # services.libinput.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. users.users.fish = { isNormalUser = true; extraGroups = [ - "wheel" # Enable ‘sudo’ for the user. - "dialout" # Enable serial access for the user. + "wheel" + "dialout" + "audio" ]; packages = with pkgs; [ tree git nh vim - fish ]; }; + programs.git = { + enable = true; + # extraConfig = { + # push = { + # autoSetupRemote = true; + # }; + # }; + }; programs.firefox.enable = true; - programs.neovim.defaultEditor.enable = true; + programs.neovim.enable = true; + #programs.neovim.defaultEditor.enable = true; # List packages installed in system profile. - # You can use https://search.nixos.org/ to find more packages (and options). environment.systemPackages = with pkgs; [ - vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + vim wget ]; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. programs.mtr.enable = true; programs.gnupg.agent = { enable = true; @@ -117,12 +122,6 @@ # Enable the OpenSSH daemon. # services.openssh.enable = true; - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - # Copy the NixOS configuration file and link it from the resulting system # (/run/current-system/configuration.nix). This is useful in case you # accidentally delete configuration.nix. diff --git a/users/fish/cattop/hardware-configuration.nix b/users/fish/cattop/hardware-configuration.nix index 7e98eeb8a81bcaa008732b48c6b2c13496ca1599..b16ddcb14f7da7960d16b1feb84affeece222af5 100644 --- a/users/fish/cattop/hardware-configuration.nix +++ b/users/fish/cattop/hardware-configuration.nix @@ -1,46 +1,32 @@ # 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 = [ - "xhci_pci" - "thunderbolt" - "vmd" - "nvme" - ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = { - device = "/dev/disk/by-uuid/8eb0d6a2-b8cf-4ef2-ba2a-e25a5555b0bc"; - fsType = "ext4"; - }; + fileSystems."/" = + { device = "/dev/disk/by-uuid/d434c90f-e135-426e-b237-ead2f44e37c6"; + fsType = "ext4"; + }; - fileSystems."/boot/efi" = { - device = "/dev/disk/by-uuid/3B51-4A1C"; - fsType = "vfat"; - options = [ - "fmask=0077" - "dmask=0077" + fileSystems."/boot/EFI" = + { device = "/dev/disk/by-uuid/473A-B8FD"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/e0cac471-0e32-4d5a-bf85-e8f93b304356"; } ]; - }; - - swapDevices = [ - { device = "/dev/disk/by-uuid/58ee9d19-292f-49b5-9979-341b42e8e09d"; } - ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's diff --git a/users/fish/cattop/home.nix b/users/fish/cattop/home.nix index b6c57b95e5cb64e35358d29a20134960a543f379..717ef04009d48832066d111b9c4df8fb9615b61c 100644 --- a/users/fish/cattop/home.nix +++ b/users/fish/cattop/home.nix @@ -1,13 +1,4 @@ -{ - inputs, - config, - pkgs, - lib, - userSettings, - systemSettings, - ... -}: - +{ pkgs, ... }: { home = { stateVersion = "23.05"; # Don't change this unless upgrading Home Manager versions @@ -15,17 +6,14 @@ packages = with pkgs; [ # General applications ghostty - stremio - julia - calibre - mpv signal-desktop - python3 - gh spotify + equibop # Gaming (prismlauncher.override { gamemodeSupport = true; }) + #bsdgames + space-cadet-pinball # System & desktop tools wofi @@ -37,18 +25,19 @@ ethtool grub2 efibootmgr - distrobox pqiv + imagemagick + toybox # Dev tools - legcord hyfetch - kicad - - # Unsorted + python3 + gh + cmake ripgrep - busybox - imagemagick + + # Unsorted + kicad ]; }; @@ -61,7 +50,15 @@ gitCredentialHelper.enable = true; }; - # Uncomment if you want to use MangoHud system-wide - # mangohud.enable = true; + ghostty = { + enable = true; + shader = "cursor-smear-black.glsl"; + settings = { + theme = "citruszest"; + adjust-cursor-thickness = 1; + background-opacity = 0.95; + background-blur = true; + }; + }; }; } diff --git a/users/fish/user.nix b/users/fish/user.nix index 5d8338389ba3f2abd622dc14d693e60fb71c5156..ed9ab2ccd80dd7db9b1a9d6d20c536e028b63c49 100644 --- a/users/fish/user.nix +++ b/users/fish/user.nix @@ -4,7 +4,7 @@ rec { email = "77413091+JulianBarbera@users.noreply.github.com"; # email (used for certain configurations) dotfilesDir = "~/config"; # absolute path of the local repo theme = "catppuccin-mocha"; # name of theme that stylix will use - browser = "firefox"; # Default browser; must select one from ./user/app/browser/ + browser = "zen-browser"; # Default browser; must select one from ./user/app/browser/ term = "ghostty"; # Default terminal command; font = "iosevka"; # Selected font editor = "neovim"; # Default editor; diff --git a/users/fish/vim.nix b/users/fish/vim.nix index 52c14b8cbb66a4eb826a85e044e9a453819720d1..9104cec4f818859d19d728dd01182ea540e9b9c7 100644 --- a/users/fish/vim.nix +++ b/users/fish/vim.nix @@ -1,3 +1,40 @@ -{ ... }: +{ pkgs, ... }: { + imports = [ + ./vim/default.nix + ]; + + vim = { + #enable python provider + withPython3 = true; + python3Packages = [ "pynvim" ]; + + autocmds = [ + #Autocommand to fall back to treesitter folding if LSP doesnt support it + { + event = [ "LspAttach" ]; + callback = pkgs.lib.generators.mkLuaInline '' + function(args) + local client = vim.lsp.get_client_by_id(args.data.client_id) + if client:supports_method('textDocument/foldingRange') then + local win = vim.api.nvim_get_current_win() + vim.wo[win][0].foldexpr = 'v:lua.vim.lsp.foldexpr()' + end + end + ''; + } + ]; + + tabline = { + nvimBufferline.enable = true; + }; + startPlugins = [ + "nui-nvim" + ]; + theme = { + name = "catppuccin"; + style = "mocha"; + }; + hideSearchHighlight = true; + }; } diff --git a/users/fish/vim/default.nix b/users/fish/vim/default.nix new file mode 100644 index 0000000000000000000000000000000000000000..9d7518bb41816b453399dd044663a511ba364078 --- /dev/null +++ b/users/fish/vim/default.nix @@ -0,0 +1,9 @@ +{ ... }: +{ + imports = [ + ./languages.nix + ./latex.nix + ./visuals.nix + ./mini.nix + ]; +} diff --git a/users/fish/vim/languages.nix b/users/fish/vim/languages.nix new file mode 100644 index 0000000000000000000000000000000000000000..6c370854799533d6388b8eb992df055f6df93b7a --- /dev/null +++ b/users/fish/vim/languages.nix @@ -0,0 +1,155 @@ +{ + flake, + user, + host, + pkgs, + ... +}: +{ + vim = { + extraPackages = with pkgs; [ + python312Packages.pylatexenc + ]; + languages = { + lua.lsp.enable = true; + lua.lsp.lazydev.enable = true; + python = { + format.type = "ruff"; + }; + markdown = { + enable = true; + extensions.render-markdown-nvim = { + enable = true; + }; + }; + nix = { + lsp.servers = [ + "nil" + "nixd" + ]; + }; + }; + + formatter.conform-nvim = { + enable = true; + setupOpts = { + formatters_by_ft = { + fish = [ "fish_indent" ]; + tex = [ "latexindent" ]; + }; + }; + }; + diagnostics = { + enable = true; + config = { + virtual_text = { + format = pkgs.lib.generators.mkLuaInline '' + function(diagnostic) + return string.format("%s (%s)", diagnostic.message, diagnostic.source) + end + ''; + }; + }; + nvim-lint = { + enable = true; + linters_by_ft = { + nix = [ "statix" ]; + tex = [ "chktex" ]; + haskell = [ "hlint" ]; + }; + + linters = { + chktex = { + ignore_exitcode = true; + }; + }; + }; + }; + treesitter = { + enable = true; + fold = true; + addDefaultGrammars = true; + highlight = { + additionalVimRegexHighlighting = true; + }; + + grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + markdown_inline + markdown + ]; + + highlight.enable = true; + indent.enable = false; + }; + + visuals = { + fidget-nvim = { + setupOpts = { + logger.level = "trace"; + }; + }; + }; + + ui = { + nvim-ufo = { + enable = true; + }; + }; + autocomplete.blink-cmp = { + enable = true; + mappings = { + close = null; + complete = null; + confirm = null; + next = null; + previous = null; + scrollDocsDown = null; + scrollDocsUp = null; + }; + + setupOpts = { + keymap = { + preset = "super-tab"; + }; + completion = { + ghost_text.enabled = false; + list.selection.preselect = true; + trigger = { + show_in_snippet = true; + }; + accept.auto_brackets.enabled = true; + }; + signature = { + enabled = true; + }; + }; + }; + + lazy.plugins."blink.pairs" = { + enabled = true; + package = pkgs.vimPlugins.blink-pairs; + setupModule = "blink.pairs"; + setupOpts = { + mappings = { + # -- you can call require("blink.pairs.mappings").enable() and require("blink.pairs.mappings").disable() to enable/disable mappings at runtime + enabled = true; + # -- see the defaults: https://github.com/Saghen/blink.pairs/blob/main/lua/blink/pairs/config/mappings.lua#L10 + pairs = [ ]; + }; + highlights = { + enabled = true; + groups = [ + "BlinkPairsOrange" + "BlinkPairsPurple" + "BlinkPairsBlue" + ]; + matchparen = { + enabled = true; + group = "MatchParen"; + }; + }; + debug = false; + }; + }; + }; +} diff --git a/users/fish/vim/latex.nix b/users/fish/vim/latex.nix new file mode 100644 index 0000000000000000000000000000000000000000..dd256a544add51076952ca5837f0ebc5631f0a06 --- /dev/null +++ b/users/fish/vim/latex.nix @@ -0,0 +1,118 @@ +{ pkgs, host, ... }: +{ + vim = { + extraPackages = with pkgs; [ + texliveFull + ]; + lazy.plugins.cmp-vimtex = { + enabled = true; + package = pkgs.vimPlugins.cmp-vimtex; + lazy = false; + + }; + lazy.plugins.vimtex = { + enabled = true; + package = pkgs.vimPlugins.vimtex; + lazy = false; + }; + + globals = { + tex_flavor = "latex"; + maplocalleader = "\\"; + vimtex_compiler_method = "latexmk"; + vimtex_view_method = if host.darwin then "skim" else "zathura"; + vimtex_view_automatic = 1; + vimtex_compiler_latexmk = { + callback = 1; + continuous = 1; + executable = "latexmk"; + hooks = [ ]; + options = [ + "-verbose" + "-file-line-error" + "-synctex=1" + "-interaction=nonstopmode" + "-shell-escape" + ]; + }; + vimtex_log_ignore = [ + "Underfull" + "Overfull" + "specifier changed to" + "Token not allowed in a PDF string" + ]; + vimtex_quickfix_ignore_filters = [ + "Underfull" + "Overfull" + ]; + }; + + autocomplete.blink-cmp = { + sourcePlugins = { + "blink.compat" = { + enable = true; + package = "blink-compat"; + module = "blink.compat.source"; + }; + }; + setupOpts = { + sources = { + default = [ "vimtex" ]; + providers = { + vimtex = { + name = "vimtex"; + module = "blink.compat.source"; + score_offset = 100; + }; + }; + }; + }; + }; + + augroups = [ + { + name = "VimTeX Events"; + } + ]; + autocmds = [ + { + pattern = [ "VimtexEventViewReverse" ]; + event = [ "User" ]; + desc = "Return to nvim after reverse search"; + command = "call b:vimtex.viewer.xdo_focus_vim()"; + group = "VimTeX Events"; + } + { + pattern = [ "VimtexEventQuit" ]; + event = [ "User" ]; + desc = "Close pdf after exiting nvim"; + command = "VimtexClean"; + group = "VimTeX Events"; + } + + { + pattern = [ "VimtexEventInitPost" ]; + event = [ "User" ]; + desc = "Start compiling when opening nvim to a tex file"; + command = "VimtexCompile"; + group = "VimTeX Events"; + } + + ]; + + lsp = { + servers = { + texlab = { + enable = true; + cmd = [ "${pkgs.texlab}/bin/texlab" ]; + filetypes = [ "tex" ]; + }; + }; + }; + treesitter = { + grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [ + latex + ]; + }; + }; +} diff --git a/users/fish/vim/mini.nix b/users/fish/vim/mini.nix new file mode 100644 index 0000000000000000000000000000000000000000..b8119e7ae3dd250c84ec324309d6b0cbe8d30fc2 --- /dev/null +++ b/users/fish/vim/mini.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + vim = { + mini = { + icons.enable = true; + ai.enable = true; + surround.enable = true; + }; + }; +} diff --git a/users/fish/vim/visuals.nix b/users/fish/vim/visuals.nix new file mode 100644 index 0000000000000000000000000000000000000000..09759c3e78e9e3f9522cbc0a1ed03e17e2340614 --- /dev/null +++ b/users/fish/vim/visuals.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: +{ + vim = { + ui = { + noice = { + enable = true; + setupOpts = { + lsp = { + progress.enabled = false; + signature.enabled = true; + }; + presets = { + lsp_doc_border = true; + long_message_to_split = true; + inc_rename = false; + command_palette = false; + bottom_search = true; + }; + }; + }; + borders = { + enable = true; + }; + }; + + }; +}