mirror of
https://github.com/ryanccn/flake.git
synced 2025-12-06 08:10:43 +01:00
feat: initial commit
This commit is contained in:
commit
dd089fe75c
21 changed files with 983 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
.DS_Store
|
||||
|
||||
result*
|
||||
315
flake.lock
generated
Normal file
315
flake.lock
generated
Normal file
|
|
@ -0,0 +1,315 @@
|
|||
{
|
||||
"nodes": {
|
||||
"agenix": {
|
||||
"inputs": {
|
||||
"darwin": "darwin",
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689334118,
|
||||
"narHash": "sha256-djk5AZv1yU84xlKFaVHqFWvH73U7kIRstXwUAnDJPsk=",
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"rev": "0d8c5325fc81daf00532e3e26c6752f7bcde1143",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ryantm",
|
||||
"repo": "agenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"attic": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689457600,
|
||||
"narHash": "sha256-1XLn2ZZMaqQx+Ys3eel5hQRkgUn3DeHcVb2JT8WYU0A=",
|
||||
"owner": "zhaofengli",
|
||||
"repo": "attic",
|
||||
"rev": "4902d57f5dae8ec660ee9ee14c45c2192f9fe8b1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "zhaofengli",
|
||||
"repo": "attic",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"catppuccin": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689265071,
|
||||
"narHash": "sha256-B4N7GV34E2sTKp/vVjYtF1BQOTw/sB5t8lgEPSH7tKc=",
|
||||
"owner": "Stonks3141",
|
||||
"repo": "ctp-nix",
|
||||
"rev": "60a1d9ba22324ad7f563290e454c898b10db954d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Stonks3141",
|
||||
"repo": "ctp-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"crane": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"attic",
|
||||
"flake-compat"
|
||||
],
|
||||
"flake-utils": [
|
||||
"attic",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"attic",
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1677892403,
|
||||
"narHash": "sha256-/Wi0L1spSWLFj+UQxN3j0mPYMoc7ZoAujpUF/juFVII=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "105e27adb70a9890986b6d543a67761cbc1964a2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"agenix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1673295039,
|
||||
"narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "87b9d090ad39b25b2400029c64825fc2a8868943",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "lnl7",
|
||||
"ref": "master",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1673956053,
|
||||
"narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"agenix",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1682203081,
|
||||
"narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689495092,
|
||||
"narHash": "sha256-yZu2j5FpLZEPhJQQutMCPTxa1VMigLPabLYvLTq6ASM=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "2f84579a70b8c74e5ebb37299a0c3ba279f09382",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1689516967,
|
||||
"narHash": "sha256-sFAa33wkQHanmij/uhfGduIDK8z4dJAita/rK6u9pvE=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "61662a63bfe1726588c1da6b412df86d8ca94d63",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1685655444,
|
||||
"narHash": "sha256-6EujQNAeaUkWvpEZZcVF8qSfQrNVWFNNGbUJxv/A5a8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e635192892f5abbc2289eaac3a73cdb249abaefd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"ref": "nixos-unstable",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1685004253,
|
||||
"narHash": "sha256-AbVL1nN/TDicUQ5wXZ8xdLERxz/eJr7+o8lqkIOVuaE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3e01645c40b92d29f3ae76344a6d654986a91a91",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.05",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1689631193,
|
||||
"narHash": "sha256-AGSkBZaiTODQc8eT1rZDrQIjtb8JtFwJ0wVPzArlrnM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "57695599bdc4f7bfe5d28cfa23f14b3d8bdf8a5f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
"attic": "attic",
|
||||
"catppuccin": "catppuccin",
|
||||
"home-manager": "home-manager_2",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
"attic",
|
||||
"crane",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"attic",
|
||||
"crane",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1675391458,
|
||||
"narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
144
flake.nix
Normal file
144
flake.nix
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
{
|
||||
description = "Ryan's MacBook Pro flake";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
nix-darwin.url = "github:LnL7/nix-darwin";
|
||||
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
attic.url = "github:zhaofengli/attic";
|
||||
attic.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
agenix.url = "github:ryantm/agenix";
|
||||
agenix.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
catppuccin.url = "github:Stonks3141/ctp-nix";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nix-darwin,
|
||||
home-manager,
|
||||
agenix,
|
||||
attic,
|
||||
catppuccin,
|
||||
...
|
||||
}: let
|
||||
configuration = {pkgs, ...}: {
|
||||
environment.systemPackages = with pkgs; [
|
||||
nil
|
||||
alejandra
|
||||
attic-client
|
||||
exa
|
||||
pkgs."_1password"
|
||||
age
|
||||
pkgs.agenix
|
||||
asciinema
|
||||
bat
|
||||
btop
|
||||
ccache
|
||||
ccacheWrapper
|
||||
cloudflared
|
||||
deno
|
||||
direnv
|
||||
doggo
|
||||
doppler
|
||||
du-dust
|
||||
exa
|
||||
exiftool
|
||||
fd
|
||||
ffmpeg
|
||||
fish
|
||||
flyctl
|
||||
fnm
|
||||
fzf
|
||||
go
|
||||
gh
|
||||
git
|
||||
git-lfs
|
||||
gum
|
||||
helix
|
||||
hyperfine
|
||||
jq
|
||||
just
|
||||
spicetify-cli
|
||||
mkcert
|
||||
nerdfix
|
||||
opencv
|
||||
bun
|
||||
pipx
|
||||
pscale
|
||||
pyenv
|
||||
railway
|
||||
redis
|
||||
silicon
|
||||
starship
|
||||
tealdeer
|
||||
tokei
|
||||
# ttfautohint
|
||||
vhs
|
||||
vivid
|
||||
xh
|
||||
zoxide
|
||||
];
|
||||
|
||||
services.nix-daemon.enable = true;
|
||||
nix.package = pkgs.nix;
|
||||
|
||||
nix.settings = {
|
||||
experimental-features = "nix-command flakes";
|
||||
build-users-group = "nixbld";
|
||||
trusted-users = ["ryanccn"];
|
||||
auto-optimise-store = true;
|
||||
extra-platforms = ["x86_64-darwin" "aarch64-darwin"];
|
||||
extra-sandbox-paths = ["/nix/var/cache/ccache"];
|
||||
};
|
||||
|
||||
nixpkgs = {
|
||||
overlays = [
|
||||
attic.overlays.default
|
||||
agenix.overlays.default
|
||||
(import ./overlays/ccache-wrapper.nix)
|
||||
];
|
||||
|
||||
config.allowUnfree = true;
|
||||
hostPlatform = "aarch64-darwin";
|
||||
};
|
||||
|
||||
programs.zsh.enable = true;
|
||||
programs.fish.enable = true;
|
||||
programs.fish.shellInit = ''
|
||||
for p in /run/current-system/sw/bin
|
||||
if not contains $p $fish_user_paths
|
||||
set -g fish_user_paths $p $fish_user_paths
|
||||
end
|
||||
end
|
||||
'';
|
||||
|
||||
system.stateVersion = 4;
|
||||
};
|
||||
in {
|
||||
darwinConfigurations.Ryans-MacBook-Pro = nix-darwin.lib.darwinSystem {
|
||||
modules = [
|
||||
configuration
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
nixpkgs.overlays = [attic.overlays.default];
|
||||
|
||||
users.users.ryanccn.home = "/Users/ryanccn";
|
||||
home-manager.users.ryanccn = import ./home.nix {
|
||||
agenixModule = agenix.homeManagerModules.age;
|
||||
ctpModule = catppuccin.homeManagerModules.catppuccin;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
darwinPackages = self.darwinConfigurations.Ryans-MacBook-Pro.pkgs;
|
||||
};
|
||||
}
|
||||
27
home.nix
Normal file
27
home.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
agenixModule,
|
||||
ctpModule,
|
||||
...
|
||||
}: {
|
||||
home.stateVersion = "23.05";
|
||||
imports = [
|
||||
agenixModule
|
||||
ctpModule
|
||||
./programs/zsh.nix
|
||||
./programs/fish.nix
|
||||
./programs/starship.nix
|
||||
./programs/git.nix
|
||||
./programs/bat.nix
|
||||
./programs/helix.nix
|
||||
];
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
home.packages = [];
|
||||
|
||||
catppuccin.flavour = "frappe";
|
||||
|
||||
age.secrets."attic.toml" = {
|
||||
file = ./secrets/attic.toml.age;
|
||||
path = "/Users/ryanccn/.config/attic/config.toml";
|
||||
};
|
||||
}
|
||||
2
justfile
Normal file
2
justfile
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
switch:
|
||||
darwin-rebuild switch --flake .
|
||||
25
overlays/ccache-wrapper.nix
Normal file
25
overlays/ccache-wrapper.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
(self: super: {
|
||||
ccacheWrapper = super.ccacheWrapper.override {
|
||||
extraConfig = ''
|
||||
export CCACHE_COMPRESS=1
|
||||
export CCACHE_DIR="/nix/var/cache/ccache"
|
||||
export CCACHE_UMASK=007
|
||||
if [ ! -d "$CCACHE_DIR" ]; then
|
||||
echo "====="
|
||||
echo "Directory '$CCACHE_DIR' does not exist"
|
||||
echo "Please create it with:"
|
||||
echo " sudo mkdir -m0770 '$CCACHE_DIR'"
|
||||
echo " sudo chown root:nixbld '$CCACHE_DIR'"
|
||||
echo "====="
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -w "$CCACHE_DIR" ]; then
|
||||
echo "====="
|
||||
echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)"
|
||||
echo "Please verify its access permissions"
|
||||
echo "====="
|
||||
exit 1
|
||||
fi
|
||||
'';
|
||||
};
|
||||
})
|
||||
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"
|
||||
BIN
secrets/attic.toml.age
Normal file
BIN
secrets/attic.toml.age
Normal file
Binary file not shown.
5
secrets/secrets.nix
Normal file
5
secrets/secrets.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
let
|
||||
main = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFthNLv08xufLf09hObm+COlDdYDL4WuH9f+PZm54M3I";
|
||||
in {
|
||||
"attic.toml.age".publicKeys = [main];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue