feat: restructure and move apps into their own configs (#2)

This commit is contained in:
Uttarayan
2025-02-05 17:09:33 +05:30
committed by GitHub
parent e25f478315
commit 0a26d94f77
52 changed files with 662 additions and 482 deletions

62
home/programs/aichat.nix Normal file
View File

@@ -0,0 +1,62 @@
{
pkgs,
lib,
device,
config,
...
}: {
programs.
aichat = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = false;
settings = {
save_session = true;
model = "openai:gpt-4o";
rag_embedding_model = "ollama:RobinBially/nomic-embed-text-8k";
clients = [
{
type = "openai-compatible";
name = "llama";
api_base = "https://llama.darksailor.dev/api/v1";
api_key_cmd = "cat ${config.sops.secrets."llama/api_key".path}";
models = [
{
name = "qwen_2_5_1";
}
];
}
{
type = "openai-compatible";
name = "ollama";
api_base = "https://llama.darksailor.dev/api/ollama/v1";
api_key_cmd = "cat ${config.sops.secrets."llama/api_key".path}";
models = [
{
name = "RobinBially/nomic-embed-text-8k";
type = "embedding";
default_chunk_size = 8000;
}
{
name = "mistral";
}
];
}
{
type = "openai";
name = "openai";
api_base = "https://api.openai.com/v1";
api_key_cmd = "cat ${config.sops.secrets."openai/api_key".path}";
models = [
{
name = "gpt-3.5-turbo";
}
{
name = "gpt-4o";
}
];
}
];
};
};
}

17
home/programs/atuin.nix Normal file
View File

@@ -0,0 +1,17 @@
{
pkgs,
lib,
device,
...
}: {
programs.atuin = {
settings = {
auto_sync = true;
sync_frequency = "1m";
sync_address = "https://atuin.darksailor.dev";
};
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
};
}

19
home/programs/bat.nix Normal file
View File

@@ -0,0 +1,19 @@
{
pkgs,
lib,
device,
...
}: {
programs.
bat = {
enable = true;
config = {theme = "catppuccin";};
themes = {
catppuccin = {
src = "${pkgs.catppuccinThemes.bat}/themes";
file = "Catppuccin Mocha.tmTheme";
};
};
# extraPackages = with pkgs.bat-extras; [batman batgrep batwatch];
};
}

View File

@@ -0,0 +1,13 @@
{
pkgs,
lib,
device,
...
}: {
programs.
carapace = {
enable = false;
enableFishIntegration = true;
enableNushellIntegration = true;
};
}

94
home/programs/default.nix Normal file
View File

@@ -0,0 +1,94 @@
{
pkgs,
device,
...
}: {
imports = [
../../modules
./aichat.nix
./atuin.nix
./bat.nix
./carapace.nix
./direnv.nix
./eza.nix
./fish.nix
./fzf.nix
./gh.nix
./git.nix
./goread.nix
./helix.nix
./ncmpcpp.nix
./neomutt.nix
./newsboat.nix
./nix-index.nix
./nushell.nix
./sops.nix
./ssh.nix
./starship.nix
./tmux.nix
./tuifeed.nix
./yazi.nix
./zellij.nix
./zoxide.nix
#./template.nix
];
home.packages = with pkgs;
[
(nixvim.makeNixvim (import ../../neovim))
_1password-cli
alejandra
ast-grep
bottom
btop
cachix
deploy-rs
dust
fd
file
fzf
gnupg
gpg-tui
jq
just
macchina
p7zip
pandoc
pfetch-rs
pkg-config
ripgrep
sd
tldr
vcpkg-tool
yt-dlp
]
++ lib.optionals (!device.isServer) [
clang
cmake
d2
devenv
go
hasklig
jujutsu
monaspace
nerd-fonts.fira-code
nerd-fonts.hasklug
nerd-fonts.symbols-only
qmk
ttyper
yarn
zed-editor
]
++ lib.optionals device.isLinux [
dig
gptfdisk
handlr-regex
handlr-xdg
lsof
ncpamixer
rr
sbctl
usbutils
ddcbacklight
]
++ lib.optionals device.isMac [];
}

13
home/programs/direnv.nix Normal file
View File

@@ -0,0 +1,13 @@
{
pkgs,
lib,
device,
...
}: {
programs.direnv = {
enable = true;
# enableFishIntegration = lib.mkForce true; # Auto enabled
enableNushellIntegration = true;
nix-direnv.enable = true;
};
}

14
home/programs/eza.nix Normal file
View File

@@ -0,0 +1,14 @@
{
pkgs,
lib,
device,
...
}: {
programs.
eza = {
enable = true;
# enableAliases = true;
git = true;
icons = "auto";
};
}

40
home/programs/fish.nix Normal file
View File

@@ -0,0 +1,40 @@
{
pkgs,
lib,
device,
...
}: {
programs.fish = {
enable = true;
shellAbbrs = {
vim = "nvim";
vi = "nvim";
nv = "neovide";
g = "git";
yy = "yazi";
cd = "z";
ls = "eza";
cat = "bat";
j = "just --choose";
# t = "zellij a -c --index 0";
t = "tmux";
};
shellAliases =
{
g = "git";
}
// lib.optionalAttrs pkgs.stdenv.isLinux {
kmpv = "mpv --vo-kitty-use-shm=yes --vo=kitty --really-quiet";
smpv = "mpv --vo-sixel-buffered=yes --vo=sixel --profile=sw-fast";
};
shellInit = ''
set fish_greeting
yes | fish_config theme save "Catppuccin Mocha"
'';
# ${pkgs.spotify-player}/bin/spotify_player generate fish | source
interactiveShellInit = ''
${pkgs.pfetch-rs}/bin/pfetch
${lib.optionalString (device.isLinux && !device.isNix) "source /etc/profile.d/nix-daemon.fish"}
'';
};
}

14
home/programs/fzf.nix Normal file
View File

@@ -0,0 +1,14 @@
{
pkgs,
lib,
device,
...
}: {
programs.
fzf = {
enable = true;
package = pkgs.fzf;
enableFishIntegration = true;
tmux.enableShellIntegration = true;
};
}

11
home/programs/gh.nix Normal file
View File

@@ -0,0 +1,11 @@
{
pkgs,
lib,
device,
...
}: {
programs = {
gh.enable = true;
gh-dash.enable = true;
};
}

33
home/programs/git.nix Normal file
View File

@@ -0,0 +1,33 @@
{
pkgs,
lib,
device,
...
}: {
programs.git = {
enable = true;
lfs.enable = true;
userName = "uttarayan21";
userEmail = "email@uttarayan.me";
extraConfig = {
color.ui = true;
core.editor = "nvim";
core.pager = "${pkgs.delta}/bin/delta";
interactive.diffFilter = "${pkgs.delta}/bin/delta --color-only";
delta.navigate = true;
merge.conflictStyle = "diff3";
diff.colorMoved = "default";
push.autoSetupRemote = true;
user.signingkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJfKKrX8yeIHUUury0aPwMY6Ha+BJyUR7P0Gqid90ik/";
gpg.format = "ssh";
commit.gpgsign = true;
pull = {
rebase = true;
};
"gpg \"ssh\"".program =
if pkgs.stdenv.isDarwin
then "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"
else "${pkgs._1password-gui}/share/1password/op-ssh-sign";
};
};
}

43
home/programs/goread.nix Normal file
View File

@@ -0,0 +1,43 @@
{...}: {
programs.goread = {
enable = true;
config = {
urls = {
categories = [
{
name = "Rust";
desc = "Stuff related to the rust programming language";
subscriptions = [
{
name = "r/rust";
desc = "The rust subreddit";
url = "https://old.reddit.com/r/rust/.rss";
}
{
name = "thesquareplanet";
desc = "jonhoo's blog";
url = "https://thesquareplanet.com/feed.xml";
}
{
name = "Jon Gjengset's Youtube";
desc = "jonhoo's youtube channel";
url = "https://www.youtube.com/feeds/videos.xml?channel_id=UC_iD0xppBwwsrM9DegC5cQQ";
}
];
}
{
name = "Nix";
desc = "Stuff related to the nix / nixos / nixlang";
subscriptions = [
{
name = "r/nixos";
desc = "The nixos subreddit";
url = "https://old.reddit.com/r/nixos/.rss";
}
];
}
];
};
};
};
}

23
home/programs/helix.nix Normal file
View File

@@ -0,0 +1,23 @@
{
pkgs,
lib,
device,
...
}: {
programs.helix = {
enable = true;
settings = {
theme = "catppuccin_mocha";
editor = {
line-number = "relative";
lsp.display-messages = true;
};
keys.normal = {
space.space = "file_picker";
space.w = ":w";
space.q = ":q";
esc = ["collapse_selection" "keep_primary_selection"];
};
};
};
}

16
home/programs/ncmpcpp.nix Normal file
View File

