linux init

This commit is contained in:
Harivansh Rathi 2026-03-22 14:44:00 -04:00
parent 8ed16afd7d
commit 24b16cba14
13 changed files with 338 additions and 209 deletions

24
home/common.nix Normal file
View file

@ -0,0 +1,24 @@
{...}: {
imports = [
./bat.nix
./eza.nix
./claude.nix
./codex.nix
./fzf.nix
./gcloud.nix
./gh.nix
./ghostty.nix
./git.nix
./k9s.nix
./lazygit.nix
./migration.nix
./nvim.nix
./scripts.nix
./tmux.nix
./zsh.nix
];
home.stateVersion = "24.11";
programs.home-manager.enable = true;
xdg.enable = true;
}

View file

@ -1,26 +1,7 @@
{...}: {
imports = [
./bat.nix
./eza.nix
./claude.nix
./codex.nix
./fzf.nix
./gcloud.nix
./gh.nix
./ghostty.nix
./git.nix
./common.nix
./karabiner.nix
./k9s.nix
./lazygit.nix
./migration.nix
./nvim.nix
./rectangle.nix
./scripts.nix
./tmux.nix
./zsh.nix
];
home.stateVersion = "24.11";
programs.home-manager.enable = true;
xdg.enable = true;
}

View file

@ -1,5 +1,6 @@
{
config,
lib,
pkgs,
...
}: let
@ -38,8 +39,10 @@
keybind = vim/i=deactivate_key_table
keybind = vim/catch_all=ignore
mouse-hide-while-typing = true
macos-titlebar-style = hidden
macos-option-as-alt = true
${lib.optionalString pkgs.stdenv.isDarwin ''
macos-titlebar-style = hidden
macos-option-as-alt = true
''}
confirm-close-surface = true
window-title-font-family = VictorMono NFM Italic
window-padding-balance = true
@ -52,7 +55,10 @@
in {
programs.ghostty = {
enable = true;
package = pkgs.ghostty-bin;
package =
if pkgs.stdenv.isDarwin
then pkgs.ghostty-bin
else pkgs.ghostty;
installBatSyntax = true;
};
@ -64,8 +70,10 @@ in {
xdg.configFile."ghostty/themes/cozybox-dark".text = theme.renderGhostty "dark";
xdg.configFile."ghostty/themes/cozybox-light".text = theme.renderGhostty "light";
home.file."Library/Application Support/com.mitchellh.ghostty/config.ghostty" = {
text = ghosttyConfig;
force = true;
home.file = lib.mkIf pkgs.stdenv.isDarwin {
"Library/Application Support/com.mitchellh.ghostty/config.ghostty" = {
text = ghosttyConfig;
force = true;
};
};
}

View file

@ -1,4 +1,12 @@
{...}: {
home.file."Library/Application Support/lazygit/config.yml".source =
../config/lazygit/config.yml;
{
lib,
pkgs,
...
}: {
xdg.configFile."lazygit/config.yml".source = ../config/lazygit/config.yml;
home.file = lib.mkIf pkgs.stdenv.isDarwin {
"Library/Application Support/lazygit/config.yml".source =
../config/lazygit/config.yml;
};
}

5
home/linux.nix Normal file
View file

@ -0,0 +1,5 @@
{...}: {
imports = [
./common.nix
];
}

View file

@ -22,43 +22,53 @@
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
co = "codex --dangerously-bypass-approvals-and-sandbox";
ca = "cursor-agent";
cc = "claude";
ch = "claude-handoff";
cl = "clear";
gc = "git commit";
gd = "git diff";
gk = "git checkout";
gp = "git push";
gpo = "git pull origin";
gs = "git status";
ld = "lumen diff";
lg = "lazygit";
nim = "nvim .";
sshnet = "ssh -i ~/.ssh/atlas-ssh.txt rathiharivansh@152.53.195.59";
tailscale = "/Applications/Tailscale.app/Contents/MacOS/Tailscale";
shellAliases =
{
co = "codex --dangerously-bypass-approvals-and-sandbox";
ca = "cursor-agent";
cc = "claude";
ch = "claude-handoff";
cl = "clear";
gc = "git commit";
gd = "git diff";
gk = "git checkout";
gp = "git push";
gpo = "git pull origin";
gs = "git status";
ld = "lumen diff";
lg = "lazygit";
nim = "nvim .";
sshnet = "ssh -i ~/.ssh/atlas-ssh.txt rathiharivansh@152.53.195.59";
# nix helpers
nr = "nix profile remove"; # nr <index> - remove from profile
ns = "nix search nixpkgs"; # ns <query> - search packages
nls = "nix profile list"; # nls - list installed profile packages
nrb = "sudo darwin-rebuild switch --flake ~/Documents/GitHub/nix"; # nrb - rebuild declarative config
nup = "nix flake update ~/Documents/GitHub/nix && sudo darwin-rebuild switch --flake ~/Documents/GitHub/nix"; # nup - update flake + rebuild
# nix helpers
nr = "nix profile remove"; # nr <index> - remove from profile
ns = "nix search nixpkgs"; # ns <query> - search packages
nls = "nix profile list"; # nls - list installed profile packages
}
// lib.optionalAttrs pkgs.stdenv.isDarwin {
tailscale = "/Applications/Tailscale.app/Contents/MacOS/Tailscale";
nrb = "sudo darwin-rebuild switch --flake path:$HOME/Documents/GitHub/nix#hari-macbook-pro"; # nrb - rebuild declarative config
nup = "nix flake update $HOME/Documents/GitHub/nix && sudo darwin-rebuild switch --flake path:$HOME/Documents/GitHub/nix#hari-macbook-pro"; # nup - update flake + rebuild
}
// lib.optionalAttrs pkgs.stdenv.isLinux {
nrb = "nix run github:nix-community/home-manager -- switch --flake path:$HOME/Documents/GitHub/nix#workstation -b hm-bak"; # nrb - rebuild declarative config
nup = "nix flake update $HOME/Documents/GitHub/nix && nix run github:nix-community/home-manager -- switch --flake path:$HOME/Documents/GitHub/nix#workstation -b hm-bak"; # nup - update flake + rebuild
};
envExtra = ''
if [[ -f "$HOME/.cargo/env" ]]; then
. "$HOME/.cargo/env"
fi
# Ghostty shell integration expects a resource directory; the Nix app
# bundle lives in the store instead of /Applications.
export GHOSTTY_RESOURCES_DIR="${pkgs.ghostty-bin}/Applications/Ghostty.app/Contents/Resources/ghostty"
export MANPAGER="nvim +Man!"
'';
envExtra =
''
if [[ -f "$HOME/.cargo/env" ]]; then
. "$HOME/.cargo/env"
fi
''
+ lib.optionalString pkgs.stdenv.isDarwin ''
# Ghostty shell integration expects a resource directory; the Nix app
# bundle lives in the store instead of /Applications.
export GHOSTTY_RESOURCES_DIR="${pkgs.ghostty-bin}/Applications/Ghostty.app/Contents/Resources/ghostty"
''
+ ''
export MANPAGER="nvim +Man!"
'';
initContent = lib.mkMerge [
(lib.mkOrder 550 ''
@ -88,7 +98,11 @@
[ -s "$HOME/.bun/_bun" ] && source "$HOME/.bun/_bun"
export BUN_INSTALL="$HOME/.bun"
export PNPM_HOME="$HOME/Library/pnpm"
export PNPM_HOME="${
if pkgs.stdenv.isDarwin
then "$HOME/Library/pnpm"
else "${config.xdg.dataHome}/pnpm"
}"
bindkey -v
typeset -U path PATH
path=(
@ -103,8 +117,10 @@
"/etc/profiles/per-user/${config.home.username}/bin"
"/run/current-system/sw/bin"
"/nix/var/nix/profiles/default/bin"
${lib.optionalString pkgs.stdenv.isDarwin ''
"/opt/homebrew/bin"
"/opt/homebrew/sbin"
''}
$path
)