feat: setup base

This commit is contained in:
tux
2026-05-06 00:55:41 +05:30
parent a62346367f
commit 33408ed45e
35 changed files with 1730 additions and 0 deletions

13
modules/hm/core/hm.nix Normal file
View File

@@ -0,0 +1,13 @@
{
flake.modules.homeManager.core =
{ userName, ... }:
{
programs.home-manager.enable = true;
systemd.user.startServices = "sd-switch";
home = {
username = "${userName}";
homeDirectory = "/home/${userName}";
};
};
}

View File

@@ -0,0 +1,18 @@
{ inputs, ... }:
{
flake.modules.homeManager.core =
{
lib,
osConfig ? { },
...
}:
{
nixpkgs = lib.mkIf (!(osConfig.home-manager.useGlobalPkgs or false)) {
config = {
allowUnfree = true;
joypixels.acceptLicense = true;
};
overlays = builtins.attrValues inputs.self.overlays;
};
};
}

View File

@@ -0,0 +1,39 @@
{ inputs, ... }:
{
flake.modules.homeManager.desktop =
{
config,
pkgs,
lib,
...
}:
with lib;
let
cfg = config.tnix.services.lan-mouse;
in
{
imports = [ inputs.lan-mouse.homeManagerModules.default ];
options.tnix.services.lan-mouse = {
enable = mkEnableOption "Enable Lan-Mouse";
settings = mkOption {
type = (pkgs.formats.toml { }).type;
default = { };
description = ''
TOML configuration for lan-mouse.
See <https://github.com/feschber/lan-mouse/> for available options.
'';
};
};
config = mkIf cfg.enable {
programs.lan-mouse = {
enable = true;
systemd = true;
settings = cfg.settings;
};
};
};
}

5
modules/hm/shell/bat.nix Normal file
View File

@@ -0,0 +1,5 @@
{
flake.modules.homeManager.shell = {
programs.bat.enable = true;
};
}

12
modules/hm/shell/btop.nix Normal file
View File

@@ -0,0 +1,12 @@
{
flake.modules.homeManager.shell = {
programs.btop = {
enable = true;
settings = {
theme_background = false;
update_ms = 1000;
presets = "cpu:0:default mem:0:default net:0:default";
};
};
};
}

View File

@@ -0,0 +1,69 @@
{
flake.modules.homeManager.shell = {
home.file.".config/fastfetch/config.jsonc".text = ''
{
"$schema": "https://github.com/fastfetch-cli/fastfetch/raw/dev/doc/json_schema.json",
"logo": {
"type": "none",
},
"display": {
"separator": " ",
"key": {
"width": 18,
},
},
"modules": [
{
"key": " ",
"type": "custom",
},
{
"key": " \u001b[11D{#31} user",
"type": "title",
"format": "{1}",
},
{
"key": " \u001b[11D{#34} hname",
"type": "command",
"text": "hostname",
},
{
"key": " \u001b[11D{#34}󰻀 distro",
"type": "os",
},
{
"key": " \u001b[11D{#35}󰌢 kernel",
"type": "kernel",
},
{
"key": " \u001b[11D{#31} uptime",
"type": "uptime",
},
{
"key": " \u001b[11D{#32} shell",
"type": "shell",
},
{
"key": " \u001b[11D{#35} memory",
"type": "memory",
},
{
"key": " ",
"type": "custom",
},
{
"key": " \u001b[11D{#39} colors",
"type": "colors",
"symbol": "circle",
},
{
"key": " ",
"type": "custom",
},
],
}
'';
programs.fastfetch.enable = true;
};
}

8
modules/hm/shell/fzf.nix Normal file
View File

@@ -0,0 +1,8 @@
{
flake.modules.homeManager.shell = {
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
};
}

26
modules/hm/shell/git.nix Normal file
View File

@@ -0,0 +1,26 @@
{
flake.modules.homeManager.shell =
{
userName,
userEmail,
...
}:
{
programs.git = {
enable = true;
signing = {
key = "~/.ssh/id_ed25519.pub";
signByDefault = true;
};
settings = {
user = {
name = "${userName}";
email = "${userEmail}";
};
init.defaultBranch = "main";
commit.gpgSign = true;
gpg.format = "ssh";
};
};
};
}

View File