@@ -0,0 +1,16 @@
{pkgs, ...}: {
programs.ncmpcpp = {
enable = true;
bindings =
pkgs.lib.attrsets.mapAttrsToList (key: value: {
key = key;
command = value;
}) {
j = "scroll_down";
k = "scroll_up";
J = ["select_item" "scroll_down"];
K = ["select_item" "scroll_up"];
};
package = pkgs.ncmpcpp;
};
}

View File

@@ -0,0 +1,9 @@
{pkgs, ...}: {
programs.neomutt = {
enable = true;
vimKeys = true;
editor = "nvim";
# sidebar = {
# };
};
}

View File

@@ -0,0 +1,47 @@
{pkgs, ...}: {
programs.newsboat = {
enable = false;
urls = [
{
title = "r/rust";
url = "https://www.reddit.com/r/rust/.rss";
tags = ["rust"];
}
{
title = "the square planet";
url = "https://thesquareplanet.com/feed.xml";
tags = ["rust"];
}
{
title = "Jon Gjengset's YouTube";
url = "https://www.youtube.com/feeds/videos.xml?channel_id=UC_iD0xppBwwsrM9DegC5cQQ";
tags = ["rust" "youtube"];
}
];
extraConfig = let
dracula = builtins.fetchurl {
url = "https://raw.githubusercontent.com/dracula/newsboat/main/newsboat";
sha256 = "sha256:08b00ilc5zk5fkzqqd6aghcpya3d00s9kvv65b8c50rg7ikm88xr";
};
in ''
include ${dracula}
unbind-key g
bind-key g home
unbind-key G
bind-key G end
unbind-key h
unbind-key j
unbind-key k
unbind-key l
bind-key h quit
bind-key j down
bind-key k up
bind-key l open
'';
browser = "${pkgs.handlr-xdg}/bin/xdg-open";
maxItems = 50;
autoReload = true;
};
}

View File

@@ -0,0 +1,14 @@
{
pkgs,
lib,
device,
...
}: {
programs = {
nix-index-database.comma.enable = true;
nix-index = {
enable = true;
enableFishIntegration = true;
};
};
}

24
home/programs/nushell.nix Normal file
View File

@@ -0,0 +1,24 @@
{
pkgs,
lib,
device,
...
}: {
programs.nushell = {
enable = true;
shellAliases = {
cd = "z";
yy = "yazi";
cat = "bat";
};
extraConfig = ''
${pkgs.pfetch-rs}/bin/pfetch
'';
package = pkgs.nushell;
configFile.text = ''
$env.config = {
show_banner: false,
}
'';
};
}

17
home/programs/sops.nix Normal file
View File

@@ -0,0 +1,17 @@
{
config,
pkgs,
inputs,
...
}: {
imports = [
inputs.sops-nix.homeManagerModules.sops
];
sops = {
defaultSopsFile = ../../secrets/secrets.yaml;
defaultSopsFormat = "yaml";
age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
secrets."llama/api_key" = {};
secrets."openai/api_key" = {};
};
}

40
home/programs/ssh.nix Normal file
View File

@@ -0,0 +1,40 @@
{
pkgs,
lib,
device,
...
}: {
programs.ssh = {
enable = true;
matchBlocks = {
github = {
user = "git";
host = "github.com";
};
deoxys = {
user = "servius";
hostname = "deoxys";
forwardAgent = true;
};
mirai = {
user = "fs0c131y";
hostname = "sh.darksailor.dev";
forwardAgent = true;
};
ryu = {
user = "servius";
hostname = "ryu";
forwardAgent = false;
};
};
serverAliveInterval = 120;
extraConfig =
lib.strings.optionalString pkgs.stdenv.isDarwin
''
IdentityAgent "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
''
+ lib.strings.optionalString (pkgs.stdenv.isLinux && !device.isServer) ''
IdentityAgent ~/.1password/agent.sock
'';
};
}

View File

@@ -0,0 +1,31 @@
{
pkgs,
lib,
device,
...
}: {
programs.starship = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
settings = let
flavour = "mocha"; # Replace with your preferred palette
in
{
# Check https://starship.rs/config/#prompt
format = "$all$character";
palette = "catppuccin_${flavour}";
character = {
success_symbol = "[[OK](bold green) ](maroon)";
error_symbol = "[](red)";
vimcmd_symbol = "[](green)";
};
directory = {
truncation_length = 4;
style = "bold lavender";
};
}
// builtins.fromTOML (builtins.readFile
(pkgs.catppuccinThemes.starship + /palettes/${flavour}.toml));
};
}

