1
0
Fork 0
nix-homemanager-laptop/home-manager/base.nix
2025-07-18 01:11:10 -05:00

488 lines
14 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# SPDX-FileCopyrightText: 2025 Ethan Reece <contact@ethanreece.com>
#
# SPDX-License-Identifier: MIT
{
config,
inputs,
lib,
pkgs,
system,
...
}:
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.trash-cli
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;
package = inputs.helix.packages.${system}.helix;
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 = "openrouter:${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";
};
};
};
}