@@ -0,0 +1,173 @@
{
flake.modules.homeManager.shell = {
programs.lazygit = {
enable = true;
settings = {
gui = {
showIcons = true;
nerdFontsVersion = "3";
};
customCommands = [
{
key = "<c-a>";
description = "AI-powered conventional commit";
context = "global";
command = "git commit -m \"{{.Form.CommitMsg}}\"";
loadingText = "Generating commit messages...";
prompts = [
{
type = "menu";
key = "Type";
title = "Type of change";
options = [
{
name = "AI defined";
description = "Let AI analyze and determine the best commit type";
value = "ai-defined";
}
{
name = "build";
description = "Changes that affect the build system or external dependencies";
value = "build";
}
{
name = "feat";
description = "A new feature";
value = "feat";
}
{
name = "fix";
description = "A bug fix";
value = "fix";
}
{
name = "chore";
description = "Other changes that don't modify src or test files";
value = "chore";
}
{
name = "ci";
description = "Changes to CI configuration files and scripts";
value = "ci";
}
{
name = "docs";
description = "Documentation only changes";
value = "docs";
}
{
name = "perf";
description = "A code change that improves performance";
value = "perf";
}
{
name = "refactor";
description = "A code change that neither fixes a bug nor adds a feature";
value = "refactor";
}
{
name = "revert";
description = "Reverts a previous commit";
value = "revert";
}
{
name = "style";
description = "Changes that do not affect the meaning of the code";
value = "style";
}
{
name = "test";
description = "Adding missing tests or correcting existing tests";
value = "test";
}
];
}
{
type = "menuFromCommand";
title = "AI Generated Commit Messages";
key = "CommitMsg";
command = ''
bash -c "
# Check for staged changes
diff=\$(git diff --cached | head -n 10)
if [ -z \"\$diff\" ]; then
echo \"No changes in staging. Add changes first.\"
exit 1
fi
SELECTED_TYPE=\"{{.Form.Type}}\"
COMMITS_TO_SUGGEST=8
opencode run -m \"google/gemini-2.5-flash-lite\" \"
You are an expert at writing Git commits. Your job is to write commit messages that follow the Conventional Commits format.
The user has selected: \$SELECTED_TYPE
Your task is to:
1. Analyze the code changes
2. Determine the most appropriate commit type (if user selected 'ai-defined')
3. Determine an appropriate scope (component/area affected)
4. Decide if this is a breaking change
5. Write clear, concise commit messages
Available commit types:
- feat: A new feature
- fix: A bug fix
- docs: Documentation only changes
- style: Changes that do not affect the meaning of the code
- refactor: A code change that neither fixes a bug nor adds a feature
- perf: A code change that improves performance
- test: Adding missing tests or correcting existing tests
- build: Changes that affect the build system or external dependencies
- ci: Changes to CI configuration files and scripts
- chore: Other changes that don't modify src or test files
- revert: Reverts a previous commit
Follow these guidelines:
- Structure: <type>(<scope>): <description>
- If user selected 'ai-defined', analyze the changes and pick the most suitable type
- If user selected a specific type, use that type: \$SELECTED_TYPE
- Add scope in parentheses if applicable (e.g., auth, api, ui, config)
- Use exclamation mark (!) after type/scope for breaking changes: type(scope)!: description
- Use lowercase for description (except proper nouns)
- Use imperative mood (\\\"add\\\", not \\\"added\\\")
- Keep description under 50 characters when possible
- No period at the end of subject line
Examples:
- feat(auth): add OAuth login support
- fix(api): handle null response in user endpoint
- docs(readme): update installation instructions
- style(ui): improve button spacing consistency
- refactor(database): simplify query builder logic
- test(auth): add unit tests for login flow
- build(deps): upgrade React to version 18
- ci(github): fix deployment workflow
- chore(config): update ESLint rules
- perf(api)!: optimize database queries
IMPORTANT:
- Generate exactly \$COMMITS_TO_SUGGEST different commit message options
- If user selected 'ai-defined', you can use different types for different options
- If user selected a specific type, all messages must use that type
- Only return commit messages, no explanations
- Do not use markdown code blocks
- One message per line
Previous commits for context:
\$(git log --oneline -10)
Changes to analyze:
\$(git diff --cached --stat)
\$(git diff --cached)
\"
"
'';
}
];
}
];
};
};
};
}

8
modules/hm/shell/lsd.nix Normal file
View File

@@ -0,0 +1,8 @@
{
flake.modules.homeManager.shell = {
programs.lsd = {
enable = true;
enableZshIntegration = true;
};
};
}

View File

@@ -0,0 +1,42 @@
{
flake.modules.homeManager.shell =
{ pkgs, ... }:
{
home.file = {
".config/nvim" = {
recursive = true;
source = "${pkgs.tnvim}";
};
};
programs = {
neovim = {
enable = true;
defaultEditor = true;
vimAlias = true;
};
};
home = {
packages = with pkgs; [
gcc
neovide
# nix
nil # Language Server
statix # Lints and suggestions
deadnix # Find and remove unused
alejandra # Code Formatter
# lua
luarocks
# ts
typescript
gdu
ripgrep
];
};
};
}

View File

@@ -0,0 +1,24 @@
{
flake.modules.homeManager.shell = {
programs.opencode = {
enable = true;
tui = {
theme = "system";
};
settings = {
provider = {
google = {
options = {
apiKey = "{file:/run/secrets/gemini_api_key}";
};
};
openrouter = {
options = {
apiKey = "{file:/run/secrets/open_router_api_key}";
};
};
};
};
};
};
}

View File

@@ -0,0 +1,5 @@
{
flake.modules.homeManager.shell = {
programs.ripgrep.enable = true;
};
}

View File

@@ -0,0 +1,52 @@
{
flake.modules.homeManager.shell = {
programs.starship = {
enable = true;
settings = {
format = "$os$hostname$directory$rust$golang$solidity$nodejs(bold blue)$git_branch$git_status[](bold yellow)[](bold purple)[](bold blue) ";
scan_timeout = 60;
add_newline = false;
line_break.disabled = true;
os = {
format = "[$symbol ]($style)";
style = "bold green";
disabled = false;
symbols.NixOS = "󰊠";
symbols.Linux = "󰊠";
symbols.Arch = "󰣇";
symbols.Ubuntu = "󰕈";
};
directory = {
format = "[$path]($style)[$read_only ]($read_only_style)";
read_only = " 󰌾";
style = "bold blue";
};
git_branch.format = "[$symbol$branch]($style) ";
hostname = {
ssh_only = false;
format = "[$ssh_symbol$hostname]($style) ";
style = "bold green";
ssh_symbol = "󰇧 ";
disabled = false;
};
rust = {
format = "[$symbol]($style)";
symbol = " ";
};
golang = {
format = "[$symbol]($style)";
symbol = " ";
};
solidity = {
format = "[$symbol]($style)";
symbol = "󰡪 ";
};
nodejs = {
format = "[$symbol]($style)";
symbol = "󰎙 ";
};
};
};
};
}

View File

@@ -0,0 +1,43 @@
{
flake.modules.homeManager.shell = {
programs.superfile = {
enable = true;
settings = {
theme = "poimandres";
editor = "";
dir_editor = "";
auto_check_update = false;
cd_on_quit = false;
default_open_file_preview = true;
show_image_preview = true;
show_panel_footer_info = true;
default_directory = "~";
file_size_use_si = false;
default_sort_type = 0;
sort_order_reversed = false;
case_sensitive_sort = false;
shell_close_on_success = false;
debug = false;
ignore_missing_fields = false;
nerdfont = true;
transparent_background = true;
file_preview_width = 0;
code_previewer = "bat";
sidebar_width = 20;
border_top = "";
border_bottom = "";
border_left = "";
border_right = "";
border_top_left = "";
border_top_right = "";
border_bottom_left = "";
border_bottom_right = "";
border_middle_left = "";
border_middle_right = "";
metadata = true;
zoxide_support = true;
enable_md5_checksum = false;
};
};
};
}

155
modules/hm/shell/tmux.nix Normal file
View File

@@ -0,0 +1,155 @@
{
flake.modules.homeManager.shell =
{ pkgs, ... }:
let
bg = "default";
fg = "default";
bg2 = "brightblack";
fg2 = "white";
color = c: "#{@${c}}";
indicator =
let
accent = color "indicator_color";
content = " ";
in
"#[reverse,fg=${accent}]#{?client_prefix,${content},}";
current_window =
let
accent = color "main_accent";
index = "#[reverse,fg=${accent},bg=${fg}] #I ";
name = "#[fg=${bg2},bg=${fg2}] #W ";
# flags = "#{?window_flags,#{window_flags}, }";
in
"${index}${name}";
window_status =
let
accent = color "window_color";
index = "#[reverse,fg=${accent},bg=${fg}] #I ";
name = "#[fg=${bg2},bg=${fg2}] #W ";
# flags = "#{?window_flags,#{window_flags}, }";
in
"${index}${name}";
battery =
let
percentage = pkgs.writeShellScript "percentage" (
if pkgs.stdenv.isDarwin then
''
echo $(pmset -g batt | grep -o "[0-9]\+%" | tr '%' ' ')
''
else
''
path="/org/freedesktop/UPower/devices/DisplayDevice"
echo $(${pkgs.upower}/bin/upower -i $path | grep -o "[0-9]\+%" | tr '%' ' ')
''
);
state = pkgs.writeShellScript "state" (
if pkgs.stdenv.isDarwin then
''
echo $(pmset -g batt | awk '{print $4}')
''
else
''
path="/org/freedesktop/UPower/devices/DisplayDevice"
echo $(${pkgs.upower}/bin/upower -i $path | grep state | awk '{print $2}')
''
);
icon = pkgs.writeShellScript "icon" ''
percentage=$(${percentage})
state=$(${state})
if [ "$state" == "charging" ] || [ "$state" == "fully-charged" ]; then echo "󰂄"
elif [ $percentage -ge 75 ]; then echo "󱊣"
elif [ $percentage -ge 50 ]; then echo "󱊢"
elif [ $percentage -ge 25 ]; then echo "󱊡"
elif [ $percentage -ge 0 ]; then echo "󰂎"
fi
'';
color = pkgs.writeShellScript "color" ''
percentage=$(${percentage})
state=$(${state})
if [ "$state" == "charging" ] || [ "$state" == "fully-charged" ]; then echo "green"
elif [ $percentage -ge 75 ]; then echo "green"
elif [ $percentage -ge 50 ]; then echo "${fg2}"
elif [ $percentage -ge 30 ]; then echo "yellow"
elif [ $percentage -ge 0 ]; then echo "red"
fi
'';
in
"#[fg=#(${color})]#(${icon}) #[fg=${fg}]#(${percentage})%";
pwd =
let
accent = color "main_accent";
icon = "#[fg=${accent}] ";
format = "#[fg=${fg}]#{b:pane_current_path}";
in
"${icon}${format}";
git =
let
icon = pkgs.writeShellScript "branch" ''
git -C "$1" branch && echo " "
'';
branch = pkgs.writeShellScript "branch" ''
git -C "$1" rev-parse --abbrev-ref HEAD
'';
in
"#[fg=magenta]#(${icon} #{pane_current_path})#(${branch} #{pane_current_path})";
separator = "#[fg=${fg}]|";
in
{
programs.tmux = {
enable = true;
baseIndex = 1;
escapeTime = 0;
mouse = true;
extraConfig = ''
set-option -sa terminal-overrides ",xterm*:Tc"
set-option -g status-position top
unbind r
bind r source-file ~/.config/tmux/tmux.conf
# remap prefix from C-b to C-Space
# unbind C-b
# set -g prefix C-Space
# bind C-Space send-prefix
# split panes using | and -
unbind '"'
unbind %
bind | split-window -h
bind - split-window -v
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set-window-option -g pane-base-index 1
set-option -g renumber-windows on
# switch panes using Alt-arrow without prefix
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
set-option -g default-terminal "screen-256color"
set-option -g status-right-length 100
set-option -g @indicator_color "yellow"
set-option -g @window_color "magenta"
set-option -g @main_accent "blue"
set-option -g pane-active-border fg=black
set-option -g pane-border-style fg=black
set-option -g status-style "bg=${bg} fg=${fg}"
set-option -g status-left "${indicator}"
set-option -g status-right "${git} ${pwd} ${separator} ${battery}"
set-option -g window-status-current-format "${current_window}"
set-option -g window-status-format "${window_status}"
set-option -g window-status-separator ""
'';
};
};
}

View File

@@ -0,0 +1,9 @@
{
flake.modules.homeManager.shell = {
programs.zoxide = {
enable = true;
options = [ "--cmd cd" ];
enableZshIntegration = true;
};
};
}

27
modules/hm/shell/zsh.nix Normal file
View File

@@ -0,0 +1,27 @@
{ lib, ... }:
{
flake.modules.homeManager.shell =
{ pkgs, ... }:
{
programs.zsh = {
enable = true;
history = {
append = true;
share = true;
expireDuplicatesFirst = true;
ignoreDups = true;
size = 1000000;
save = 1000000;
path = "$HOME/.local/share/zsh/.zsh_history";
};
syntaxHighlighting.enable = true;
autosuggestion.enable = true;
initContent = ''
${lib.getExe pkgs.fastfetch}
bindkey "^A" vi-beginning-of-line
bindkey "^E" vi-end-of-line
bindkey '^R' fzf-history-widget
'';
};
};
}