View File

@@ -0,0 +1,9 @@
{
pkgs,
lib,
device,
...
}: {
programs = {
};
}

91
home/programs/tmux.nix Normal file
View File

@@ -0,0 +1,91 @@
{pkgs, ...}: let
scratchpad = pkgs.writeShellScript "scratchpad" ''
width=''${2:-95%}
height=''${2:-95%}
if [ "$(tmux display-message -p -F "#{session_name}")" = "scratch" ];then
tmux detach-client
else
tmux popup -d '#{pane_current_path}' -xC -yC -w$width -h$height -E "tmux new -A -s scratch -d -c ''$(pwd)"
fi
'';
in {
programs.tmux = {
enable = true;
terminal = "tmux-256color";
prefix = "C-q";
historyLimit = 100000;
keyMode = "vi";
plugins = with pkgs; [
tmuxPlugins.better-mouse-mode
tmuxPlugins.tmux-fzf
tmuxPlugins.fzf-tmux-url
{
plugin = tmuxPlugins.tmux-thumbs;
extraConfig =
if pkgs.stdenv.isDarwin
then
#tmux
''
set -g @thumbs-command 'echo -n {} | pbcopy'
''
else
#tmux
''
set -g @thumbs-command 'echo -n {} | wl-copy'
'';
}
# {
# plugin = tmuxPlugins.tmux-super-fingers;
# extraConfig = "set -g @super-fingers-key i";
# }
{
plugin = tmuxPlugins.catppuccin;
extraConfig =
# tmux
''
set -g @catppuccin_flavour 'mocha'
set -g @catppuccin_window_default_text ''''''
'';
}
{
plugin = tmuxPlugins.battery;
extraConfig =
# tmux
''
set -g @catppuccin_status_modules_right "battery application session date_time"
'';
}
];
extraConfig =
# tmux
''
set -gw mode-keys vi
set -g status-keys vi
set -g allow-passthrough on
set -g visual-activity off
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
set -sg escape-time 10
set -sa terminal-features ',wezterm:RGB'
set -g default-command "${pkgs.fish}/bin/fish";
set -g default-shell "${pkgs.fish}/bin/fish";
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -n C-\\ run-shell "${pkgs.tmux-float}/bin/tmux-float toggle"
bind o set status
bind C-n next-window
bind C-p previous-window
bind C-q last-window
if-shell 'uname | grep -q "Darwin"' { set -s copy-command "pbcopy" }
if-shell 'uname | grep -q "Linux"' { set -s copy-command "wl-copy" }
'';
};
}

12
home/programs/tuifeed.nix Normal file
View File

@@ -0,0 +1,12 @@
{...}: {
programs.tuifeed = {
enable = false;
config = {
sources = {
"r/rust" = "https://www.reddit.com/r/rust/.rss";
"thesquareplanet" = "https://thesquareplanet.com/feed.xml";
"Jon Gjengset (YouTube)" = "https://www.youtube.com/feeds/videos.xml?channel_id=UC_iD0xppBwwsrM9DegC5cQQ";
};
};
};
}

14
home/programs/yazi.nix Normal file
View File

@@ -0,0 +1,14 @@
{
pkgs,
lib,
device,
...
}: {
programs.
yazi = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
theme = builtins.fromTOML (builtins.readFile "${pkgs.catppuccinThemes.yazi}/themes/mocha.toml");
};
}

138
home/programs/zellij.nix Normal file
View File

