diff --git a/options/custom/desktops/hyprland/binds.nix b/options/custom/desktops/hyprland/binds.nix index 7720acc..f10e1ed 100644 --- a/options/custom/desktops/hyprland/binds.nix +++ b/options/custom/desktops/hyprland/binds.nix @@ -36,6 +36,7 @@ with lib; let vrr = hm.home.file.".local/bin/vrr".source; waydroid = getExe pkgs.waydroid; window = hm.home.file.".local/bin/window".source; + zeditor = getExe hm.programs.zed-editor.package; zoom = hm.home.file.".local/bin/zoom".source; command = command: "${uwsm} app -- ${command}"; @@ -198,7 +199,7 @@ in { (key "G" "Super" "togglespecialworkspace" "game") (key "G" "Super+Ctrl" "exec" steam) (key "G" "Super+Shift" "movetoworkspacesilent" "special:game") - (key "I" "Super" "exec" codium) + (key "I" "Super" "exec" zeditor) (key "K" "Super" "exec" obsidian) (key "M" "Super" "togglespecialworkspace" "music") (key "M" "Super+Shift" "movetoworkspacesilent" "special:music") diff --git a/options/custom/desktops/hyprland/rules.nix b/options/custom/desktops/hyprland/rules.nix index 4acf97f..78579f8 100644 --- a/options/custom/desktops/hyprland/rules.nix +++ b/options/custom/desktops/hyprland/rules.nix @@ -230,6 +230,7 @@ in { editor = rules: [ (class "codium" rules) # VSCode + (class "dev\\.zed\\.Zed" rules) (class "obsidian" rules) ]; diff --git a/options/custom/desktops/niri/binds.nix b/options/custom/desktops/niri/binds.nix index 948f8b9..9d294fa 100644 --- a/options/custom/desktops/niri/binds.nix +++ b/options/custom/desktops/niri/binds.nix @@ -34,6 +34,7 @@ with lib; let virt-manager = "${config.programs.virt-manager.package}/bin/virt-manager"; waydroid = "${pkgs.waydroid}/bin/waydroid"; youtube-music = "${pkgs.youtube-music}/bin/youtube-music"; + zeditor = getExe hm.programs.zed-editor.package; in { options.custom.desktops.niri.binds = { enable = mkOption {default = false;}; @@ -145,8 +146,8 @@ in { (key "F" "Mod" (spawn [nautilus "--new-window"])) (key "G" "Ctrl+Alt" (spawn [pkill "steam"])) (key "G" "Mod" (spawn steam)) - (key "I" "Ctrl+Alt" (spawn [pkill "codium"])) - (key "I" "Mod" (spawn codium)) + (key "I" "Ctrl+Alt" (spawn [pkill "zed"])) + (key "I" "Mod" (spawn zeditor)) (key "K" "Ctrl+Alt" (spawn [pkill "obsidian"])) (key "K" "Mod" (spawn obsidian)) (key "L" "Mod" (spawn [bash "-c" "${hyprlock} --immediate & ${niri} msg action power-off-monitors"])) diff --git a/options/custom/desktops/niri/rules.nix b/options/custom/desktops/niri/rules.nix index e83eefc..87174cf 100644 --- a/options/custom/desktops/niri/rules.nix +++ b/options/custom/desktops/niri/rules.nix @@ -149,6 +149,7 @@ in { # IDEs matches = [ {app-id = "^codium$";} + {app-id = "^dev\.zed\.Zed$";} ]; default-column-width.proportion = diff --git a/options/custom/desktops/sway/binds.nix b/options/custom/desktops/sway/binds.nix index cee635f..6737104 100644 --- a/options/custom/desktops/sway/binds.nix +++ b/options/custom/desktops/sway/binds.nix @@ -54,6 +54,7 @@ with lib; let wlfreerdp = "${pkgs.freerdp}/bin/wlfreerdp"; wofi = "${config.home-manager.users.${config.custom.username}.programs.wofi.package}/bin/wofi"; xfreerdp = "${pkgs.freerdp}/bin/xfreerdp"; + zeditor = getExe hm.programs.zed-editor.package; cfg = config.custom.desktops.sway.binds; in { @@ -153,7 +154,7 @@ in { "backspace+${super}+${shift}" = "floating toggle"; "bracketleft+${super}" = "layout toggle tabbed stacking"; "bracketright+${super}" = "layout toggle split"; - "c+${super}" = "exec ${codium}"; + "c+${super}" = "exec ${zeditor}"; "delete+${super}" = "exec inhibit"; "delete+${super}+${shift}" = "exec vrr"; "down+${super}" = "move down"; diff --git a/options/custom/menus/walker/search.sh b/options/custom/menus/walker/search.sh index d24a3e3..c8be6ba 100644 --- a/options/custom/menus/walker/search.sh +++ b/options/custom/menus/walker/search.sh @@ -254,6 +254,12 @@ case "$1" in url="https://www.youtube.com/results?search_query=" query="${1:2}" ;; + 'zi '*) + label="Zed Issues" + icon="com.github.zren.bugzilla" + url="https://github.com/zed-industries/zed/issues?q=is%3Aissue+is%3Aopen+" + query="${1:3}" + ;; *) exit # label="Search" diff --git a/options/custom/programs/chromium.nix b/options/custom/programs/chromium.nix index e17faae..5f895da 100644 --- a/options/custom/programs/chromium.nix +++ b/options/custom/programs/chromium.nix @@ -315,6 +315,12 @@ in { shortcut = "y"; url = "https://www.youtube.com/results?search_query={searchTerms}"; } + + { + name = "Zed Issues"; + shortcut = "zi"; + url = "https://github.com/zed-industries/zed/issues?q=is%3Aissue+is%3Aopen+{searchTerms}"; + } ]; }; }; diff --git a/options/custom/programs/firefox/.common.nix b/options/custom/programs/firefox/.common.nix index 2fee019..09b7ea3 100644 --- a/options/custom/programs/firefox/.common.nix +++ b/options/custom/programs/firefox/.common.nix @@ -522,6 +522,12 @@ with lib; { iconUpdateURL = "https://www.youtube.com/s/desktop/f8c8418d/img/favicon.ico"; urls = [{template = "https://www.youtube.com/results?search_query={searchTerms}";}]; }; + + "Zed Issues" = { + definedAliases = ["zi"]; + iconUpdateURL = "https://github.com/favicon.ico"; + urls = [{template = "https://github.com/zed-industries/zed/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";}]; + }; }; }; }; diff --git a/options/custom/programs/vscode.nix b/options/custom/programs/vscode.nix index af694a5..f3b8e37 100644 --- a/options/custom/programs/vscode.nix +++ b/options/custom/programs/vscode.nix @@ -17,21 +17,9 @@ in { # https://github.com/nix-community/nix-vscode-extensions nixpkgs.overlays = [inputs.nix-vscode-extensions.overlays.default]; - environment = { - sessionVariables = { - # https://github.com/nix-community/nixd/blob/main/nixd/docs/features.md - NIXD_FLAGS = "--inlay-hints=false"; # Disable package versions in the editor - }; - - # Extension dependencies - systemPackages = with pkgs; [ - alejandra # nix-ide - blueprint-compiler # blueprint-gtk - caddy # caddyfile-support - nixd # nix-ide - powershell # powershell - shfmt # shell-format - ]; + environment.sessionVariables = { + # https://github.com/nix-community/nixd/blob/main/nixd/docs/features.md + NIXD_FLAGS = "--inlay-hints=false"; # Disable package versions in the editor }; home-manager.sharedModules = mkIf cfg.enable [ diff --git a/options/custom/programs/zed.nix b/options/custom/programs/zed.nix deleted file mode 100644 index b194e63..0000000 --- a/options/custom/programs/zed.nix +++ /dev/null @@ -1,233 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -with lib; let - cfg = config.custom.programs.zed; -in { - options.custom.programs.zed = { - enable = mkOption {default = false;}; - }; - - config = mkIf cfg.enable { - home-manager.sharedModules = [ - { - # https://zed.dev/ - # https://github.com/zed-industries/zed - programs.zed-editor = { - enable = true; - - extraPackages = with pkgs; [ - alejandra # nix - nixd # nix - shellcheck # basher - shfmt # basher - ]; - - # https://zed.dev/docs/extensions - # https://github.com/zed-industries/extensions/tree/main/extensions - extensions = [ - "basher" # https://github.com/d1y/bash.zed - "git-firefly" # https://github.com/d1y/git_firefly - "nix" # https://github.com/zed-extensions/nix - ]; - - # https://zed.dev/docs/key-bindings - userKeymaps = [ - { - bindings = { - "alt-space" = "command_palette::Toggle"; - }; - } - { - context = "Editor"; - - bindings = { - "alt-enter" = "editor::DuplicateLineDown"; - "alt-left" = "editor::MoveToBeginningOfLine"; - "alt-right" = "editor::MoveToEndOfLine"; - }; - } - ]; - - # https://zed.dev/docs/configuring-zed - userSettings = { - always_treat_brackets_as_autoclosed = true; - - assistant = { - default_model = { - model = "claude-3-5-sonnet-latest"; - provider = "zed.dev"; - }; - - version = 2; - }; - - auto_install_extensions = false; - auto_signature_help = true; - - # BUG: Font variations are not currently supported - # https://github.com/zed-industries/zed/issues/5028 - #// buffer_font_family = "monospace"; - buffer_font_family = "IosevkaTermSlab Nerd Font Propo"; - - buffer_font_size = 18; - buffer_line_height.custom = 1.5; - - collaboration_panel = { - button = false; - dock = "right"; - }; - - cursor_blink = false; - - features = { - inline_completion_provider = "none"; - }; - - git = { - inline_blame.enabled = false; - }; - - indent_guides = { - active_line_width = 2; - }; - - load_direnv = "shell_hook"; - middle_click_paste = false; - - outline_panel = { - dock = "right"; - indent_size = 10; - }; - - preferred_line_length = 120; - - project_panel = { - default_width = 200; - indent_guides.show = "never"; - indent_size = 10; - }; - - seed_search_query_from_cursor = "selection"; - show_user_picture = false; - - # TODO: Show trailing whitespace when supported - # https://github.com/zed-industries/zed/issues/5237 - show_whitespaces = "selection"; - - soft_wrap = "preferred_line_length"; - tab_size = 2; - - tabs = { - file_icons = true; - git_status = true; - show_diagnostics = "all"; - }; - - telemetry = { - metrics = true; - diagnostics = true; - }; - - theme = { - mode = "system"; - light = "NeoSolarized Light"; - dark = "NeoSolarized Dark"; - }; - - ui_font_family = config.stylix.fonts.sansSerif.name; - ui_font_size = 20; - - # Language-specific - # https://zed.dev/docs/configuring-languages - languages = { - Nix = { - formatter.external.command = "alejandra"; - language_servers = ["nixd" "!nil"]; - }; - }; - - # TODO: Add missing syntax in highlights.scm - # Theme overrides - # https://zed.dev/docs/themes#theme-overrides - # https://zed.dev/docs/extensions/languages#syntax-highlighting - # https://github.com/zed-industries/zed/blob/main/assets/themes/solarized/solarized.json - # https://github.com/zed-industries/zed/issues/20525 - #?? editor: copy highlight json - "experimental.theme_overrides" = { - # https://github.com/zed-industries/zed/issues/4655 - players = [ - { - cursor = "#93a1a1"; - background = "#93a1a1"; - selection = "#93a1a11a"; # 10% - } - ]; - - "scrollbar.thumb.background" = "#073642"; - "scrollbar.thumb.border" = "#00000000"; - - syntax = { - "_expr".color = "#b58900"; - "_id".color = "#93a1a1"; - "attribute".color = "#93a1a1"; - "boolean".color = "#cb4b16"; - "comment".color = "#586e75"; - "comment.doc".color = "#586e75"; - "constant".color = "#93a1a1"; - "constant.builtin".color = "#93a1a1"; - "constructor".color = "#b58900"; - "embedded".color = "#657b83"; - "emphasis".color = "#93a1a1"; - "emphasis.strong".color = "#93a1a1"; - "enum".color = "#b58900"; - "function".color = "#268bd2"; - "function.builtin".color = "#268bd2"; - "function.call".color = "#268bd2"; - "hint".color = "#657b83"; - "keyword".color = "#d33682"; - "keyword.exception".color = "#d33682"; - "label".color = "#93a1a1"; - "link_text".color = "#93a1a1"; - "link_uri".color = "#93a1a1"; - "number".color = "#2aa198"; - "operator".color = "#657b83"; - "predictive".color = "#657b83"; - "preproc".color = "#93a1a1"; - "primary".color = "#93a1a1"; - "property".color = "#93a1a1"; - "punctuation".color = "#657b83"; - "punctuation.bracket".color = "#657b83"; - "punctuation.delimiter".color = "#657b83"; - "punctuation.list_marker".color = "#657b83"; - "punctuation.special".color = "#657b83"; - "string".color = "#859900"; - "string.escape".color = "#cb4b16"; - "string.regex".color = "#cb4b16"; - "string.special".color = "#cb4b16"; - "string.special.symbol".color = "#cb4b16"; - "tag".color = "#93a1a1"; - "tag.doctype".color = "#93a1a1"; - "text.literal".color = "#93a1a1"; - "title".color = "#93a1a1"; - "type".color = "#b58900"; - "variable".color = "#93a1a1"; - "variable.member".color = "#93a1a1"; - "variable.parameter".color = "#6c71c4"; - "variable.special".color = "#93a1a1"; - "variant".color = "#93a1a1"; - }; - }; - }; - }; - - # TODO: Use stylix - # https://stylix.danth.me/options/modules/zed.html - stylix.targets.zed.enable = false; - } - ]; - }; -} diff --git a/options/custom/programs/zed/default.nix b/options/custom/programs/zed/default.nix new file mode 100644 index 0000000..45f9778 --- /dev/null +++ b/options/custom/programs/zed/default.nix @@ -0,0 +1,365 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.custom.programs.zed; +in { + options.custom.programs.zed = { + enable = mkOption {default = false;}; + }; + + config = mkIf cfg.enable { + home-manager.sharedModules = [ + { + # https://zed.dev/ + # https://github.com/zed-industries/zed + programs.zed-editor = { + enable = true; + + # https://zed.dev/docs/extensions + # https://github.com/zed-industries/extensions/tree/main/extensions + extensions = [ + #// "basedpyright" # https://github.com/m1guer/basedpyright-zed + "basher" # https://github.com/d1y/bash.zed + "caddyfile" # https://github.com/nusnewob/caddyfile-zed + "colored-zed-icons-theme" # https://github.com/TheRedXD/zed-icons-colored-theme + "csv" # https://github.com/huacnlee/zed-csv + "discord-presence" # https://github.com/xhyrom/zed-discord-presence + "docker-compose" # https://github.com/eth0net/zed-docker-compose + "dockerfile" # https://github.com/d1y/dockerfile.zed + "env" # https://github.com/zarifpour/zed-env + "fish" # https://github.com/hasit/zed-fish + "git-firefly" # https://github.com/d1y/git_firefly + "html" # https://github.com/zed-industries/zed/tree/main/extensions/html + "ini" # https://github.com/bajrangCoder/zed-ini + "java" # https://github.com/zed-extensions/java + "jinja2" # https://github.com/ArcherHume/jinja2-support + "make" # https://github.com/caius/zed-make + "material-icon-theme" # https://github.com/zed-extensions/material-icon-theme + "nginx" # https://github.com/d1y/nginx-zed + "nix" # https://github.com/zed-extensions/nix + "nu" # https://github.com/zed-extensions/nu + "php" # https://github.com/zed-extensions/php + "powershell" # https://github.com/wingyplus/zed-powershell + "pylsp" # https://github.com/rgbkrk/python-lsp-zed-extension + "scss" # https://github.com/bajrangCoder/zed-scss + "sql" # https://github.com/zed-extensions/sql + "svelte" # https://github.com/zed-extensions/svelte + "tmux" # https://github.com/dangh/zed-tmux + "unocss" # https://github.com/bajrangCoder/zed-unocss + "xml" # https://github.com/sweetppro/zed-xml + ]; + + # https://zed.dev/docs/key-bindings + userKeymaps = [ + { + # Global keybinds + bindings = { + "alt-\\" = "workspace::ToggleBottomDock"; + "alt-a" = "assistant::ToggleFocus"; + "alt-c" = "collab_panel::ToggleFocus"; + "alt-f" = "project_search::ToggleFocus"; + "alt-g" = "git_panel::ToggleFocus"; + "alt-p" = "project_panel::ToggleFocus"; + "alt-t" = "terminal_panel::ToggleFocus"; + + "alt-escape" = "workspace::CloseAllDocks"; + "alt-space" = "command_palette::Toggle"; + "alt-tab" = "workspace::ToggleLeftDock"; + + "alt-shift-tab" = "workspace::ToggleRightDock"; + }; + } + { + # Editor keybinds + context = "Editor"; + + bindings = { + "alt-backspace" = "editor::DeleteLine"; + "alt-enter" = "editor::DuplicateLineDown"; + "alt-left" = "editor::MoveToBeginningOfLine"; + "alt-right" = "editor::MoveToEndOfLine"; + "ctrl-enter" = "editor::NewlineBelow"; + + "alt-shift-enter" = "editor::DuplicateLineUp"; + }; + } + { + # Terminal keybinds + # https://zed.dev/docs/key-bindings#forward-keys-to-terminal + context = "Terminal"; + + bindings = { + "ctrl-s" = ["terminal::SendKeystroke" "ctrl-s"]; + }; + } + ]; + + # https://zed.dev/docs/configuring-zed + userSettings = { + always_treat_brackets_as_autoclosed = true; + + assistant = { + default_model = { + model = "gemma3:1b"; + provider = "ollama"; + }; + + default_width = 500; + version = "2"; + }; + + auto_install_extensions = false; + auto_signature_help = true; + base_keymap = "VSCode"; + + # BUG: Font variations are not currently supported + # https://github.com/zed-industries/zed/issues/5028 + #// buffer_font_family = "monospace"; + buffer_font_family = mkForce "IosevkaTermSlab Nerd Font Propo"; + + buffer_line_height.custom = 1.5; + + chat_panel = { + default_width = 300; + }; + + collaboration_panel = { + button = false; + default_width = 300; + dock = "right"; + }; + + cursor_blink = false; + + features = { + inline_completion_provider = "none"; + }; + + git = { + inline_blame.enabled = false; + }; + + git_panel = { + default_width = 300; + }; + + icon_theme = "Colored Zed Icons Theme Dark"; + + indent_guides = { + active_line_width = 2; + }; + + load_direnv = "shell_hook"; + middle_click_paste = false; + + notification_panel = { + default_width = 300; + }; + + outline_panel = { + default_width = 300; + dock = "right"; + indent_size = 10; + }; + + preferred_line_length = 120; + + project_panel = { + auto_reveal_entries = false; + default_width = 300; + entry_spacing = "standard"; + indent_guides.show = "never"; + indent_size = 10; + scrollbar.show = "never"; + }; + + seed_search_query_from_cursor = "selection"; + show_user_picture = false; + + # TODO: Show trailing whitespace when supported + # https://github.com/zed-industries/zed/issues/5237 + show_whitespaces = "selection"; + + #// soft_wrap = "preferred_line_length"; + tab_size = 2; + + tabs = { + git_status = true; + show_diagnostics = "all"; + }; + + telemetry = { + metrics = true; + diagnostics = true; + }; + + terminal = { + line_height = "standard"; + }; + + ui_font_size = mkForce 18; + + # Language-specific + # https://zed.dev/docs/configuring-languages + languages = { + Nix = { + formatter.external.command = "alejandra"; + language_servers = ["nil" "!nixd"]; + }; + }; + + # https://zed.dev/docs/configuring-languages#configuring-language-servers + lsp = { + nil.initialization_options = { + nix.flake.autoArchive = true; + }; + }; + + # TODO: Add missing syntax in highlights.scm + # Theme overrides + # https://zed.dev/docs/themes#theme-overrides + # https://zed.dev/docs/extensions/languages#syntax-highlighting + # https://github.com/zed-industries/zed/issues/20525 + # https://github.com/zed-industries/zed/blob/main/assets/themes/one/one.json + # https://github.com/zed-industries/zed/blob/main/assets/themes/solarized/solarized.json + # https://github.com/tinted-theming/schemes/blob/spec-0.11/base16/solarized-dark.yaml + #?? editor: copy highlight json + "experimental.theme_overrides" = with config.lib.stylix.colors; { + ### Styles + "background" = "#${base01}"; + "border" = "#${base00}"; + "border.variant" = "#${base00}"; + "editor.active_wrap_guide" = "#${base01}"; + "editor.document_highlight.read_background" = "#${base01}"; + "editor.document_highlight.write_background" = "#${base01}"; + "editor.invisible" = "#${base03}"; + "editor.wrap_guide" = "#${base01}"; + + # TODO: Submit PR to fix + # BUG: (ghost_)element is incorrectly defined as nested objects instead of strings + # https://github.com/tinted-theming/base16-zed/blob/main/templates/default.mustache + "element.active" = "#${base03}20"; + "element.background" = "#${base00}00"; + "element.disabled" = "#${base03}"; + "element.hover" = "#${base03}10"; + "element.selected" = "#${base03}40"; + "ghost_element.active" = "#${base03}20"; + "ghost_element.background" = "#${base00}00"; + "ghost_element.disabled" = "#${base03}"; + "ghost_element.hover" = "#${base03}10"; + "ghost_element.selected" = "#${base03}40"; + + "icon.accent" = "#${base0F}"; + "panel.background" = "#${base01}"; + "panel.focused_border" = "#${base0F}"; + "scrollbar.thumb.background" = "#${base03}40"; + "scrollbar.thumb.border" = "#${base03}00"; + "scrollbar.thumb.hover_background" = "#${base03}"; + "search.match_background" = "#${base03}40"; + "status_bar.background" = "#${base00}"; + "tab.active_background" = "#${base00}"; + "tab.inactive_background" = "#${base01}"; + "tab_bar.background" = "#${base01}"; + "text.accent" = "#${base0F}"; + "title_bar.background" = "#${base00}"; + "title_bar.inactive_background" = "#${base00}"; + + ### Status + "conflict" = "#${base09}"; + "conflict.background" = "#${base09}d3"; + "conflict.border" = "#${base09}"; + + ### Cursors + "players" = [ + { + "cursor" = "#${base05}"; + "background" = "#${base05}40"; + "selection" = "#${base05}20"; + } + ]; + + ### Syntax highlighting + "syntax" = { + "_expr".color = "#${base0A}"; + "_id".color = "#${base05}"; + "attribute".color = "#${base05}"; + "boolean".color = "#${base09}"; + "comment".color = "#${base02}"; + "comment.doc".color = "#${base02}"; + "constant".color = "#${base05}"; + "constant.builtin".color = "#${base05}"; + "constructor".color = "#${base0A}"; + "directive".color = "#${base05}"; + "embedded".color = "#${base03}"; + "emphasis".color = "#${base05}"; + "emphasis.strong".color = "#${base05}"; + "enum".color = "#${base0A}"; + "escape".color = "#${base09}"; + "function".color = "#${base0D}"; + "function.builtin".color = "#${base0D}"; + "function.call".color = "#${base0D}"; + "function.decorator".color = "#${base0D}"; + "function.magic".color = "#${base0D}"; + "hint".color = "#${base03}"; + "keyword".color = "#${base0F}"; + "keyword.exception".color = "#${base0F}"; + "label".color = "#${base05}"; + "link_text".color = "#${base05}"; + "link_uri".color = "#${base05}"; + "local".color = "#${base05}"; + "markup".color = "#${base05}"; + "meta".color = "#${base05}"; + "modifier".color = "#${base05}"; + "namespace".color = "#${base05}"; + "number".color = "#${base0C}"; + "operator".color = "#${base03}"; + "parameter".color = "#${base0E}"; + "predictive".color = "#${base03}"; + "preproc".color = "#${base05}"; + "primary".color = "#${base05}"; + "property".color = "#${base05}"; + "punctuation".color = "#${base03}"; + "punctuation.bracket".color = "#${base03}"; + "punctuation.delimiter".color = "#${base03}"; + "punctuation.list_marker".color = "#${base03}"; + "punctuation.special".color = "#${base03}"; + "regexp".color = "#${base09}"; + "self".color = "#${base05}"; + "string".color = "#${base0B}"; + "string.escape".color = "#${base09}"; + "string.regex".color = "#${base09}"; + "string.special".color = "#${base09}"; + "string.special.symbol".color = "#${base09}"; + "strong".color = "#${base05}"; + "support".color = "#${base05}"; + "symbol".color = "#${base05}"; + "tag".color = "#${base05}"; + "tag.doctype".color = "#${base05}"; + "text".color = "#${base05}"; + "text.literal".color = "#${base05}"; + "title".color = "#${base05}"; + "type".color = "#${base0A}"; + "variable".color = "#${base05}"; + "variable.member".color = "#${base05}"; + "variable.parameter".color = "#${base0E}"; + "variable.special".color = "#${base05}"; + "variant".color = "#${base05}"; + }; + }; + }; + }; + + # BUG: Language-specific snippets break with certain files, so use global snippets.json + # https://github.com/zed-industries/zed/issues/22726 + # https://zed.dev/docs/snippets + #?? snippets: configure snippets + xdg.configFile = { + "zed/snippets/".source = ./snippets; + }; + } + ]; + }; +} diff --git a/options/custom/programs/zed/snippets/nix.json b/options/custom/programs/zed/snippets/nix.json new file mode 100644 index 0000000..2e64c71 --- /dev/null +++ b/options/custom/programs/zed/snippets/nix.json @@ -0,0 +1,135 @@ +{ + "Home Manager Option": { + "prefix": "ho", + "body": [ + "{", + " config,", + " lib,", + " ...", + "}:", + "with lib; let", + " cfg = config.custom.$1;", + " hm = config.home-manager.users.\\${config.custom.username};", + "in {", + " options.custom.$1 = {", + " enable = mkOption {default = false;};", + " };", + "", + " config = mkIf cfg.enable {", + " home-manager.sharedModules = [", + " {", + " $0", + " }", + " ];", + " };", + "}" + ] + }, + + "NixOS Agenix": { + "prefix": "na", + "body": [ + "age.secrets =", + " let", + " secret = filename: {", + " file = \"\\${inputs.self}/secrets/\\${filename}\";", + " };", + " in", + " {", + " \"$1\" = secret \"$1\";", + " };" + ] + }, + + "NixOS Container Arion": { + "prefix": "nca", + "body": [ + "{", + " config,", + " inputs,", + " lib,", + " ...", + "}:", + "with lib; let", + " cfg = config.custom.containers.$1;", + "in {", + " options.custom.containers.$1 = {", + " enable = mkOption {default = false;};", + " };", + "", + " config = mkIf cfg.enable {", + " age.secrets = let", + " secret = filename: {", + " file = \"\\${inputs.self}/secrets/\\${filename}\";", + " };", + " in {", + " \"\\${config.custom.profile}/$1/.env\" = secret \"\\${config.custom.profile}/$1/.env\";", + " };", + "", + " #?? arion-$1 pull", + " environment.shellAliases.arion-$1 = \"sudo arion --prebuilt-file \\${config.virtualisation.arion.projects.$1.settings.out.dockerComposeYaml}\";", + "", + " virtualisation.arion.projects.$1.settings.services = {", + " $1.service = {", + " container_name = \"$1\";", + " depends_on = [\"\"];", + " env_file = [config.age.secrets.\"\\${config.custom.profile}/$1/.env\".path];", + " image = \"$1\";", + " ports = [\"\"];", + " restart = \"unless-stopped\";", + " volumes = [\"\\${config.custom.containers.directory}/$1/data:/data\"];", + " };", + " };", + " };", + "}" + ] + }, + + "Nix Develop": { + "prefix": "nd", + "body": [ + "{", + " inputs = {", + " nixpkgs.url = \"github:NixOS/nixpkgs/nixos-24.05\";", + " };", + "", + " outputs =", + " inputs:", + " let", + " system = \"x86_64-linux\";", + " pkgs = inputs.nixpkgs.legacyPackages.\\${system};", + " in", + " {", + " #?? nix develop", + " devShells.\\${system}.default = pkgs.mkShell {", + " inputsFrom = [ ];", + " packages = [ ];", + " shellHook = '''';", + " };", + " };", + "}" + ] + }, + + "NixOS Option": { + "prefix": "no", + "body": [ + "{", + " config,", + " lib,", + " ...", + "}:", + "with lib; let", + " cfg = config.custom.$1;", + "in {", + " options.custom.$1 = {", + " enable = mkOption {default = false;};", + " };", + "", + " config = mkIf cfg.enable {", + " $0", + " };", + "}" + ] + } +} diff --git a/options/custom/programs/zed/snippets/shell script.json b/options/custom/programs/zed/snippets/shell script.json new file mode 100644 index 0000000..22e79ca --- /dev/null +++ b/options/custom/programs/zed/snippets/shell script.json @@ -0,0 +1,18 @@ +{ + "Shell Bash Argc": { + "prefix": "sba", + "body": [ + "#! /usr/bin/env bash", + "", + "# @describe $1", + "#", + "# https://github.com/sigoden/argc", + "", + "# @meta combine-shorts", + "", + "$0", + "", + "eval \"\\$(argc --argc-eval \"\\$0\" \"\\$@\")\"" + ] + } +} diff --git a/options/custom/settings/packages.nix b/options/custom/settings/packages.nix index 86daec0..b7614ba 100644 --- a/options/custom/settings/packages.nix +++ b/options/custom/settings/packages.nix @@ -24,6 +24,8 @@ in { ]) ++ optionals config.custom.default [ alejandra # Nix formatter + blueprint-compiler # GTK markup language + caddy # Reverse proxy fd # File finder fzf # Fuzzy search inetutils # Network utilities @@ -32,14 +34,20 @@ in { lf # Terminal file manager lm_sensors # System sensors lz4 # Compression utility + nil # Nix language server nix-output-monitor # Nix build parser nix-tree # Nix store explorer + nixd # Nix language server nmap # Network scanner nvd # Nix diff viewer openssl # Certificate utility + powershell # Windows shell progress # Coreutils progress viewer q # DNS tester rclone # File sync + shellcheck # Script analysis tool + shfmt # Script formatter + simple-completion-language-server # Snippet language server sshpass # SSH automation stress # CPU stress tester testdisk # Data recovery tool