This commit is contained in:
death916 2025-05-15 03:27:11 -07:00
parent e0b11c8bfa
commit e1b8b8bea7
2 changed files with 119 additions and 80 deletions

View file

@ -1,58 +1,51 @@
{ config, pkgs, ... }:
# ~/Documents/nix-config/home-manager/home.nix
{ config, pkgs, lib, ... }: # These arguments are provided by Home Manager
let
# Path to the directory containing the tmuxai package's default.nix
# This path is relative to THIS home.nix file.
# From home-manager/ up to nix-config/, then down into pkgs/tmuxai/
tmuxaiPackageDir = ../pkgs/tmuxai;
# Let pkgs.callPackage handle the import and argument passing for the derivation
tmuxai-pkg = pkgs.callPackage tmuxaiPackageDir {
# No explicit arguments like `cacert` needed here,
# pkgs.callPackage will find `cacert = pkgs.cacert` automatically.
};
# Path to your tmuxai configuration template
tmuxaiConfigTemplatePath = ../pkgs/tmuxai/tmuxai-config.yaml;
in
{
# TODO please change the username & home directory to your own
home.username = "death916";
home.homeDirectory = "/home/death916";
# link the configuration file in current directory to the specified location in home directory
# home.file.".config/i3/wallpaper.jpg".source = ./wallpaper.jpg;
# link all files in `./scripts` to `~/.config/i3/scripts`
# home.file.".config/i3/scripts" = {
# source = ./scripts;
# recursive = true; # link recursively
# executable = true; # make all files executable
# };
# encode the file content in nix configuration file directly
# home.file.".xxx".text = ''
# xxx
# '';
# set cursor size and dpi for 4k monitor
xresources.properties = {
"Xcursor.size" = 16;
"Xft.dpi" = 172;
};
# Packages that should be installed to the user profile.
home.packages = with pkgs; [
# here is some command line tools I use frequently
# feel free to add your own or remove some of them
# ... (your other packages from before) ...
fastfetch
nnn # terminal file manager
# archives
nnn
zip
xz
unzip
p7zip
# utils
ripgrep # recursively searches directories for a regex pattern
jq # A lightweight and flexible command-line JSON processor
yq-go # yaml processor https://github.com/mikefarah/yq
eza # A modern replacement for ls
fzf # A command-line fuzzy finder
# networking tools
mtr # A network diagnostic tool
ripgrep
jq
yq-go
eza
fzf
mtr
iperf3
dnsutils # `dig` + `nslookup`
ldns # replacement of `dig`, it provide the command `drill`
aria2 # A lightweight multi-protocol & multi-source command-line download utility
socat # replacement of openbsd-netcat
nmap # A utility for network discovery and security auditing
ipcalc # it is a calculator for the IPv4/v6 addresses
# misc
dnsutils
ldns
aria2
socat
nmap
ipcalc
cowsay
file
which
@ -62,36 +55,29 @@
gawk
zstd
gnupg
# nix related
#
# it provides the command `nom` works just like `nix`
# with more details log output
nix-output-monitor
# productivity
glow # markdown previewer in terminal
btop # replacement of htop/nmon
iotop # io monitoring
iftop # network monitoring
# system call monitoring
strace # system call monitoring
ltrace # library call monitoring
lsof # list open files
# system tools
glow
btop
iotop
iftop
strace
ltrace
lsof
sysstat
lm_sensors # for `sensors` command
lm_sensors
ethtool
pciutils # lspci
usbutils # lsusb
# death916 tools
pciutils
usbutils
waveterm
halloy
tmux
tmux # tmuxai needs this
nextcloud-client
(nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" ]; })
# Add the tmuxai package
tmuxai-pkg
];
# basic configuration of git, please change to your own
programs.git = {
enable = true;
userName = "death916";
@ -101,10 +87,8 @@
};
};
# starship - an customizable prompt for any shell
programs.starship = {
enable = true;
# custom settings
settings = {
add_newline = false;
aws.disabled = true;
@ -113,32 +97,25 @@
};
};
# alacritty - a cross-platform, GPU-accelerated terminal emulator
programs.alacritty = {
enable = true;
# custom settings
settings = {
env.TERM = "xterm-256color";
font = {
size = 12;
};
scrolling.multiplier = 5;
selection.save_to_clipboard = true;
};
};
services.gnome-keyring.enable = true;
# services.desktopManager.cosmic.enable = true;
services.gnome-keyring.enable = true;
programs.bash = {
enable = true;
enableCompletion = true;
# TODO add your custom bashrc here
bashrcExtra = ''
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
'';
# set some aliases, feel free to add more or remove some
shellAliases = {
k = "kubectl";
pimox = "tailscale ssh pimox";
@ -148,16 +125,18 @@
};
};
# This value determines the home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new home Manager release introduces backwards
# incompatible changes.
#
# You can update home Manager without changing this value. See
# the home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "24.11";
# tmuxai configuration file
xdg.configFile."tmuxai/config.yaml" = {
# Use the `lib` passed to this module, which includes Home Manager's helpers
source = lib.mkOutOfStoreSymlink tmuxaiConfigTemplatePath;
};
# Let home Manager install and manage itself.
# Environment variables for tmuxai (e.g., API key)
# Manage secrets securely!
home.sessionVariables = {
# TMUXAI_OPENROUTER_API_KEY = "your-secret-key-here";
};
home.stateVersion = "24.11";
programs.home-manager.enable = true;
}