@@ -0,0 +1,138 @@
{
lib,
pkgs,
...
}: {
home.sessionVariables = {
# "ZELLIJ_AUTO_ATTACH" = "true";
# "ZELLIJ_AUTO_EXIT" = "true";
};
programs.zellij = let
mkBind = key: action:
if builtins.isString action
then "bind \"" + key + "\" {" + action + ";}"
else "bind \"" + key + "\" {" + (lib.concatStringsSep ";" action) + ";}";
mkBinds = binds: (lib.attrsets.mapAttrs' (key: action: lib.attrsets.nameValuePair (mkBind key action) []) binds);
mkCommand = command: (mode: "${command} \"" + mode + "\"");
# SwitchToMode = mode: "SwitchToMode \"" + mode + "\"";
SwitchToMode = mkCommand "SwitchToMode";
GoToTab = tab: "GoToTab ${toString tab}";
ToggleTab = "ToggleTab";
mkKeybinds = {
normal ? null,
locked ? null,
resize ? null,
pane ? null,
move ? null,
tab ? null,
scroll ? null,
search ? null,
entersearch ? null,
renametab ? null,
renamepane ? null,
session ? null,
tmux ? null,
# unbind ? null,
} @ b:
lib.attrsets.mapAttrs' (
mode: keymaps:
lib.attrsets.nameValuePair (
if builtins.hasAttr "clear-defaults" keymaps && keymaps.clear-defaults == true
then mode + " " + "clear-defaults=true"
else mode
) (
mkBinds (removeAttrs keymaps ["clear-defaults"])
)
)
(lib.attrsets.filterAttrs (mode: keymaps: keymaps != {}) b);
# mkUnbinds = bindings:
# if builtins.hasAttr "unbind" bindings
# then mkUnbind bindings.unbind
# else "";
#
# mkUnbind = key:
# if key.isString
# then "unbind \"" + key + "\""
# else lib.concatStringsSep " " (builtins.map ("\"" + key + "\"") key);
in {
enable = true;
settings = {
default_shell = "fish";
pane_frames = false;
theme = "catppuccin-mocha";
# default_layout = "compact";
keybinds = mkKeybinds {
normal = {
clear-defaults = true;
"Ctrl q" = SwitchToMode "Tmux";
};
tmux = {
"0" = [(GoToTab 10) (SwitchToMode "Normal")];
"1" = [(GoToTab 1) (SwitchToMode "Normal")];
"2" = [(GoToTab 2) (SwitchToMode "Normal")];
"3" = [(GoToTab 3) (SwitchToMode "Normal")];
"4" = [(GoToTab 4) (SwitchToMode "Normal")];
"5" = [(GoToTab 5) (SwitchToMode "Normal")];
"6" = [(GoToTab 6) (SwitchToMode "Normal")];
"7" = [(GoToTab 7) (SwitchToMode "Normal")];
"8" = [(GoToTab 8) (SwitchToMode "Normal")];
"9" = [(GoToTab 9) (SwitchToMode "Normal")];
"Ctrl q" = [ToggleTab (SwitchToMode "Normal")];
"*" = SwitchToMode "Normal";
};
scroll = {
"g" = "ScrollToTop";
"G" = "ScrollToBottom";
"/" = "Search \"down\"";
"?" = "Search \"up\"";
"Ctrl u" = "HalfPageScrollUp";
"Ctrl d" = "HalfPageScrollDown";
"Ctrl f" = "PageScrollUp";
"Ctrl b" = "PageScrollDown";
};
};
};
# enableFishIntegration = true;
};
xdg.configFile."zellij/layouts/default.kdl" = {
text =
/*
kdl
*/
''
layout {
pane split_direction="vertical" {
pane
}
pane size=1 borderless=true {
plugin location="file:${pkgs.zellijPlugins.zjstatus}/bin/zjstatus.wasm" {
hide_frame_for_single_pane "true"
format_left "{mode}#[fg=#89B4FA,bg=#181825,bold] {tabs}"
format_right "#[fg=#424554,bg=#181825]{session} on {datetime}"
format_space "#[bg=#181825]"
mode_normal "#[fg=black,bg=#89B4FA] NORMAL #[fg=#87B4FA,bg=#181825]"
mode_tmux "#[fg=black,bg=#FFC387] TMUX #[fg=#FFC387,bg=#181825]"
// mode_default_to_mode "tmux"
tab_normal "#[fg=#181825,bg=#4C4C59] #[fg=#000000,bg=#4C4C59]{index} {name} #[fg=#4C4C59,bg=#181825]"
tab_normal_fullscreen "#[fg=#6C7086,bg=#181825] {index} {name} [] "
tab_normal_sync "#[fg=#6C7086,bg=#181825] {index} {name} <> "
tab_active "#[fg=#181825,bg=#ffffff,bold,italic] {index} {name} #[fg=#ffffff,bg=#181825]"
tab_active_fullscreen "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} [] "
tab_active_sync "#[fg=#9399B2,bg=#181825,bold,italic] {index} {name} <> "
datetime "#[fg=#9399B2,bg=#181825] {format}"
datetime_format "%A, %d %b %Y %H:%M"
datetime_timezone "Asia/Kolkata"
}
}
}
'';
};
}

12
home/programs/zoxide.nix Normal file
View File

@@ -0,0 +1,12 @@
{
pkgs,
lib,
device,
...
}: {
programs.zoxide = {
enable = true;
enableFishIntegration = true;
enableNushellIntegration = true;
};
}