1
0
Fork 0
mirror of https://github.com/ryanccn/flake.git synced 2025-12-06 08:10:43 +01:00

feat: adopt XDG base directories

This commit is contained in:
Ryan Cao 2024-02-16 00:01:34 +08:00
parent b1984a512c
commit c6c59dd552
Signed by: ryanccn
SSH key fingerprint: SHA256:NtP/BlVhoQq4xU6BEcZeT8nIPvHntkJ3lIc2yB+F09E
7 changed files with 40 additions and 24 deletions

View file

@ -31,6 +31,8 @@
./programs/tealdeer.nix
];
xdg.enable = true;
services.am-discord-rich-presence = {
enable = false;
logFile = "${config.home.homeDirectory}/Library/Logs/am-discord-rich-presence.log";

View file

@ -14,17 +14,32 @@ fish_add_path -Pm /etc/profiles/per-user/$USER/bin /run/current-system/sw/bin
fnm env --use-on-cd | source
# cargo
fish_add_path -P "$HOME/.cargo/bin"
fish_add_path -P "$CARGO_HOME/bin"
# go
fish_add_path -P "$GOPATH/bin"
# deno
fish_add_path -P "$HOME/.deno/bin"
# pnpm
set -x PNPM_HOME "$HOME/Library/pnpm"
fish_add_path -P "$PNPM_HOME"
# docker
fish_add_path -P "$HOME/.docker/bin"
# local bin
fish_add_path -P "$HOME/.local/bin"
function expose_app_to_path
set -f app $argv[1]
if test -d ~/"Applications/$app.app"
fish_add_path -P ~/"Applications/$app.app/Contents/MacOS"
end
if test -d "/Applications/$app.app"
fish_add_path -P "/Applications/$app.app/Contents/MacOS"
end
end
expose_app_to_path Ghostty
expose_app_to_path WezTerm
# suppress greeting
set fish_greeting

View file

@ -1,7 +1,7 @@
_: {
programs.go = {
enable = true;
goPath = ".go";
goPath = ".local/share/go";
};
home.sessionVariables = {

View file

@ -1,11 +1,12 @@
{
pkgs,
lib,
config,
...
}: let
toml = pkgs.formats.toml {};
in {
home.file.".cargo/config.toml".source = toml.generate "config.toml" {
home.file."${config.xdg.dataHome}/cargo/config.toml".source = toml.generate "config.toml" {
build.rustc-wrapper = "${lib.getExe' pkgs.sccache "sccache"}";
};

View file

@ -7,17 +7,17 @@ eval "$(/opt/homebrew/bin/brew shellenv)"
# fnm shell env
eval "$(fnm env --use-on-cd)"
# cargo
export PATH="$CARGO_HOME/bin:$PATH"
# go
export PATH="$GOPATH/bin:$PATH"
# 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"
export PATH="$PNPM_HOME:$PATH"
# local bin
export PATH="$HOME/.local/bin:$PATH"

View file

@ -6,10 +6,12 @@ setopt auto_menu
setopt complete_in_word
setopt always_to_end
export HISTFILE="$XDG_STATE_HOME"/zsh/history
compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
# configure completion styles
zstyle ':completion:*' menu select
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' group-name \'\'
function take() {
@ -17,17 +19,6 @@ function take() {
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
}
# nix-your-shell
eval "$(nix-your-shell zsh)"

View file

@ -1,4 +1,4 @@
_: {
{config, ...}: {
home.sessionVariables = {
NEXT_TELEMETRY_DISABLED = "1";
NUXT_TELEMETRY_DISABLED = "1";
@ -11,5 +11,12 @@ _: {
DENO_NO_UPDATE_CHECK = "1";
CSC_IDENTITY_AUTO_DISCOVERY = "false";
LESSHISTFILE = "${config.xdg.stateHome}/less/history";
NPM_CONFIG_USERCONFIG = "${config.xdg.configHome}/npm/npmrc";
CARGO_HOME = "${config.xdg.dataHome}/cargo";
DOCKER_CONFIG = "${config.xdg.configHome}/docker";
FLY_CONFIG_DIR = "${config.xdg.stateHome}/fly";
GRADLE_USER_HOME = "${config.xdg.dataHome}/gradle";
};
}