mirror of
https://github.com/ryanccn/flake.git
synced 2025-12-06 08:10:43 +01:00
refactor: flake-parts
This commit is contained in:
parent
872c6be493
commit
42a1293f6d
63 changed files with 1118 additions and 875 deletions
45
users/ryan/apps/ghostty.nix
Normal file
45
users/ryan/apps/ghostty.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
keyValue = pkgs.formats.keyValue {
|
||||
listsAsDuplicateKeys = true;
|
||||
mkKeyValue = lib.generators.mkKeyValueDefault { } " = ";
|
||||
};
|
||||
|
||||
settings = {
|
||||
theme = "catppuccin-${config.catppuccin.flavor}";
|
||||
window-colorspace = "display-p3";
|
||||
|
||||
font-family = "IBM Plex Mono";
|
||||
font-size = 14;
|
||||
font-feature = [
|
||||
"-calt"
|
||||
"-dlig"
|
||||
];
|
||||
|
||||
adjust-cell-height = "25%";
|
||||
adjust-underline-position = 5;
|
||||
|
||||
command = "/run/current-system/sw/bin/fish -l";
|
||||
|
||||
macos-option-as-alt = true;
|
||||
macos-secure-input-indication = false;
|
||||
|
||||
window-step-resize = true;
|
||||
window-padding-x = 15;
|
||||
window-padding-y = 15;
|
||||
|
||||
keybind = [ "super+backspace=text:\\x15" ];
|
||||
};
|
||||
in
|
||||
{
|
||||
xdg.configFile."ghostty/config".source = keyValue.generate "ghostty-config" settings;
|
||||
}
|
||||
232
users/ryan/apps/vscode.nix
Normal file
232
users/ryan/apps/vscode.nix
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
# self,
|
||||
...
|
||||
}:
|
||||
let
|
||||
extensions = [
|
||||
"astro-build.astro-vscode"
|
||||
"bierner.lit-html"
|
||||
"bmalehorn.vscode-fish"
|
||||
"bradlc.vscode-tailwindcss"
|
||||
"catppuccin.catppuccin-vsc"
|
||||
"catppuccin.catppuccin-vsc-icons"
|
||||
"charliermarsh.ruff"
|
||||
"dbaeumer.vscode-eslint"
|
||||
"denoland.vscode-deno"
|
||||
"dotjoshjohnson.xml"
|
||||
"dprint.dprint"
|
||||
"editorconfig.editorconfig"
|
||||
"esbenp.prettier-vscode"
|
||||
"github.vscode-github-actions"
|
||||
"graphql.vscode-graphql"
|
||||
"graphql.vscode-graphql-syntax"
|
||||
"golang.go"
|
||||
"griimick.vhs"
|
||||
"jnoortheen.nix-ide"
|
||||
"ms-python.isort"
|
||||
"ms-python.vscode-pylance"
|
||||
"ms-python.python"
|
||||
"myriad-dreamin.tinymist"
|
||||
"naumovs.color-highlight"
|
||||
"prisma.prisma"
|
||||
"ronnidc.nunjucks"
|
||||
"rust-lang.rust-analyzer"
|
||||
"skellock.just"
|
||||
"svelte.svelte-vscode"
|
||||
"tamasfe.even-better-toml"
|
||||
"timonwong.shellcheck"
|
||||
"unifiedjs.vscode-mdx"
|
||||
"usernamehw.errorlens"
|
||||
"vue.volar"
|
||||
"yoavbls.pretty-ts-errors"
|
||||
];
|
||||
|
||||
defaultFormatters = {
|
||||
"[python]" = "charliermarsh.ruff";
|
||||
"[cpp]" = "xaver.clang-format";
|
||||
"[toml]" = "tamasfe.even-better-toml";
|
||||
"[svelte]" = "svelte.svelte-vscode";
|
||||
"[go][go.mod][go.sum]" = "golang.go";
|
||||
"[xml]" = "DotJoshJohnson.xml";
|
||||
"[fish]" = "bmalehorn.vscode-fish";
|
||||
"[just]" = "skellock.just";
|
||||
"[astro]" = "astro-build.astro-vscode";
|
||||
"[rust]" = "rust-lang.rust-analyzer";
|
||||
"[nix]" = "jnoortheen.nix-ide";
|
||||
"[typst]" = "myriad-dreamin.tinymist";
|
||||
};
|
||||
in
|
||||
{
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
package = pkgs.writeShellApplication {
|
||||
name = "vscode-1.98.2";
|
||||
text = "";
|
||||
derivationArgs = {
|
||||
pname = "vscode";
|
||||
version = "1.98.2";
|
||||
};
|
||||
};
|
||||
|
||||
profiles.default.extensions = [ ];
|
||||
mutableExtensionsDir = true;
|
||||
|
||||
profiles.default.userSettings = builtins.foldl' lib.recursiveUpdate { } [
|
||||
{
|
||||
"workbench.colorTheme" = "Catppuccin Frappé";
|
||||
"workbench.iconTheme" = "catppuccin-frappe";
|
||||
"workbench.sideBar.location" = "left";
|
||||
"workbench.activityBar.location" = "top";
|
||||
|
||||
"editor.semanticHighlighting.enabled" = true;
|
||||
"terminal.integrated.minimumContrastRatio" = 1;
|
||||
"terminal.integrated.drawBoldTextInBrightColors" = false;
|
||||
"window.titleBarStyle" = "custom";
|
||||
|
||||
"catppuccin.accentColor" = config.catppuccin.accent;
|
||||
"catppuccin.workbenchMode" = "flat";
|
||||
"catppuccin.customUIColors" = {
|
||||
"all" = {
|
||||
"statusBarItem.remoteBackground" = "accent";
|
||||
"activityBar.activeBorder" = "accent";
|
||||
"activityBarTop.activeBorder" = "accent";
|
||||
};
|
||||
};
|
||||
|
||||
"git.autofetch" = true;
|
||||
"git.confirmSync" = false;
|
||||
"git.inputValidation" = false;
|
||||
"git.suggestSmartCommit" = false;
|
||||
"git.blame.editorDecoration.enabled" = true;
|
||||
|
||||
"diffEditor.renderSideBySide" = false;
|
||||
"diffEditor.ignoreTrimWhitespace" = false;
|
||||
|
||||
"editor.fontFamily" = ''"IBM Plex Mono", "Symbols Nerd Font", monospace'';
|
||||
"editor.fontLigatures" = true;
|
||||
"editor.fontSize" = 16;
|
||||
"editor.lineHeight" = 1.5;
|
||||
# "editor.cursorBlinking" = "phase";
|
||||
# "editor.cursorSmoothCaretAnimation" = "on";
|
||||
# "editor.minimap.renderCharacters" = false;
|
||||
"workbench.editor.highlightModifiedTabs" = true;
|
||||
"workbench.editor.empty.hint" = "hidden";
|
||||
"chat.commandCenter.enabled" = false;
|
||||
|
||||
"editor.inlineSuggest.enabled" = true;
|
||||
"editor.tabSize" = 2;
|
||||
"editor.insertSpaces" = true;
|
||||
"editor.formatOnSave" = true;
|
||||
|
||||
"terminal.integrated.fontFamily" = ''"IBM Plex Mono", "Symbols 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.enablePersistentSessions" = false;
|
||||
"terminal.integrated.shellIntegration.enabled" = false;
|
||||
|
||||
"editor.defaultFormatter" = "esbenp.prettier-vscode";
|
||||
|
||||
"javascript.preferGoToSourceDefinition" = true;
|
||||
"typescript.preferGoToSourceDefinition" = true;
|
||||
"typescript.enablePromptUseWorkspaceTsdk" = true;
|
||||
|
||||
"eslint.useFlatConfig" = true;
|
||||
|
||||
"shellcheck.ignorePatterns".".envrc" = true;
|
||||
"tailwindCSS.includeLanguages" = {
|
||||
"typescript" = "javascript";
|
||||
"typescriptreact" = "javascript";
|
||||
"vue-html" = "html";
|
||||
};
|
||||
|
||||
"telemetry.telemetryLevel" = "off";
|
||||
"workbench.enableExperiments" = false;
|
||||
"workbench.settings.enableNaturalLanguageSearch" = false;
|
||||
"extensions.ignoreRecommendations" = true;
|
||||
"editor.accessibilitySupport" = "off";
|
||||
|
||||
"[python]"."editor.tabSize" = 4;
|
||||
"[rust]"."editor.tabSize" = 4;
|
||||
|
||||
"[mdx]"."editor.wordWrap" = "on";
|
||||
|
||||
"rust-analyzer.server.path" = "rust-analyzer";
|
||||
"rust-analyzer.check.command" = "clippy";
|
||||
"rust-analyzer.showUnlinkedFileNotification" = false;
|
||||
|
||||
"files.associations" = {
|
||||
"*.mcmeta" = "json";
|
||||
"*.plist" = "xml";
|
||||
".dockerignore" = "ignore";
|
||||
".dev.vars" = "properties";
|
||||
".env.example" = "properties";
|
||||
"*.sarif" = "json";
|
||||
".tokeignore" = "ignore";
|
||||
"flake.lock" = "json";
|
||||
};
|
||||
|
||||
"svelte.enable-ts-plugin" = true;
|
||||
|
||||
"color-highlight.matchRgbWithNoFunction" = true;
|
||||
"color-highlight.matchHslWithNoFunction" = true;
|
||||
"color-highlight.markRuler" = false;
|
||||
"color-highlight.markerType" = "underline";
|
||||
|
||||
"nix.enableLanguageServer" = true;
|
||||
"nix.serverPath" = lib.getExe pkgs.nil;
|
||||
"nix.serverSettings" = {
|
||||
"nil" = {
|
||||
formatting.command = [ (lib.getExe pkgs.nixfmt-rfc-style) ];
|
||||
# nixpkgs.expr = "import (builtins.getFlake \"${self}\").inputs.nixpkgs { }";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
(lib.concatMapAttrs (lang: formatter: {
|
||||
${lang}."editor.defaultFormatter" = formatter;
|
||||
}) defaultFormatters)
|
||||
];
|
||||
};
|
||||
|
||||
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
|
||||
unset 'currentExtensions[$ext]'
|
||||
done
|
||||
'';
|
||||
};
|
||||
}
|
||||
16
users/ryan/catppuccin.nix
Normal file
16
users/ryan/catppuccin.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
catppuccin = {
|
||||
flavor = "frappe";
|
||||
accent = "sapphire";
|
||||
|
||||
bat.enable = true;
|
||||
fish.enable = true;
|
||||
fzf.enable = true;
|
||||
glamour.enable = true;
|
||||
helix.enable = true;
|
||||
};
|
||||
}
|
||||
43
users/ryan/default.nix
Normal file
43
users/ryan/default.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
imports = [
|
||||
inputs.catppuccin.homeManagerModules.catppuccin
|
||||
inputs.nix-index-database.hmModules.nix-index
|
||||
|
||||
./variables.nix
|
||||
./fonts.nix
|
||||
./catppuccin.nix
|
||||
|
||||
./apps/vscode.nix
|
||||
./apps/ghostty.nix
|
||||
|
||||
./programs/fish.nix
|
||||
./programs/zsh.nix
|
||||
./programs/starship.nix
|
||||
./programs/direnv.nix
|
||||
|
||||
./programs/git.nix
|
||||
./programs/bat.nix
|
||||
./programs/helix.nix
|
||||
./programs/go.nix
|
||||
./programs/eza.nix
|
||||
./programs/rust.nix
|
||||
./programs/tealdeer.nix
|
||||
];
|
||||
|
||||
programs.bash.enable = true;
|
||||
xdg.enable = true;
|
||||
|
||||
programs.nix-index-database.comma.enable = true;
|
||||
|
||||
home.stateVersion = "24.11";
|
||||
}
|
||||
30
users/ryan/fonts.nix
Normal file
30
users/ryan/fonts.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
pkgs' = inputs.self.packages.${pkgs.stdenvNoCC.hostPlatform.system};
|
||||
in
|
||||
{
|
||||
home.packages = [
|
||||
pkgs.inter
|
||||
pkgs.lxgw-wenkai
|
||||
|
||||
(pkgs'.ibm-plex-compat.override {
|
||||
families = [
|
||||
"sans"
|
||||
"serif"
|
||||
"mono"
|
||||
];
|
||||
})
|
||||
|
||||
pkgs'.ryan-mono-bin
|
||||
(pkgs.cascadia-code.override { useVariableFont = true; })
|
||||
pkgs.nerd-fonts.symbols-only
|
||||
];
|
||||
}
|
||||
25
users/ryan/programs/aliases.nix
Normal file
25
users/ryan/programs/aliases.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
"g".command = "git";
|
||||
"j".command = "just";
|
||||
|
||||
"nb".command = "nix build";
|
||||
"nfu".command = "nix flake update";
|
||||
|
||||
"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";
|
||||
}
|
||||
13
users/ryan/programs/bat.nix
Normal file
13
users/ryan/programs/bat.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
|
||||
config = {
|
||||
style = "plain";
|
||||
};
|
||||
};
|
||||
}
|
||||
12
users/ryan/programs/direnv.nix
Normal file
12
users/ryan/programs/direnv.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{ pkgs, config, ... }:
|
||||
{
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
nix-direnv.package = pkgs.nix-direnv.override { nix = config.nix.package; };
|
||||
};
|
||||
}
|
||||
11
users/ryan/programs/eza.nix
Normal file
11
users/ryan/programs/eza.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
programs.eza = {
|
||||
enable = true;
|
||||
icons = "auto";
|
||||
extraOptions = [ "--all" ];
|
||||
};
|
||||
}
|
||||
61
users/ryan/programs/fish.nix
Normal file
61
users/ryan/programs/fish.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{ lib, ... }:
|
||||
let
|
||||
aliases = import ./aliases.nix;
|
||||
|
||||
shellAbbrs = builtins.mapAttrs (lib.const (builtins.getAttr "command")) (
|
||||
lib.filterAttrs (_: a: !(lib.maybeAttr "fishAlias" false a)) aliases
|
||||
);
|
||||
shellAliases = builtins.mapAttrs (lib.const (builtins.getAttr "command")) (
|
||||
lib.filterAttrs (_: a: lib.maybeAttr "fishAlias" false a) aliases
|
||||
);
|
||||
in
|
||||
{
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
||||
inherit shellAbbrs shellAliases;
|
||||
|
||||
shellInit = ''
|
||||
for config in ${./fish/configs}/*.fish
|
||||
source "$config"
|
||||
end
|
||||
'';
|
||||
|
||||
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
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
defaultOptions = [
|
||||
"--height 40%"
|
||||
"--layout reverse"
|
||||
"--border"
|
||||
];
|
||||
};
|
||||
|
||||
programs.zoxide = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
32
users/ryan/programs/fish/configs/01_tooling.fish
Normal file
32
users/ryan/programs/fish/configs/01_tooling.fish
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set -x SSH_AUTH_SOCK "$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
||||
set -x LS_COLORS "$(vivid generate catppuccin-frappe)"
|
||||
|
||||
/opt/homebrew/bin/brew shellenv | source
|
||||
|
||||
fnm env --use-on-cd | source
|
||||
|
||||
fish_add_path -P "$CARGO_HOME/bin"
|
||||
fish_add_path -P "$GOPATH/bin"
|
||||
fish_add_path -P "$HOME/.deno/bin"
|
||||
fish_add_path -P "$HOME/.orbstack/bin"
|
||||
fish_add_path -P "$HOME/.local/bin"
|
||||
|
||||
function expose_app_to_path
|
||||
set -f app $argv[1]
|
||||
|
||||
if test -d "$HOME/Applications/$app.app"
|
||||
fish_add_path -P "$HOME/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
|
||||
|
||||
set fish_greeting
|
||||
18
users/ryan/programs/fish/configs/99_interactive.fish
Normal file
18
users/ryan/programs/fish/configs/99_interactive.fish
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if status is-interactive
|
||||
nix-your-shell fish | source
|
||||
|
||||
if command -q nrr
|
||||
source "$(COMPLETE=fish nrr | psub)"
|
||||
if command -q nrx
|
||||
source "$(COMPLETE=fish nrx | psub)"
|
||||
end
|
||||
end
|
||||
|
||||
if set -q GHOSTTY_RESOURCES_DIR
|
||||
source "$GHOSTTY_RESOURCES_DIR/shell-integration/fish/vendor_conf.d/ghostty-shell-integration.fish"
|
||||
end
|
||||
end
|
||||
54
users/ryan/programs/git.nix
Normal file
54
users/ryan/programs/git.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
# difftastic.enable = true;
|
||||
|
||||
ignores = [
|
||||
".DS_Store"
|
||||
".direnv/"
|
||||
".vscode/"
|
||||
".zed/"
|
||||
".idea/"
|
||||
];
|
||||
|
||||
userName = "Ryan Cao";
|
||||
userEmail = "70191398+ryanccn@users.noreply.github.com";
|
||||
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
|
||||
commit.gpgSign = true;
|
||||
gpg.format = "openpgp";
|
||||
user.signingKey = "F605AB4AF937D5D0";
|
||||
|
||||
column.ui = "auto";
|
||||
log.date = "iso";
|
||||
merge.conflictStyle = "zdiff3";
|
||||
|
||||
diff.algorithm = "histogram";
|
||||
diff.colorMoved = "plain";
|
||||
diff.mnemonicPrefix = true;
|
||||
diff.renames = true;
|
||||
|
||||
fetch.prune = true;
|
||||
fetch.pruneTags = true;
|
||||
fetch.all = true;
|
||||
|
||||
transfer.fsckObjects = true;
|
||||
|
||||
branch.sort = "-committerdate";
|
||||
tag.sort = "version:refname";
|
||||
|
||||
push.autoSetupRemote = true;
|
||||
};
|
||||
};
|
||||
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
gitCredentialHelper.enable = true;
|
||||
};
|
||||
}
|
||||
15
users/ryan/programs/go.nix
Normal file
15
users/ryan/programs/go.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
programs.go = {
|
||||
enable = true;
|
||||
goPath = ".local/share/go";
|
||||
};
|
||||
|
||||
home.sessionVariables = {
|
||||
GOTOOLCHAIN = "local";
|
||||
GOPROXY = "direct";
|
||||
};
|
||||
}
|
||||
16
users/ryan/programs/helix.nix
Normal file
16
users/ryan/programs/helix.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
inputs,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
package = inputs.self.packages.${pkgs.stdenvNoCC.hostPlatform.system}.helix-with-lsps;
|
||||
defaultEditor = true;
|
||||
};
|
||||
}
|
||||
40
users/ryan/programs/rust.nix
Normal file
40
users/ryan/programs/rust.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
pkgs,
|
||||
inputs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
toml = pkgs.formats.toml { };
|
||||
rust-bin = inputs.rust-overlay.lib.mkRustBin { } pkgs;
|
||||
in
|
||||
{
|
||||
home.file."${config.xdg.dataHome}/cargo/config.toml".source = toml.generate "config.toml" {
|
||||
linker = "${lib.getExe pkgs.clang}";
|
||||
rustflags = [
|
||||
"-C"
|
||||
"link-arg=-fuse-ld=${lib.getExe pkgs.mold}"
|
||||
];
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
(rust-bin.stable.latest.default.override {
|
||||
extensions = [
|
||||
"rust-src"
|
||||
"rust-analyzer"
|
||||
"llvm-tools-preview"
|
||||
];
|
||||
})
|
||||
|
||||
cargo-audit
|
||||
cargo-bloat
|
||||
cargo-cache
|
||||
cargo-deny
|
||||
cargo-expand
|
||||
];
|
||||
}
|
||||
92
users/ryan/programs/starship.nix
Normal file
92
users/ryan/programs/starship.nix
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
|
||||
settings = {
|
||||
command_timeout = 1000;
|
||||
|
||||
character = {
|
||||
success_symbol = "[➜](bold green)";
|
||||
error_symbol = "[➜](bold red)";
|
||||
};
|
||||
|
||||
bun.format = "[$symbol($version)]($style) ";
|
||||
cmd_duration.format = "[$duration]($style) ";
|
||||
deno.format = "[$symbol($version)]($style) ";
|
||||
docker_context.format = "[$symbol$context]($style) ";
|
||||
git_branch.format = "[$symbol$branch(:$remote_branch)]($style) ";
|
||||
golang.format = "[$symbol($version)]($style) ";
|
||||
nix_shell.format = "[$symbol$state( \($name\))]($style) ";
|
||||
nodejs.format = "[$symbol($version)]($style) ";
|
||||
package.format = "[$symbol$version]($style) ";
|
||||
python.format = "[\${symbol}\${pyenv_prefix}(\${version} )(\($virtualenv\) )]($style)";
|
||||
rust.format = "[$symbol($version)]($style) ";
|
||||
|
||||
aws.symbol = " ";
|
||||
bun.symbol = " ";
|
||||
c.symbol = " ";
|
||||
conda.symbol = " ";
|
||||
directory.read_only = " ";
|
||||
docker_context.symbol = " ";
|
||||
git_branch.symbol = " ";
|
||||
golang.symbol = " ";
|
||||
haskell.symbol = " ";
|
||||
hg_branch.symbol = " ";
|
||||
hostname.ssh_symbol = " ";
|
||||
java.symbol = " ";
|
||||
memory_usage.symbol = " ";
|
||||
nim.symbol = " ";
|
||||
nix_shell.symbol = " ";
|
||||
nodejs.symbol = " ";
|
||||
package.symbol = " ";
|
||||
python.symbol = " ";
|
||||
rust.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 = " ";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
13
users/ryan/programs/tealdeer.nix
Normal file
13
users/ryan/programs/tealdeer.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
programs.tealdeer = {
|
||||
enable = true;
|
||||
settings = {
|
||||
display.compact = true;
|
||||
updates.auto_update = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
45
users/ryan/programs/zsh.nix
Normal file
45
users/ryan/programs/zsh.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{
|
||||
config,
|
||||
inputs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
shellAliases = builtins.mapAttrs (lib.const (builtins.getAttr "command")) (import ./aliases.nix);
|
||||
in
|
||||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
enableCompletion = 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-${config.catppuccin.flavor}";
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
name = "ohmyzsh-macos";
|
||||
file = "plugins/macos/macos.plugin.zsh";
|
||||
src = inputs.ohmyzsh;
|
||||
}
|
||||
{
|
||||
name = "vivid-zsh";
|
||||
src = inputs.vivid-zsh;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
27
users/ryan/programs/zsh/envExtra.zsh
Normal file
27
users/ryan/programs/zsh/envExtra.zsh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# 1Password SSH
|
||||
export SSH_AUTH_SOCK="$HOME/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"
|
||||
|
||||
# Homebrew
|
||||
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"
|
||||
export PATH="$PNPM_HOME:$PATH"
|
||||
|
||||
# local bin
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
30
users/ryan/programs/zsh/initExtra.zsh
Normal file
30
users/ryan/programs/zsh/initExtra.zsh
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# zsh options
|
||||
setopt interactivecomments
|
||||
unsetopt menu_complete
|
||||
unsetopt flowcontrol
|
||||
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() {
|
||||
mkdir "$1"
|
||||
cd "$1" || return 1
|
||||
}
|
||||
|
||||
# nix-your-shell
|
||||
eval "$(nix-your-shell zsh)"
|
||||
|
||||
# Ghostty
|
||||
[[ "$TERM_PROGRAM" == "ghostty" ]] && source "/Applications/Ghostty.app/Contents/Resources/ghostty/shell-integration/zsh/ghostty-integration"
|
||||
33
users/ryan/variables.nix
Normal file
33
users/ryan/variables.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# SPDX-FileCopyrightText: 2025 Ryan Cao <hello@ryanccn.dev>
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
{ config, ... }:
|
||||
{
|
||||
home.sessionVariables = {
|
||||
DO_NOT_TRACK = "1";
|
||||
NEXT_TELEMETRY_DISABLED = "1";
|
||||
NUXT_TELEMETRY_DISABLED = "1";
|
||||
CHECKPOINT_DISABLE = "1";
|
||||
DISABLE_TELEMETRY = "YES";
|
||||
ASTRO_TELEMETRY_DISABLED = "1";
|
||||
WRANGLER_SEND_METRICS = "false";
|
||||
HF_HUB_DISABLE_TELEMETRY = "1";
|
||||
STORYBOOK_DISABLE_TELEMETRY = "1";
|
||||
|
||||
FNM_RESOLVE_ENGINES = "true";
|
||||
|
||||
DENO_NO_UPDATE_CHECK = "1";
|
||||
CSC_IDENTITY_AUTO_DISCOVERY = "false";
|
||||
|
||||
COMMA_NIXPKGS_FLAKE = "nixpkgs";
|
||||
COMMA_PICKER = "fzf";
|
||||
|
||||
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";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue