From d8b632ac70215b76b3597c42a2279072518c3455 Mon Sep 17 00:00:00 2001 From: Ethan Reece Date: Thu, 17 Jul 2025 15:05:24 -0500 Subject: [PATCH] Separate base from asahi-specific configuration --- .envrc | 3 +- home-manager/asahi/default.nix | 1 + home-manager/asahi/home.nix | 466 +------------------------------ home-manager/base.nix | 485 +++++++++++++++++++++++++++++++++ home-manager/raspi/default.nix | 24 ++ 5 files changed, 516 insertions(+), 463 deletions(-) create mode 100644 home-manager/base.nix create mode 100644 home-manager/raspi/default.nix diff --git a/.envrc b/.envrc index 82db77f..0536d61 100644 --- a/.envrc +++ b/.envrc @@ -4,6 +4,5 @@ watch_dir ./sops watch_file ./home-manager/default.nix -watch_file ./home-manager/profiles/default.nix -watch_file ./home-manager/profiles/*/default.nix +watch_file ./home-manager/*/default.nix use flake diff --git a/home-manager/asahi/default.nix b/home-manager/asahi/default.nix index f4914a9..4950b82 100644 --- a/home-manager/asahi/default.nix +++ b/home-manager/asahi/default.nix @@ -16,6 +16,7 @@ inputs.sops-nix.homeManagerModules.sops inputs.stylix.homeModules.stylix inputs.catppuccin.homeModules.catppuccin + ../base.nix ./home.nix ]; } diff --git a/home-manager/asahi/home.nix b/home-manager/asahi/home.nix index 9c4cf48..bdffb3c 100644 --- a/home-manager/asahi/home.nix +++ b/home-manager/asahi/home.nix @@ -12,58 +12,17 @@ let username = "sudoer777"; - localFastModel = "qwen2.5-coder-num_ctx"; - localReasoningModel = "deepseek-r1-num_ctx"; - remoteFastModel = "deepseek/deepseek-chat-v3-0324:free"; # "qwen/qwen-2.5-coder-32b-instruct:free"; - remoteReasoningModel = "deepseek/deepseek-r1-0528:free"; in { - sops = { - secrets = { - openrouter_api_key = { }; - }; - defaultSopsFile = ../../sops/secrets.yaml; - age.keyFile = /home/${username}/.config/sops/age/keys.txt; - }; + sops.age.keyFile = /home/${username}/.config/sops/age/keys.txt; # https://nix.catppuccin.com/search/rolling/ catppuccin = { - enable = true; - flavor = "mocha"; floorp.profiles.default.force = true; }; # https://nix-community.github.io/stylix/options/modules/alacritty.html - stylix = { - enable = true; - base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; - image = config.lib.stylix.pixel "base0A"; - polarity = "dark"; - fonts = { - serif = { - package = pkgs.libertinus; - name = "Libertinus Serif"; - }; - sansSerif = { - package = pkgs.inter; - name = "Inter"; - }; - monospace = { - package = pkgs.nerd-fonts.jetbrains-mono; - name = "JetBrains Mono Nerd Font"; - }; - emoji = { - package = pkgs.openmoji-color; - name = "OpenMoji Color"; - }; - }; - targets = { - bat.enable = false; - floorp = { - profileNames = [ "default" ]; - }; - fzf.enable = false; - helix.enable = false; - kitty.variant256Colors = true; - starship.enable = false; + stylix.targets = { + floorp = { + profileNames = [ "default" ]; }; }; nixGL = { @@ -77,76 +36,36 @@ in vulkan.enable = true; }; home = { - stateVersion = "24.11"; username = username; - homeDirectory = "/home/sudoer777"; + homeDirectory = "/home/${username}"; language.base = "eo.utf8"; packages = [ - pkgs.acpi pkgs.bitwarden-desktop # TODO: switch to rbw - pkgs.bzip3 # pkgs.cacert - TODO: should be used on NixOS # pkgs.cups - TODO: should be used on NixOS - pkgs.curl pkgs.dino - pkgs.e2fsprogs pkgs.element-desktop # TODO: switch to programs.element-desktop - pkgs.file # pkgs.firefox # pkgs.firefoxpwa - requires system access - pkgs.gzip - pkgs.gnutar # pkgs.high-tide - doesn't work - pkgs.iproute2 - pkgs.iputils - pkgs.julia (config.lib.nixGL.wrap pkgs.kdePackages.audiotube) pkgs.kdePackages.dolphin pkgs.kdePackages.falkon # pkgs.ladybird - # pkgs.languagetool - TODO: should be used on NixOS pkgs.libreoffice-fresh pkgs.librewolf # TODO: switch to programs.librewolf - pkgs.lm_sensors pkgs.logseq # TODO: switch to joplin-desktop - pkgs.lsof - pkgs.mailutils pkgs.mupdf - # pkgs.ncurses - pkgs.nixd - pkgs.pijul - pkgs.procps # TODO: switch to uutils when available - pkgs.procs - pkgs.psmisc pkgs.signal-desktop # pkgs.simplex-chat-desktop - not available on aarch64 # pkgs.slacky - doesn't work, requires update - pkgs.speedtest-cli - pkgs.strace - # pkgs.sudo-rs - TODO: should be used on NixOS - pkgs.tcpdump pkgs.teams-for-linux # TODO: Move to flake in UTD folder pkgs.telegram-desktop # pkgs.tidal-hifi - aarch64 build broken - pkgs.util-linux # TODO: switch to uutils when available - pkgs.uutils-coreutils-noprefix - pkgs.uutils-diffutils - pkgs.uutils-findutils # pkgs.widevine-cdm - doesn't work - pkgs.wget - pkgs.xz ]; - file = { }; - shell = { - enableNushellIntegration = true; - enableZshIntegration = true; - enableFishIntegration = true; - }; }; programs = { - home-manager = { - enable = true; - }; chromium = { enable = true; }; @@ -174,247 +93,13 @@ in # zathura = { # enable = true; # }; - man = { - enable = true; - }; - # TODO: Disable Guix integration - # password-store = { - # enable = true; - # }; - bat = { - enable = true; - }; - nix-your-shell = { - enable = true; - }; wezterm = { enable = true; package = (config.lib.nixGL.wrap pkgs.wezterm); }; - fzf = { - enable = true; - }; - vim = { - enable = true; - }; yt-dlp = { enable = true; }; - helix = { - enable = true; - defaultEditor = true; - settings = { - editor.soft-wrap = { - enable = true; - }; - }; - }; - nushell = { - enable = true; - environmentVariables = { - OPENROUTER_API_KEY = lib.hm.nushell.mkNushellInline "cat ${config.sops.secrets.openrouter_api_key.path}"; - }; - settings = { - completions = { - algorithm = "fuzzy"; - case_sensitive = false; - external = { - enable = true; - }; - }; - }; - # set -x ZATHURA_PLUGINS_PATH $GUIX_HOME/lib/zathura - shellAliases = { - aichat_reasoning_remote = "${pkgs.aichat}/bin/aichat --model openrouter:${remoteReasoningModel}"; - aichat_reasoning_local = "${pkgs.aichat}/bin/aichat --model ollama:${localReasoningModel}"; - aichat_fast_remote = "${pkgs.aichat}/bin/aichat --model openrouter:${remoteFastModel}"; - aichat_fast_local = "${pkgs.aichat}/bin/aichat --model ollama:${localFastModel}"; - codex_remote = "${pkgs.codex}/bin/codex --provider openrouter --model ${remoteFastModel}"; - codex_local = "${pkgs.codex}/bin/codex --provider ollama --model ${localFastModel}"; - hotspot = "sudo sysctl net.ipv4.ip_default_ttl=65"; - }; - }; - starship = { - enable = true; - settings = { - format = - "[](red)" - + "$os" - + "$username" - + "[](bg:peach fg:red)" - + "$directory" - + "[](bg:yellow fg:peach)" - + "$git_branch" - + "$git_status" - + "[](fg:yellow bg:green)" - + "$c" - + "$rust" - + "$golang" - + "$nodejs" - + "$php" - + "$java" - + "$kotlin" - + "$haskell" - + "$python" - + "[](fg:green bg:sapphire)" - + "$conda" - + "$nix_shell" - + "[](fg:sapphire bg:lavender)" - + "$time" - + "[ ](fg:lavender)" - + "$cmd_duration" - + "$line_break" - + "$character"; - os = { - disabled = false; - style = "bg:red fg:crust"; - symbols = { - Windows = ""; - Ubuntu = "󰕈"; - SUSE = ""; - Raspbian = "󰐿"; - Mint = "󰣭"; - Macos = "󰀵"; - Manjaro = ""; - Linux = "󰌽"; - Gentoo = "󰣨"; - Fedora = "󰣛"; - Alpine = ""; - Amazon = ""; - Android = ""; - Arch = "󰣇"; - Artix = "󰣇"; - CentOS = ""; - Debian = "󰣚"; - Redhat = "󱄛"; - RedHatEnterprise = "󱄛"; - NixOS = ""; - }; - }; - username = { - show_always = true; - style_user = "bg:red fg:crust"; - style_root = "bg:red fg:crust"; - format = ''[ $user]($style)''; - }; - directory = { - style = "bg:peach fg:crust"; - format = "[ $path ]($style)"; - truncation_length = 3; - truncation_symbol = "…/"; - substitutions = { - "Documents" = "󰈙 "; - "Downloads" = " "; - "Music" = "󰝚 "; - "Pictures" = " "; - "Developer" = "󰲋 "; - }; - }; - git_branch = { - symbol = ""; - style = "bg:yellow"; - format = ''[[ $symbol $branch ](fg:crust bg:yellow)]($style)''; - }; - git_status = { - style = "bg:yellow"; - format = ''[[($all_status$ahead_behind )](fg:crust bg:yellow)]($style)''; - }; - nodejs = { - symbol = ""; - style = "bg:green"; - format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; - }; - c = { - symbol = " "; - style = "bg:green"; - format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; - }; - rust = { - symbol = ""; - style = "bg:green"; - format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; - }; - golang = { - symbol = ""; - style = "bg:green"; - format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; - }; - php = { - symbol = ""; - style = "bg:green"; - format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; - }; - java = { - symbol = " "; - style = "bg:green"; - format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; - }; - kotlin = { - symbol = ""; - style = "bg:green"; - format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; - }; - haskell = { - symbol = ""; - style = "bg:green"; - format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; - }; - python = { - symbol = ""; - style = "bg:green"; - format = ''[[ $symbol( $version)(\(#$virtualenv\)) ](fg:crust bg:green)]($style)''; - }; - docker_context = { - symbol = ""; - style = "bg:sapphire"; - format = ''[[ $symbol( $context) ](fg:crust bg:sapphire)]($style)''; - }; - conda = { - symbol = "  "; - style = "fg:crust bg:sapphire"; - format = ''[$symbol$environment ]($style)''; - ignore_base = false; - }; - nix_shell = { - symbol = "󱄅"; - style = "fg:crust bg:sapphire"; - format = ''[[ $symbol( $name) ](fg:crust bg:sapphire)]($style)''; - }; - time = { - disabled = false; - time_format = "%R"; - style = "bg:lavender"; - format = ''[[  $time ](fg:crust bg:lavender)]($style)''; - }; - line_break = { - disabled = false; - }; - character = { - disabled = false; - success_symbol = "[❯](bold fg:green)"; - error_symbol = "[❯](bold fg:red)"; - vimcmd_symbol = "[❮](bold fg:green)"; - vimcmd_replace_one_symbol = "[❮](bold fg:lavender)"; - vimcmd_replace_symbol = "[❮](bold fg:lavender)"; - vimcmd_visual_symbol = "[❮](bold fg:yellow)"; - }; - cmd_duration = { - show_milliseconds = true; - format = " in $duration "; - style = "bg:lavender"; - disabled = false; - show_notifications = true; - min_time_to_notify = 45000; - }; - }; - }; - carapace = { - enable = true; - enableFishIntegration = false; - }; - zoxide = { - enable = true; - }; kitty = { enable = true; package = (config.lib.nixGL.wrap pkgs.kitty); @@ -423,139 +108,6 @@ in clipboard_control = "write-primary write-clipboard no-append"; }; }; - git = { - enable = true; - delta = { - enable = true; - }; - signing = { - format = "openpgp"; - signByDefault = true; - }; - userEmail = "contact@ethanreece.com"; - userName = "Ethan Reece"; - }; - gh = { - enable = true; - settings = { - git_protocol = "ssh"; - }; - }; - jujutsu = { - enable = true; - settings = { - user = { - name = "Ethan Reece"; - email = "contact@ethanreece.com"; - }; - signing = { - behavior = "own"; - backend = "gpg"; - }; - }; - }; - codex = { - enable = true; - custom-instructions = '' - ## 10. Applying Patch Files with patch - - When the built-in `apply_patch` tool or `git apply` fails to apply a diff/patch file (especially if the file being patched contains special characters that might confuse simpler patch tools), the standard `patch` utility can be a more robust alternative. - - - **Patch File Format**: Ensure your patch file is in a standard unified diff format. Typically, these patches are generated with `git diff > my_feature.patch` or manually crafted. If the patch refers to files with `a/` and `b/` prefixes (e.g., `--- a/file.txt`, `+++ b/file.txt`), you'll use the `-p1` option. - - - **Creating the Patch File**: You can create a patch file using shell redirection, for example: - - ```bash` - cat <<'EOF' > fix_descriptive_name.patch - --- a/path/to/your/file.ext - +++ b/path/to/your/file.ext - @@ -line_num,num_lines +line_num,num_lines @@ context_or_change - -old_line_content - +new_line_content - EOF - ``` - - *Important*: Ensure the `EOF` marker is on its own line with no trailing spaces. - - - **Applying the Patch**: Use the `patch` command via the `shell` tool. The `-p1` option strips the leading component from file paths in the patch file (`a/`, `b/`). - - ``` - # Example: Apply a patch file - default_api.shell(command=["sh", "-c", "patch -p1 < fix_descriptive_name.patch"]) - ``` - - - **Verification**: After applying, always verify that the target file has been changed as expected (e.g., using `cat` or `git diff`). - - - **Cleanup**: Remove the patch file if it's no longer needed: - - ``` - default_api.shell(command=["rm", "fix_descriptive_name.patch"]) - ``` - ''; - settings = { - model = "${localFastModel}"; - provider = "ollama"; - providers = { - ollama = { - name = "Ollama"; - baseURL = "http://localhost:11434/v1"; - envKey = "OLLAMA_API_KEY"; - }; - openrouter = { - name = "OpenRouter"; - baseURL = "https://openrouter.ai/api/v1"; - envKey = "OPENROUTER_API_KEY"; - }; - }; - }; - }; - aichat = { - enable = true; - settings = { - model = "ollama:${localFastModel}"; - clients = [ - { - type = "openai-compatible"; - name = "ollama"; - api_base = "http://localhost:11434/v1"; - models = [ - { - name = "${localFastModel}"; - supports_function_calling = true; - supports_vision = true; - } - { - name = "${localReasoningModel}"; - supports_function_calling = true; - supports_vision = true; - } - ]; - } - { - type = "openai-compatible"; - name = "openrouter"; - api_base = "https://openrouter.ai/api/v1"; - models = [ - { - name = "${remoteFastModel}"; - supports_function_calling = true; - supports_vision = true; - } - { - name = "${remoteReasoningModel}"; - supports_function_calling = true; - supports_vision = true; - } - ]; - } - ]; - }; - }; - direnv = { - enable = true; - mise.enable = true; - nix-direnv.enable = true; - }; vesktop = { enable = true; package = (config.lib.nixGL.wrap pkgs.vesktop); @@ -896,14 +448,6 @@ in }; services = { arrpc.enable = true; - gpg-agent = { - enable = true; - enableSshSupport = true; - pinentry = { - package = pkgs.pinentry-tty; - program = "pinentry"; - }; - }; }; targets.genericLinux.enable = true; } diff --git a/home-manager/base.nix b/home-manager/base.nix new file mode 100644 index 0000000..cb568bb --- /dev/null +++ b/home-manager/base.nix @@ -0,0 +1,485 @@ +# SPDX-FileCopyrightText: 2025 Ethan Reece +# +# SPDX-License-Identifier: MIT + +{ + config, + inputs, + lib, + pkgs, + ... +}: + +let + # localFastModel = "qwen2.5-coder-num_ctx"; + # localReasoningModel = "deepseek-r1-num_ctx"; + remoteFastModel = "deepseek/deepseek-chat-v3-0324:free"; # "qwen/qwen-2.5-coder-32b-instruct:free"; + remoteReasoningModel = "deepseek/deepseek-r1-0528:free"; +in +{ + sops = { + secrets = { + openrouter_api_key = { }; + }; + defaultSopsFile = ../sops/secrets.yaml; + }; + # https://nix.catppuccin.com/search/rolling/ + catppuccin = { + enable = true; + flavor = "mocha"; + }; + # https://nix-community.github.io/stylix/options/modules/alacritty.html + stylix = { + enable = true; + base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-mocha.yaml"; + image = config.lib.stylix.pixel "base0A"; + polarity = "dark"; + fonts = { + serif = { + package = pkgs.libertinus; + name = "Libertinus Serif"; + }; + sansSerif = { + package = pkgs.inter; + name = "Inter"; + }; + monospace = { + package = pkgs.nerd-fonts.jetbrains-mono; + name = "JetBrains Mono Nerd Font"; + }; + emoji = { + package = pkgs.openmoji-color; + name = "OpenMoji Color"; + }; + }; + targets = { + bat.enable = false; + fzf.enable = false; + helix.enable = false; + kitty.variant256Colors = true; + starship.enable = false; + }; + }; + home = { + stateVersion = "24.11"; + language.base = "eo.utf8"; + packages = [ + pkgs.acpi + pkgs.bzip3 + # pkgs.cacert - TODO: should be used on NixOS + pkgs.curl + pkgs.e2fsprogs + pkgs.file + pkgs.gzip + pkgs.gnutar + pkgs.iproute2 + pkgs.iputils + pkgs.julia + # pkgs.languagetool - TODO: should be used on NixOS + pkgs.lm_sensors + pkgs.lsof + pkgs.mailutils + # pkgs.ncurses + pkgs.nixd + pkgs.pijul + pkgs.procps # TODO: switch to uutils when available + pkgs.procs + pkgs.psmisc + pkgs.speedtest-cli + pkgs.strace + # pkgs.sudo-rs - TODO: should be used on NixOS + pkgs.tcpdump + pkgs.util-linux # TODO: switch to uutils when available + pkgs.uutils-coreutils-noprefix + pkgs.uutils-diffutils + pkgs.uutils-findutils + pkgs.wget + pkgs.xz + ]; + file = { }; + shell = { + enableNushellIntegration = true; + enableZshIntegration = true; + enableFishIntegration = true; + }; + }; + programs = { + home-manager = { + enable = true; + }; + man = { + enable = true; + }; + # TODO: Disable Guix integration + # password-store = { + # enable = true; + # }; + bat = { + enable = true; + }; + nix-your-shell = { + enable = true; + }; + fzf = { + enable = true; + }; + vim = { + enable = true; + }; + helix = { + enable = true; + defaultEditor = true; + settings = { + editor.soft-wrap = { + enable = true; + }; + }; + }; + nushell = { + enable = true; + environmentVariables = { + OPENROUTER_API_KEY = lib.hm.nushell.mkNushellInline "cat ${config.sops.secrets.openrouter_api_key.path}"; + }; + settings = { + completions = { + algorithm = "fuzzy"; + case_sensitive = false; + external = { + enable = true; + }; + }; + }; + # set -x ZATHURA_PLUGINS_PATH $GUIX_HOME/lib/zathura + shellAliases = { + aichat_reasoning_remote = "${pkgs.aichat}/bin/aichat --model openrouter:${remoteReasoningModel}"; + aichat_fast_remote = "${pkgs.aichat}/bin/aichat --model openrouter:${remoteFastModel}"; + codex_remote = "${pkgs.codex}/bin/codex --provider openrouter --model ${remoteFastModel}"; + hotspot = "sudo sysctl net.ipv4.ip_default_ttl=65"; + }; + }; + starship = { + enable = true; + settings = { + format = + "[](red)" + + "$os" + + "$username" + + "[](bg:peach fg:red)" + + "$directory" + + "[](bg:yellow fg:peach)" + + "$git_branch" + + "$git_status" + + "[](fg:yellow bg:green)" + + "$c" + + "$rust" + + "$golang" + + "$nodejs" + + "$php" + + "$java" + + "$kotlin" + + "$haskell" + + "$python" + + "[](fg:green bg:sapphire)" + + "$conda" + + "$nix_shell" + + "[](fg:sapphire bg:lavender)" + + "$time" + + "[ ](fg:lavender)" + + "$cmd_duration" + + "$line_break" + + "$character"; + os = { + disabled = false; + style = "bg:red fg:crust"; + symbols = { + Windows = ""; + Ubuntu = "󰕈"; + SUSE = ""; + Raspbian = "󰐿"; + Mint = "󰣭"; + Macos = "󰀵"; + Manjaro = ""; + Linux = "󰌽"; + Gentoo = "󰣨"; + Fedora = "󰣛"; + Alpine = ""; + Amazon = ""; + Android = ""; + Arch = "󰣇"; + Artix = "󰣇"; + CentOS = ""; + Debian = "󰣚"; + Redhat = "󱄛"; + RedHatEnterprise = "󱄛"; + NixOS = ""; + }; + }; + username = { + show_always = true; + style_user = "bg:red fg:crust"; + style_root = "bg:red fg:crust"; + format = ''[ $user]($style)''; + }; + directory = { + style = "bg:peach fg:crust"; + format = "[ $path ]($style)"; + truncation_length = 3; + truncation_symbol = "…/"; + substitutions = { + "Documents" = "󰈙 "; + "Downloads" = " "; + "Music" = "󰝚 "; + "Pictures" = " "; + "Developer" = "󰲋 "; + }; + }; + git_branch = { + symbol = ""; + style = "bg:yellow"; + format = ''[[ $symbol $branch ](fg:crust bg:yellow)]($style)''; + }; + git_status = { + style = "bg:yellow"; + format = ''[[($all_status$ahead_behind )](fg:crust bg:yellow)]($style)''; + }; + nodejs = { + symbol = ""; + style = "bg:green"; + format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; + }; + c = { + symbol = " "; + style = "bg:green"; + format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; + }; + rust = { + symbol = ""; + style = "bg:green"; + format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; + }; + golang = { + symbol = ""; + style = "bg:green"; + format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; + }; + php = { + symbol = ""; + style = "bg:green"; + format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; + }; + java = { + symbol = " "; + style = "bg:green"; + format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; + }; + kotlin = { + symbol = ""; + style = "bg:green"; + format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; + }; + haskell = { + symbol = ""; + style = "bg:green"; + format = ''[[ $symbol( $version) ](fg:crust bg:green)]($style)''; + }; + python = { + symbol = ""; + style = "bg:green"; + format = ''[[ $symbol( $version)(\(#$virtualenv\)) ](fg:crust bg:green)]($style)''; + }; + docker_context = { + symbol = ""; + style = "bg:sapphire"; + format = ''[[ $symbol( $context) ](fg:crust bg:sapphire)]($style)''; + }; + conda = { + symbol = "  "; + style = "fg:crust bg:sapphire"; + format = ''[$symbol$environment ]($style)''; + ignore_base = false; + }; + nix_shell = { + symbol = "󱄅"; + style = "fg:crust bg:sapphire"; + format = ''[[ $symbol( $name) ](fg:crust bg:sapphire)]($style)''; + }; + time = { + disabled = false; + time_format = "%R"; + style = "bg:lavender"; + format = ''[[  $time ](fg:crust bg:lavender)]($style)''; + }; + line_break = { + disabled = false; + }; + character = { + disabled = false; + success_symbol = "[❯](bold fg:green)"; + error_symbol = "[❯](bold fg:red)"; + vimcmd_symbol = "[❮](bold fg:green)"; + vimcmd_replace_one_symbol = "[❮](bold fg:lavender)"; + vimcmd_replace_symbol = "[❮](bold fg:lavender)"; + vimcmd_visual_symbol = "[❮](bold fg:yellow)"; + }; + cmd_duration = { + show_milliseconds = true; + format = " in $duration "; + style = "bg:lavender"; + disabled = false; + show_notifications = true; + min_time_to_notify = 45000; + }; + }; + }; + carapace = { + enable = true; + enableFishIntegration = false; + }; + zoxide = { + enable = true; + }; + git = { + enable = true; + delta = { + enable = true; + }; + signing = { + format = "openpgp"; + signByDefault = true; + }; + userEmail = "contact@ethanreece.com"; + userName = "Ethan Reece"; + }; + gh = { + enable = true; + settings = { + git_protocol = "ssh"; + }; + }; + jujutsu = { + enable = true; + settings = { + user = { + name = "Ethan Reece"; + email = "contact@ethanreece.com"; + }; + signing = { + behavior = "own"; + backend = "gpg"; + }; + }; + }; + codex = { + enable = true; + custom-instructions = '' + ## 10. Applying Patch Files with patch + + When the built-in `apply_patch` tool or `git apply` fails to apply a diff/patch file (especially if the file being patched contains special characters that might confuse simpler patch tools), the standard `patch` utility can be a more robust alternative. + + - **Patch File Format**: Ensure your patch file is in a standard unified diff format. Typically, these patches are generated with `git diff > my_feature.patch` or manually crafted. If the patch refers to files with `a/` and `b/` prefixes (e.g., `--- a/file.txt`, `+++ b/file.txt`), you'll use the `-p1` option. + + - **Creating the Patch File**: You can create a patch file using shell redirection, for example: + + ```bash` + cat <<'EOF' > fix_descriptive_name.patch + --- a/path/to/your/file.ext + +++ b/path/to/your/file.ext + @@ -line_num,num_lines +line_num,num_lines @@ context_or_change + -old_line_content + +new_line_content + EOF + ``` + + *Important*: Ensure the `EOF` marker is on its own line with no trailing spaces. + + - **Applying the Patch**: Use the `patch` command via the `shell` tool. The `-p1` option strips the leading component from file paths in the patch file (`a/`, `b/`). + + ``` + # Example: Apply a patch file + default_api.shell(command=["sh", "-c", "patch -p1 < fix_descriptive_name.patch"]) + ``` + + - **Verification**: After applying, always verify that the target file has been changed as expected (e.g., using `cat` or `git diff`). + + - **Cleanup**: Remove the patch file if it's no longer needed: + + ``` + default_api.shell(command=["rm", "fix_descriptive_name.patch"]) + ``` + ''; + settings = { + model = "${remoteFastModel}"; + provider = "ollama"; + providers = { + ollama = { + name = "Ollama"; + baseURL = "http://localhost:11434/v1"; + envKey = "OLLAMA_API_KEY"; + }; + openrouter = { + name = "OpenRouter"; + baseURL = "https://openrouter.ai/api/v1"; + envKey = "OPENROUTER_API_KEY"; + }; + }; + }; + }; + aichat = { + enable = true; + settings = { + model = "ollama:${remoteFastModel}"; + clients = [ + # { + # type = "openai-compatible"; + # name = "ollama"; + # api_base = "http://localhost:11434/v1"; + # models = [ + # { + # name = "${localFastModel}"; + # supports_function_calling = true; + # supports_vision = true; + # } + # { + # name = "${localReasoningModel}"; + # supports_function_calling = true; + # supports_vision = true; + # } + # ]; + # } + { + type = "openai-compatible"; + name = "openrouter"; + api_base = "https://openrouter.ai/api/v1"; + models = [ + { + name = "${remoteFastModel}"; + supports_function_calling = true; + supports_vision = true; + } + { + name = "${remoteReasoningModel}"; + supports_function_calling = true; + supports_vision = true; + } + ]; + } + ]; + }; + }; + direnv = { + enable = true; + mise.enable = true; + nix-direnv.enable = true; + }; + }; + services = { + gpg-agent = { + enable = true; + enableSshSupport = true; + pinentry = { + package = pkgs.pinentry-tty; + program = "pinentry"; + }; + }; + }; +} diff --git a/home-manager/raspi/default.nix b/home-manager/raspi/default.nix new file mode 100644 index 0000000..d2de30a --- /dev/null +++ b/home-manager/raspi/default.nix @@ -0,0 +1,24 @@ +# SPDX-FileCopyrightText: 2025 Ethan Reece +# +# SPDX-License-Identifier: MIT + +{ inputs, withSystem, ... }: +{ + flake.homeConfigurations = { + raspi = withSystem "aarch64-linux" ( + { pkgs, ... }: + inputs.home-manager.lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { inherit inputs pkgs; }; + modules = [ + inputs.lix-module.nixosModules.default + inputs.sops-nix.homeManagerModules.sops + inputs.stylix.homeModules.stylix + inputs.catppuccin.homeModules.catppuccin + ../base.nix + ./home.nix + ]; + } + ); + }; +}