60
pkgs/tmuxai/default.nix Normal file
View file

@ -0,0 +1,60 @@
# ~/Documents/nix-config/pkgs/tmuxai/default.nix
{ lib
, stdenv
, fetchFromGitHub
, buildGoModule
, cacert # Provided by pkgs.callPackage from pkgs.cacert
}:
buildGoModule rec {
pname = "tmuxai";
version = "1.0.3"; # Current release
src = fetchFromGitHub {
owner = "alvinunreal";
repo = "tmuxai";
rev = "46754690d4348a21c35ac3cc51c0b9f811597cf5"; # Specific commit for v1.0.3
# IMPORTANT: You MUST verify/correct this hash.
# The one from your previous message was: "sha256-V8ShkIJLHU6IsqNqrr2Ty1DmhAkQDF3XXXb2bBHCviw="
# If "XXX" is part of the hash, it's a placeholder.
# Get the correct hash by running in your terminal:
# nix-prefetch-github alvinunreal tmuxai --rev 46754690d4348a21c35ac3cc51c0b9f811597cf5
# Then copy the 'hash' field from the output here.
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; # <-- REPLACE THIS WITH CORRECT SRC HASH
};
# This will be filled in after the first failed build attempt.
# For now, use an empty string to trigger buildGoModule to tell you the correct hash.
vendorHash = ""; # <-- KEEP AS "" INITIALLY
ldflags = let
commitRevDate = src.revDate or "19700101"; # YYYYMMDD from fetchFromGitHub
formattedDate = lib.strings.substring 0 4 commitRevDate
+ "-" + lib.strings.substring 4 2 commitRevDate
+ "-" + lib.strings.substring 6 2 commitRevDate; # YYYY-MM-DD
actualShortRev = lib.strings.substring 0 7 src.rev; # First 7 chars of the full rev
in [
"-s -w"
"-X github.com/alvinunreal/tmuxai/internal.Version=v${version}"
"-X github.com/alvinunreal/tmuxai/internal.Commit=${actualShortRev}"
"-X github.com/alvinunreal/tmuxai/internal.Date=${formattedDate}"
];
# buildGoModule automatically sets CGO_ENABLED=0 if no Cgo is detected.
# cacert is needed for HTTPS calls made by the Go program.
nativeBuildInputs = [ cacert ];
meta = with lib; {
description = "Your intelligent pair programmer directly within your tmux sessions";
longDescription = ''
TmuxAI is an intelligent terminal assistant that lives inside your tmux sessions.
Unlike other CLI AI tools, TmuxAI observes and understands the content of your
tmux panes, providing assistance without requiring you to change your workflow
or interrupt your terminal sessions.
'';
homepage = "https://github.com/alvinunreal/tmuxai";
license = licenses.asl20;
maintainers = with maintainers; [ "death916" ]; # Your GitHub username
platforms = platforms.unix; # Linux and macOS
};
}