mirror of
https://github.com/ryanccn/flake.git
synced 2025-12-06 16:10:45 +01:00
feat: initial commit
This commit is contained in:
commit
dd089fe75c
21 changed files with 983 additions and 0 deletions
9
programs/bat.nix
Normal file
9
programs/bat.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{...}: {
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
catppuccin.enable = true;
|
||||
# config = {
|
||||
# theme = "Catppuccin-frappe";
|
||||
# };
|
||||
};
|
||||
}
|
||||
27
programs/fish.nix
Normal file
27
programs/fish.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{...}: {
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
shellAbbrs = {
|
||||
"vim" = "hx";
|
||||
"ls" = "exa --all --icons";
|
||||
"dig" = "doggo";
|
||||
|
||||
"glol" = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'";
|
||||
"ghrvw" = "gh repo view --web";
|
||||
|
||||
"opr" = "op run --env-file=.env.1password --";
|
||||
"dr" = "doppler run --";
|
||||
|
||||
"dequarantine" = "xattr -d com.apple.quarantine";
|
||||
|
||||
"bcpa" = "brew cleanup --prune=all";
|
||||
"puil" = "pnpm update --interactive --latest";
|
||||
"pip-upgrade-all" = "pip --disable-pip-version-check list --outdated --format=json | python -c \"import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))\" | xargs -n1 pip install -U";
|
||||
};
|
||||
};
|
||||
|
||||
home.file.".config/fish/conf.d" = {
|
||||
source = ./fish/conf.d;
|
||||
recursive = true;
|
||||
};
|
||||
}
|
||||
6
programs/fish/conf.d/01_basic_env.fish
Normal file
6
programs/fish/conf.d/01_basic_env.fish
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# basic environment variables
|
||||
set -x LANG en_US.UTF-8
|
||||
set -x EDITOR "hx"
|
||||
set -x PAGER "less"
|
||||
set -x LESS "-R"
|
||||
set -x LS_COLORS "$(vivid generate catppuccin-frappe)"
|
||||
51
programs/fish/conf.d/02_tooling.fish
Normal file
51
programs/fish/conf.d/02_tooling.fish
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
# 1Password SSH
|
||||
set -x SSH_AUTH_SOCK "$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
||||
|
||||
# Homebrew shell
|
||||
set -x HOMEBREW_NO_ANALYTICS 1
|
||||
set -x HOMEBREW_CASK_OPTS "--require-sha"
|
||||
set -x HOMEBREW_NO_INSECURE_REDIRECT 1
|
||||
set -x HOMEBREW_NO_EMOJI 1
|
||||
/opt/homebrew/bin/brew shellenv | source
|
||||
|
||||
# ccache
|
||||
fish_add_path "$(brew --prefix ccache)/libexec"
|
||||
|
||||
# fnm shell env
|
||||
fnm env --use-on-cd | source
|
||||
|
||||
# pyenv
|
||||
set -x PYENV_ROOT "$HOME/.pyenv"
|
||||
set -x PATH "$PYENV_ROOT/bin:$PATH"
|
||||
pyenv init - | source
|
||||
set -x PIPX_DEFAULT_PYTHON "$HOME/.pyenv/shims/python"
|
||||
|
||||
# cargo
|
||||
fish_add_path "$HOME/.cargo/bin"
|
||||
# deno
|
||||
fish_add_path "$HOME/.deno/bin"
|
||||
|
||||
# pnpm
|
||||
set -x PNPM_HOME "$HOME/Library/pnpm"
|
||||
|
||||
# disable telemetry
|
||||
set -x NEXT_TELEMETRY_DISABLED 1 # Next.js
|
||||
set -x CHECKPOINT_DISABLE 1 # Prisma
|
||||
set -x DISABLE_TELEMETRY YES # diffusers
|
||||
|
||||
# go
|
||||
set -x GOPATH "$HOME/.go"
|
||||
fish_add_path "$GOPATH/bin"
|
||||
|
||||
# direnv
|
||||
set -x DIRENV_LOG_FORMAT ""
|
||||
|
||||
# docker
|
||||
fish_add_path "$HOME/.docker/bin"
|
||||
# local bin
|
||||
fish_add_path "$HOME/.local/bin"
|
||||
# nish
|
||||
fish_add_path "$HOME/dev/nish/bin"
|
||||
|
||||
# fish
|
||||
set fish_greeting
|
||||
13
programs/fish/conf.d/99_interactive.fish
Normal file
13
programs/fish/conf.d/99_interactive.fish
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
if status is-interactive
|
||||
# starship
|
||||
starship init fish | source
|
||||
# zoxide
|
||||
zoxide init fish | source
|
||||
# direnv
|
||||
direnv hook fish | source
|
||||
|
||||
set -x FZF_DEFAULT_OPTS " \
|
||||
--color=bg+:#414559,bg:#303446,spinner:#f2d5cf,hl:#e78284 \
|
||||
--color=fg:#c6d0f5,header:#e78284,info:#ca9ee6,pointer:#f2d5cf \
|
||||
--color=marker:#f2d5cf,fg+:#c6d0f5,prompt:#ca9ee6,hl+:#e78284"
|
||||
end
|
||||
30
programs/git.nix
Normal file
30
programs/git.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{pkgs, ...}: {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitAndTools.gitFull;
|
||||
|
||||
diff-so-fancy.enable = true;
|
||||
ignores = [
|
||||
".DS_Store"
|
||||
];
|
||||
|
||||
userName = "Ryan Cao";
|
||||
userEmail = "70191398+ryanccn@users.noreply.github.com";
|
||||
|
||||
extraConfig = {
|
||||
user.signingkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM4VfgP5+HdCmM/VpTcW8jLKLyR8s0qqoIDXv7iTnWlR";
|
||||
init.defaultBranch = "main";
|
||||
|
||||
commit.gpgsign = true;
|
||||
gpg.format = "ssh";
|
||||
"gpg \"ssh\"".program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
|
||||
|
||||
push.autoSetupRemote = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
enableGitCredentialHelper = true;
|
||||
};
|
||||
}
|
||||
6
programs/helix.nix
Normal file
6
programs/helix.nix
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{...}: {
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
catppuccin.enable = true;
|
||||
};
|
||||
}
|
||||
3
programs/starship.nix
Normal file
3
programs/starship.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{...}: {
|
||||
home.file.".config/starship.toml".source = ./starship/starship.toml;
|
||||
}
|
||||
145
programs/starship/starship.toml
Normal file
145
programs/starship/starship.toml
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
"$schema" = 'https://starship.rs/config-schema.json'
|
||||
|
||||
[character]
|
||||
success_symbol = "[➜](bold green)"
|
||||
error_symbol = "[➜](bold red)"
|
||||
|
||||
[aws]
|
||||
symbol = " "
|
||||
|
||||
[buf]
|
||||
symbol = " "
|
||||
|
||||
[c]
|
||||
symbol = " "
|
||||
|
||||
[conda]
|
||||
symbol = " "
|
||||
|
||||
[dart]
|
||||
symbol = " "
|
||||
|
||||
[directory]
|
||||
read_only = " "
|
||||
|
||||
[docker_context]
|
||||
symbol = " "
|
||||
|
||||
[elixir]
|
||||
symbol = " "
|
||||
|
||||
[elm]
|
||||
symbol = " "
|
||||
|
||||
[fossil_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_branch]
|
||||
symbol = " "
|
||||
|
||||
[golang]
|
||||
symbol = " "
|
||||
|
||||
[guix_shell]
|
||||
symbol = " "
|
||||
|
||||
[haskell]
|
||||
symbol = " "
|
||||
|
||||
[haxe]
|
||||
symbol = "⌘ "
|
||||
|
||||
[hg_branch]
|
||||
symbol = " "
|
||||
|
||||
[hostname]
|
||||
ssh_symbol = " "
|
||||
|
||||
[java]
|
||||
symbol = " "
|
||||
|
||||
[julia]
|
||||
symbol = " "
|
||||
|
||||
[lua]
|
||||
symbol = " "
|
||||
|
||||
[memory_usage]
|
||||
symbol = " "
|
||||
|
||||
[meson]
|
||||
symbol = " "
|
||||
|
||||
[nim]
|
||||
symbol = " "
|
||||
|
||||
[nix_shell]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[os.symbols]
|
||||
Alpaquita = " "
|
||||
Alpine = " "
|
||||
Amazon = " "
|
||||
Android = " "
|
||||
Arch = " "
|
||||
Artix = " "
|
||||
CentOS = " "
|
||||
Debian = " "
|
||||
DragonFly = " "
|
||||
Emscripten = " "
|
||||
EndeavourOS = " "
|
||||
Fedora = " "
|
||||
FreeBSD = " "
|
||||
Garuda = " "
|
||||
Gentoo = " "
|
||||
HardenedBSD = " "
|
||||
Illumos = " "
|
||||
Linux = " "
|
||||
Mabox = " "
|
||||
Macos = " "
|
||||
Manjaro = " "
|
||||
Mariner = " "
|
||||
MidnightBSD = " "
|
||||
Mint = " "
|
||||
NetBSD = " "
|
||||
NixOS = " "
|
||||
OpenBSD = " "
|
||||
openSUSE = " "
|
||||
OracleLinux = " "
|
||||
Pop = " "
|
||||
Raspbian = " "
|
||||
Redhat = " "
|
||||
RedHatEnterprise = " "
|
||||
Redox = " "
|
||||
Solus = " "
|
||||
SUSE = " "
|
||||
Ubuntu = " "
|
||||
Unknown = " "
|
||||
Windows = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
[pijul_channel]
|
||||
symbol = "🪺 "
|
||||
|
||||
[python]
|
||||
symbol = " "
|
||||
|
||||
[rlang]
|
||||
symbol = " "
|
||||
|
||||
[ruby]
|
||||
symbol = " "
|
||||
|
||||
[rust]
|
||||
symbol = " "
|
||||
|
||||
[scala]
|
||||
symbol = " "
|
||||
|
||||
[spack]
|
||||
symbol = "🅢 "
|
||||
40
programs/zsh.nix
Normal file
40
programs/zsh.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{pkgs, ...}: {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableAutosuggestions = true;
|
||||
enableCompletion = true;
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
envExtra = builtins.readFile ./zsh/envExtra.zsh;
|
||||
initExtraBeforeCompInit = builtins.readFile ./zsh/initExtraBeforeCompInit.zsh;
|
||||
initExtra = builtins.readFile ./zsh/initExtra.zsh;
|
||||
|
||||
localVariables = {
|
||||
vivid_theme = "catppuccin-macchiato";
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "ohmyzsh-macos";
|
||||
file = "plugins/macos.zsh";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "ohmyzsh";
|
||||
repo = "ohmyzsh";
|
||||
rev = "c4392a4da31efee36f29a62d3951d5c0fcd7d4e6";
|
||||
sha256 = "sha256-cMJCmhtcCAVDFgp6Ryv/5DteSRtwNcemO97as8ill8I=";
|
||||
};
|
||||
}
|
||||
{
|
||||
name = "vivid-zsh";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "ryanccn";
|
||||
repo = "vivid-zsh";
|
||||
rev = "a76616c87821e96ae0cbdfb6bf897bffc170a283";
|
||||
sha256 = "sha256-E00xQMCmOt6fJ+IO/TrpFvskNa9QnDw/6DKR51T7i+8=";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
52
programs/zsh/envExtra.zsh
Normal file
52
programs/zsh/envExtra.zsh
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# 1Password SSH
|
||||
export SSH_AUTH_SOCK="$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
||||
|
||||
# Homebrew shell
|
||||
export HOMEBREW_NO_ANALYTICS=1
|
||||
export HOMEBREW_CASK_OPTS=--require-sha
|
||||
export HOMEBREW_NO_INSECURE_REDIRECT=1
|
||||
export HOMEBREW_NO_EMOJI=1
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
|
||||
# ccache
|
||||
export PATH="$(brew --prefix ccache)/libexec:$PATH"
|
||||
|
||||
# fnm shell env
|
||||
eval "$(fnm env --use-on-cd)"
|
||||
|
||||
# pyenv
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
command -v pyenv > /dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
eval "$(pyenv init -)"
|
||||
export PIPX_DEFAULT_PYTHON="$HOME/.pyenv/shims/python"
|
||||
|
||||
# cargo
|
||||
source "$HOME/.cargo/env"
|
||||
|
||||
# deno
|
||||
export PATH="$HOME/.deno/bin:$PATH"
|
||||
|
||||
# pnpm
|
||||
export PNPM_HOME="''${HOME}/Library/pnpm"
|
||||
export PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
# disable telemetry
|
||||
export NEXT_TELEMETRY_DISABLED=1 # Next.js
|
||||
export CHECKPOINT_DISABLE=1 # Prisma
|
||||
export DISABLE_TELEMETRY=YES # diffusers
|
||||
|
||||
# go
|
||||
export GOPATH="$HOME/.go"
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
|
||||
# direnv
|
||||
export DIRENV_LOG_FORMAT=""
|
||||
|
||||
# docker
|
||||
export PATH="$HOME/.docker/bin:$PATH"
|
||||
|
||||
# local bin
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
|
||||
# nish
|
||||
export PATH="$HOME/dev/nish/bin:$PATH"
|
||||
75
programs/zsh/initExtra.zsh
Normal file
75
programs/zsh/initExtra.zsh
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
# environment variables
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
export EDITOR="hx"
|
||||
export PAGER="less"
|
||||
export LESS="-R"
|
||||
|
||||
export FZF_DEFAULT_OPTS=" \
|
||||
--color=bg+:#414559,bg:#303446,spinner:#f2d5cf,hl:#e78284 \
|
||||
--color=fg:#c6d0f5,header:#e78284,info:#ca9ee6,pointer:#f2d5cf \
|
||||
--color=marker:#f2d5cf,fg+:#c6d0f5,prompt:#ca9ee6,hl+:#e78284"
|
||||
|
||||
# zsh options
|
||||
setopt interactivecomments
|
||||
unsetopt menu_complete
|
||||
unsetopt flowcontrol
|
||||
setopt auto_menu
|
||||
setopt complete_in_word
|
||||
setopt always_to_end
|
||||
|
||||
[ -f "$HOME/.config/tabtab/zsh/__tabtab.zsh" ] && . "$HOME/.config/tabtab/zsh/__tabtab.zsh" || true
|
||||
|
||||
# configure completion styles
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
|
||||
zstyle ':completion:*' group-name \'\'
|
||||
|
||||
# aliases
|
||||
alias vim="hx"
|
||||
alias ls="exa --all --icons"
|
||||
alias dig="doggo"
|
||||
|
||||
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'"
|
||||
alias ghrvw="gh repo view --web"
|
||||
|
||||
alias opr="op run --env-file=.env.1password --"
|
||||
alias dr="doppler run --"
|
||||
|
||||
alias dequarantine="xattr -d com.apple.quarantine"
|
||||
|
||||
alias bcpa="brew cleanup --prune=all"
|
||||
alias puil="pnpm update --interactive --latest"
|
||||
alias pip-upgrade-all="pip --disable-pip-version-check list --outdated --format=json | python -c \"import json, sys; print('\n'.join([x['name'] for x in json.load(sys.stdin)]))\" | xargs -n1 pip install -U"
|
||||
|
||||
function take() {
|
||||
mkdir "$1"
|
||||
cd "$1" || return 1
|
||||
}
|
||||
|
||||
function clean_vscode_workspace_storage() {
|
||||
for i in "$HOME/Library/Application Support/Code/User/workspaceStorage/"*; do
|
||||
if [ -f $i/workspace.json ]; then
|
||||
older="$(python3 -c "import sys, json; print(json.load(open(sys.argv[1], 'r'))['folder'])" $i/workspace.json 2>/dev/null | sed 's#^file://##;s/+/ /g;s/%\(..\)/\\x\1/g;')";
|
||||
if [ -n "$folder" ] && [ ! -d "$folder" ]; then
|
||||
echo "Removing workspace $(basename $i) for deleted folder $folder of size $(du -sh $i|cut -f1)"; rm -rfv "$i";
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# starship
|
||||
eval "$(starship init zsh)"
|
||||
|
||||
# fzf
|
||||
# [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
|
||||
# zoxide
|
||||
eval "$(zoxide init zsh)"
|
||||
|
||||
# direnv
|
||||
command -v direnv &> /dev/null && eval "$(direnv hook zsh)"
|
||||
|
||||
# iTerm
|
||||
[ -e "$HOME/.iterm2_shell_integration.zsh" ] && source "$HOME/.iterm2_shell_integration.zsh"
|
||||
5
programs/zsh/initExtraBeforeCompInit.zsh
Normal file
5
programs/zsh/initExtraBeforeCompInit.zsh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
if command -v brew &>/dev/null
|
||||
then
|
||||
FPATH="$(brew --prefix)/share/zsh/site-functions:$FPATH"
|
||||
fi
|
||||
FPATH="$HOME/.zfunc:$FPATH"
|
||||
Loading…
Add table
Add a link
Reference in a new issue