mirror of
https://github.com/ryanccn/flake.git
synced 2025-12-06 08:10:43 +01:00
refactor: programs -> home
This commit is contained in:
parent
042cd345f9
commit
650542009d
21 changed files with 7 additions and 7 deletions
217
home/apps/vscode.nix
Normal file
217
home/apps/vscode.nix
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
extensions = [
|
||||
"antfu.iconify"
|
||||
"antfu.unocss"
|
||||
"astro-build.astro-vscode"
|
||||
"bierner.lit-html"
|
||||
"bmalehorn.vscode-fish"
|
||||
"bradlc.vscode-tailwindcss"
|
||||
"Catppuccin.catppuccin-vsc"
|
||||
"Catppuccin.catppuccin-vsc-icons"
|
||||
"csstools.postcss"
|
||||
"denoland.vscode-deno"
|
||||
"dbaeumer.vscode-eslint"
|
||||
"dprint.dprint"
|
||||
"DotJoshJohnson.xml"
|
||||
"EditorConfig.EditorConfig"
|
||||
"eamodio.gitlens"
|
||||
"github.vscode-github-actions"
|
||||
"esbenp.prettier-vscode"
|
||||
"GraphQL.vscode-graphql"
|
||||
"GraphQL.vscode-graphql-syntax"
|
||||
"golang.go"
|
||||
"griimick.vhs"
|
||||
"LeonardSSH.vscord"
|
||||
"jnoortheen.nix-ide"
|
||||
"ms-python.isort"
|
||||
"ms-python.black-formatter"
|
||||
"ms-python.vscode-pylance"
|
||||
"ms-python.python"
|
||||
"mvllow.rose-pine"
|
||||
"ms-vscode.cpptools"
|
||||
"Prisma.prisma"
|
||||
"nvarner.typst-lsp"
|
||||
"ronnidc.nunjucks"
|
||||
"rust-lang.rust-analyzer"
|
||||
"tamasfe.even-better-toml"
|
||||
"sastan.twind-intellisense"
|
||||
"skellock.just"
|
||||
"svelte.svelte-vscode"
|
||||
"timonwong.shellcheck"
|
||||
"unifiedjs.vscode-mdx"
|
||||
"Vue.volar"
|
||||
"yoavbls.pretty-ts-errors"
|
||||
];
|
||||
in {
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
package = pkgs.stdenv.mkDerivation {
|
||||
pname = "vscode";
|
||||
version = "1.81.1";
|
||||
src = pkgs.emptyDirectory;
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
'';
|
||||
};
|
||||
|
||||
extensions = [];
|
||||
mutableExtensionsDir = true;
|
||||
|
||||
userSettings = {
|
||||
"workbench.colorTheme" = "Catppuccin Frappé";
|
||||
"workbench.iconTheme" = "catppuccin-frappe";
|
||||
"catppuccin.boldKeywords" = false;
|
||||
"catppuccin.italicKeywords" = true;
|
||||
"catppuccin.accentColor" = "sky";
|
||||
"catppuccin.workbenchMode" = "default";
|
||||
"catppuccin.customUIColors" = {
|
||||
all = {
|
||||
"activityBar.activeBorder" = "accent";
|
||||
};
|
||||
};
|
||||
|
||||
"git.autofetch" = true;
|
||||
"git.confirmSync" = false;
|
||||
"diffEditor.renderSideBySide" = false;
|
||||
"git.inputValidation" = "off";
|
||||
"gitlens.showWelcomeOnInstall" = false;
|
||||
"git.suggestSmartCommit" = false;
|
||||
"diffEditor.ignoreTrimWhitespace" = false;
|
||||
|
||||
"editor.fontFamily" = "\"CaskaydiaCove Nerd Font\", monospace";
|
||||
"editor.formatOnSave" = true;
|
||||
"editor.fontLigatures" = "'calt', 'ss01'";
|
||||
"editor.insertSpaces" = true;
|
||||
"editor.tabSize" = 2;
|
||||
"editor.cursorSmoothCaretAnimation" = "on";
|
||||
"editor.fontSize" = 16;
|
||||
"editor.lineHeight" = 1.5;
|
||||
"editor.minimap.renderCharacters" = false;
|
||||
"editor.cursorBlinking" = "phase";
|
||||
"editor.inlineSuggest.enabled" = true;
|
||||
"workbench.editor.highlightModifiedTabs" = true;
|
||||
"workbench.editor.untitled.hint" = "hidden";
|
||||
|
||||
"terminal.integrated.fontFamily" = "\"CaskaydiaCove Nerd Font Mono\", monospace";
|
||||
"terminal.integrated.fontSize" = 14;
|
||||
"terminal.integrated.lineHeight" = 1.5;
|
||||
"terminal.integrated.cursorBlinking" = true;
|
||||
"terminal.integrated.defaultProfile.osx" = "fish";
|
||||
"terminal.integrated.inheritEnv" = false;
|
||||
"terminal.integrated.shellIntegration.enabled" = false;
|
||||
|
||||
"shellcheck.ignorePatterns" = {
|
||||
".envrc" = true;
|
||||
};
|
||||
"editor.defaultFormatter" = "esbenp.prettier-vscode";
|
||||
"tailwindCSS.includeLanguages" = {
|
||||
typescript = "javascript";
|
||||
typescriptreact = "javascript";
|
||||
vue-html = "html";
|
||||
};
|
||||
"typescript.enablePromptUseWorkspaceTsdk" = true;
|
||||
|
||||
"telemetry.telemetryLevel" = "off";
|
||||
"workbench.enableExperiments" = false;
|
||||
"workbench.settings.enableNaturalLanguageSearch" = false;
|
||||
"extensions.ignoreRecommendations" = true;
|
||||
"editor.accessibilitySupport" = "off";
|
||||
|
||||
"vscord.status.details.text.editing" = "In {workspace}";
|
||||
"vscord.status.details.text.viewing" = "In {workspace}";
|
||||
"vscord.status.problems.enabled" = false;
|
||||
"vscord.status.state.text.editing" = "Working on {file_name}{file_extension}";
|
||||
"vscord.status.buttons.button1.enabled" = false;
|
||||
|
||||
"gitlens.defaultTimeFormat" = "HH=mm";
|
||||
"gitlens.defaultDateShortFormat" = "YYYY/MM/DD";
|
||||
"gitlens.defaultDateFormat" = null;
|
||||
|
||||
"[python]"."editor.tabSize" = 4;
|
||||
"[python]"."editor.defaultFormatter" = "ms-python.black-formatter";
|
||||
"[cpp]"."editor.defaultFormatter" = "ms-vscode.cpptools";
|
||||
"[toml]"."editor.defaultFormatter" = "tamasfe.even-better-toml";
|
||||
"[rust]"."editor.defaultFormatter" = "rust-lang.rust-analyzer";
|
||||
"[nix]"."editor.defaultFormatter" = "jnoortheen.nix-ide";
|
||||
"[svelte]"."editor.defaultFormatter" = "svelte.svelte-vscode";
|
||||
"[go][go.mod][go.sum]"."editor.defaultFormatter" = "golang.go";
|
||||
"[xml]"."editor.defaultFormatter" = "DotJoshJohnson.xml";
|
||||
"[fish]"."editor.defaultFormatter" = "bmalehorn.vscode-fish";
|
||||
"[just]"."editor.defaultFormatter" = "skellock.just";
|
||||
"[mdx]"."editor.wordWrap" = "on";
|
||||
"[astro]"."editor.defaultFormatter" = "astro-build.astro-vscode";
|
||||
|
||||
"rust-analyzer.server.path" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
|
||||
|
||||
"files.associations" = {
|
||||
"*.mcmeta" = "json";
|
||||
"*.plist" = "xml";
|
||||
".dockerignore" = "ignore";
|
||||
".dev.vars" = "properties";
|
||||
".env.example" = "properties";
|
||||
"*.sarif" = "json";
|
||||
".tokeignore" = "ignore";
|
||||
"flake.lock" = "json";
|
||||
};
|
||||
|
||||
"deno.inlayHints.enumMemberValues.enabled" = false;
|
||||
"deno.inlayHints.functionLikeReturnTypes.enabled" = false;
|
||||
"deno.inlayHints.parameterNames.enabled" = "none";
|
||||
"deno.inlayHints.parameterTypes.enabled" = false;
|
||||
"deno.inlayHints.propertyDeclarationTypes.enabled" = false;
|
||||
"deno.inlayHints.variableTypes.enabled" = false;
|
||||
|
||||
"svelte.enable-ts-plugin" = true;
|
||||
|
||||
"nix.enableLanguageServer" = true;
|
||||
"nix.serverPath" = "${pkgs.nil}/bin/nil";
|
||||
"nix.serverSettings" = {
|
||||
nil = {
|
||||
formatting = {
|
||||
command = ["${pkgs.alejandra}/bin/alejandra"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
home.activation = {
|
||||
vscodeExtensions = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
code_bin="/usr/local/bin/code"
|
||||
|
||||
if ! command -v "$code_bin" &> /dev/null; then
|
||||
echo "code CLI is not available"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
declare -A currentExtensions
|
||||
for extension in $("$code_bin" --list-extensions); do
|
||||
currentExtensions["$extension"]=1;
|
||||
done
|
||||
|
||||
${builtins.concatStringsSep
|
||||
"\n"
|
||||
(
|
||||
builtins.map
|
||||
(ext: ''
|
||||
if [[ -z "''${currentExtensions[${ext}]+unset}" ]]; then
|
||||
echo "installing ${ext}"
|
||||
$DRY_RUN_CMD "$code_bin" --install-extension ${ext} &> /dev/null
|
||||
fi
|
||||
unset 'currentExtensions[${ext}]'
|
||||
'')
|
||||
extensions
|
||||
)}
|
||||
|
||||
for ext in "''${!currentExtensions[@]}"; do
|
||||
echo "uninstalling $ext"
|
||||
$DRY_RUN_CMD "$code_bin" --uninstall-extension $ext &> /dev/null
|
||||
currentExtensions[$ext]=
|
||||
done
|
||||
'';
|
||||
};
|
||||
}
|
||||
38
home/default.nix
Normal file
38
home/default.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
config,
|
||||
ctpModule,
|
||||
discordAppleMusicModule,
|
||||
...
|
||||
}: {
|
||||
home.stateVersion = "23.05";
|
||||
|
||||
imports = [
|
||||
ctpModule
|
||||
discordAppleMusicModule
|
||||
|
||||
./variables.nix
|
||||
./fonts.nix
|
||||
|
||||
./apps/vscode.nix
|
||||
|
||||
./programs/zsh.nix
|
||||
./programs/fish.nix
|
||||
./programs/starship.nix
|
||||
|
||||
./programs/git.nix
|
||||
./programs/bat.nix
|
||||
./programs/helix.nix
|
||||
./programs/go.nix
|
||||
./programs/eza.nix
|
||||
./programs/rust.nix
|
||||
];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
services.discord-applemusic-rich-presence = {
|
||||
enable = true;
|
||||
logFile = "${config.home.homeDirectory}/Library/Logs/discord-applemusic-rich-presence.log";
|
||||
};
|
||||
|
||||
catppuccin.flavour = "frappe";
|
||||
}
|
||||
12
home/fonts.nix
Normal file
12
home/fonts.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{pkgs, ...}: {
|
||||
home.packages = with pkgs; [
|
||||
inter
|
||||
public-sans
|
||||
inriafonts
|
||||
ibm-plex
|
||||
monocraft
|
||||
ryan-mono-bin
|
||||
ryan-term-bin
|
||||
(nerdfonts.override {fonts = ["CascadiaCode"];})
|
||||
];
|
||||
}
|
||||
27
home/programs/aliases.nix
Normal file
27
home/programs/aliases.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"vim".command = "hx";
|
||||
"cat".command = "bat";
|
||||
"dig".command = "doggo";
|
||||
|
||||
"g".command = "git";
|
||||
"g".fishAlias = true;
|
||||
|
||||
"j".command = "just";
|
||||
"j".fishAlias = true;
|
||||
|
||||
"glol".command = "git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset'";
|
||||
"glol".fishAlias = true;
|
||||
|
||||
"ghrvw".command = "gh repo view --web";
|
||||
|
||||
"opr".command = "op run --env-file=.env.1password --";
|
||||
"dr".command = "doppler run --";
|
||||
|
||||
"dequarantine".command = "xattr -d com.apple.quarantine";
|
||||
|
||||
"bcpa".command = "brew cleanup --prune=all";
|
||||
"puil".command = "pnpm update --interactive --latest";
|
||||
|
||||
"pip-upgrade-all".command = "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";
|
||||
"pip-upgrade-all".fishAlias = true;
|
||||
}
|
||||
10
home/programs/bat.nix
Normal file
10
home/programs/bat.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
_: {
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
catppuccin.enable = true;
|
||||
|
||||
config = {
|
||||
style = "plain";
|
||||
};
|
||||
};
|
||||
}
|
||||
16
home/programs/eza.nix
Normal file
16
home/programs/eza.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{pkgs, ...}: let
|
||||
aliases = {
|
||||
eza = "eza --all --icons";
|
||||
ls = "eza";
|
||||
ll = "eza -l";
|
||||
la = "eza -a";
|
||||
lt = "eza --tree";
|
||||
lla = "eza -la";
|
||||
};
|
||||
in {
|
||||
home.packages = [pkgs.eza];
|
||||
|
||||
programs.bash.shellAliases = aliases;
|
||||
programs.zsh.shellAliases = aliases;
|
||||
programs.fish.shellAliases = aliases;
|
||||
}
|
||||
35
home/programs/fish.nix
Normal file
35
home/programs/fish.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{lib, ...}: let
|
||||
aliases = import ./aliases.nix;
|
||||
shellAbbrs = builtins.mapAttrs (_: a: a.command) (lib.filterAttrs (_: b: !(b.fishAlias or false)) aliases);
|
||||
shellAliases = builtins.mapAttrs (_: a: a.command) (lib.filterAttrs (_: b: builtins.hasAttr "fishAlias" b && b.fishAlias) aliases);
|
||||
in {
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
inherit shellAbbrs shellAliases;
|
||||
|
||||
functions = {
|
||||
take = ''
|
||||
set dir $argv[1]
|
||||
if test -z "$dir"
|
||||
return 1
|
||||
end
|
||||
|
||||
mkdir -p "$dir"
|
||||
cd "$dir"
|
||||
'';
|
||||
|
||||
code = ''
|
||||
if test -d "$argv[1]" -o -f "$argv[1]"
|
||||
open -a "Visual Studio Code" "$argv[1]"
|
||||
else
|
||||
command code $argv
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
home.file.".config/fish/conf.d" = {
|
||||
source = ./fish/conf.d;
|
||||
recursive = true;
|
||||
};
|
||||
}
|
||||
6
home/programs/fish/conf.d/01_basic_env.fish
Normal file
6
home/programs/fish/conf.d/01_basic_env.fish
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# ls
|
||||
set -x LS_COLORS "$(vivid generate catppuccin-frappe)"
|
||||
|
||||
# nix path patches
|
||||
fish_add_path /run/current-system/sw/bin
|
||||
fish_add_path "/etc/profiles/per-user/$USER/bin"
|
||||
29
home/programs/fish/conf.d/02_tooling.fish
Normal file
29
home/programs/fish/conf.d/02_tooling.fish
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# 1Password SSH
|
||||
set -x SSH_AUTH_SOCK "$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
||||
|
||||
# Homebrew shell
|
||||
/opt/homebrew/bin/brew shellenv | source
|
||||
|
||||
# fnm shell env
|
||||
fnm env --use-on-cd | source
|
||||
|
||||
# cargo
|
||||
fish_add_path "$HOME/.cargo/bin"
|
||||
# deno
|
||||
fish_add_path "$HOME/.deno/bin"
|
||||
|
||||
# pnpm
|
||||
set -x PNPM_HOME "$HOME/Library/pnpm"
|
||||
|
||||
# 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
|
||||
19
home/programs/fish/conf.d/99_interactive.fish
Normal file
19
home/programs/fish/conf.d/99_interactive.fish
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
if status is-interactive
|
||||
# starship
|
||||
starship init fish | source
|
||||
# zoxide
|
||||
zoxide init fish | source
|
||||
# direnv
|
||||
direnv hook fish | source
|
||||
# nix-your-shell
|
||||
nix-your-shell 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"
|
||||
|
||||
if test -e "$HOME/.iterm2_shell_integration.fish"
|
||||
source "$HOME/.iterm2_shell_integration.fish"
|
||||
end
|
||||
end
|
||||
31
home/programs/git.nix
Normal file
31
home/programs/git.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{pkgs, ...}: {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitAndTools.gitFull;
|
||||
|
||||
diff-so-fancy.enable = true;
|
||||
ignores = [
|
||||
".DS_Store"
|
||||
".direnv/"
|
||||
];
|
||||
|
||||
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;
|
||||
gitCredentialHelper.enable = true;
|
||||
};
|
||||
}
|
||||
11
home/programs/go.nix
Normal file
11
home/programs/go.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
_: {
|
||||
programs.go = {
|
||||
enable = true;
|
||||
goPath = ".go";
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
GOTOOLCHAIN = "path";
|
||||
GOPROXY = "direct";
|
||||
};
|
||||
}
|
||||
7
home/programs/helix.nix
Normal file
7
home/programs/helix.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
_: {
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
catppuccin.enable = true;
|
||||
defaultEditor = true;
|
||||
};
|
||||
}
|
||||
8
home/programs/rust.nix
Normal file
8
home/programs/rust.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{pkgs, ...}: let
|
||||
inherit (pkgs) lib;
|
||||
toml = pkgs.formats.toml {};
|
||||
in {
|
||||
home.file.".cargo/config.toml".source = toml.generate "config.toml" {
|
||||
build.rustc-wrapper = lib.getExe' pkgs.sccache "sccache";
|
||||
};
|
||||
}
|
||||
89
home/programs/starship.nix
Normal file
89
home/programs/starship.nix
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
_: {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
command_timeout = 1000;
|
||||
|
||||
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 = " ";
|
||||
package.symbol = " ";
|
||||
pijul_channel.symbol = "🪺 ";
|
||||
python.symbol = " ";
|
||||
rlang.symbol = " ";
|
||||
ruby.symbol = " ";
|
||||
rust.symbol = " ";
|
||||
scala.symbol = " ";
|
||||
spack.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 = " ";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
44
home/programs/zsh.nix
Normal file
44
home/programs/zsh.nix
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
{pkgs, ...}: let
|
||||
shellAliases = builtins.mapAttrs (_: alias: alias.command) (import ./aliases.nix);
|
||||
in {
|
||||
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;
|
||||
|
||||
inherit shellAliases;
|
||||
|
||||
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=";
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
26
home/programs/zsh/envExtra.zsh
Normal file
26
home/programs/zsh/envExtra.zsh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# 1Password SSH
|
||||
export SSH_AUTH_SOCK="$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
||||
|
||||
# Homebrew shell
|
||||
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||
|
||||
# fnm shell env
|
||||
eval "$(fnm env --use-on-cd)"
|
||||
|
||||
# deno
|
||||
export PATH="$HOME/.deno/bin:$PATH"
|
||||
|
||||
# pnpm
|
||||
export PNPM_HOME="${HOME}/Library/pnpm"
|
||||
|
||||
# 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"
|
||||
53
home/programs/zsh/initExtra.zsh
Normal file
53
home/programs/zsh/initExtra.zsh
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# environment variables
|
||||
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
|
||||
|
||||
# configure completion styles
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
|
||||
zstyle ':completion:*' group-name \'\'
|
||||
|
||||
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)"
|
||||
|
||||
# nix-your-shell
|
||||
eval "$(nix-your-shell zsh)"
|
||||
|
||||
# iTerm
|
||||
[ -e "$HOME/.iterm2_shell_integration.zsh" ] && source "$HOME/.iterm2_shell_integration.zsh"
|
||||
5
home/programs/zsh/initExtraBeforeCompInit.zsh
Normal file
5
home/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"
|
||||
11
home/variables.nix
Normal file
11
home/variables.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
_: {
|
||||
home.sessionVariables = {
|
||||
NEXT_TELEMETRY_DISABLED = "1";
|
||||
CHECKPOINT_DISABLE = "1";
|
||||
DISABLE_TELEMETRY = "YES";
|
||||
ASTRO_TELEMETRY_DISABLED = "1";
|
||||
|
||||
FNM_RESOLVE_ENGINES = "true";
|
||||
FNM_COREPACK_ENABLED = "true";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue