Giter VIP home page Giter VIP logo

home's Introduction

Digital Home

GUI 应用只使用 homebrew 安装

~/envs/Brewfile

cask "firefox-developer-edition"
cask "google-chrome"
cask "iterm2"
cask "telegram"
cask "visual-studio-code"
mas "CoffeeTea - Prevent Sleep", id: 6443935401
mas "Immersive Translate", id: 6447957425
mas "iPic", id: 1101244278
mas "Microsoft Word", id: 462054704
mas "S3", id: 6447647340
mas "WeChat", id: 836500024
mas "Xcode", id: 497799835

命令行应用只使用 nixos 安装

Macos Setup

  1. 手动设置

    1. 输入法设置为双拼
    2. 键盘速度调整:Settings -> Keyboard 按键速度和延迟都调到最低。
    3. 启用三指拖动 Settings -> (Accessibility) -> Enable (Use trackpad for dragging) -> (Dragging Style -> Three Finger Drag)
    4. 启用 tap to click: (Trackpad) -> Enable [Tap to click]
    5. 自动隐藏 dock 栏 Settings -> Dock -> Automatically hide and show the Dock
  2. install xcode tools

xcode-select --install

然后同意协议:

sudo xcodebuild -license
  1. 安装 nix
sh <(curl -L https://nixos.org/nix/install)

一路确认就ok,nix 很详细的描述了它具体都做了啥,可以观察学习一下。 我更推荐使用官方的安装脚本,很多人喜欢用第三方的,他们觉得更干净,默认的配置更友好,但是我觉得好像也没差多少,用原生的,可以顺便学习一下。另外就是我昨天测试的时候,发现第三方安装的nix版本不是最新的,并且在我的osx 14 电脑上有权限错误,但是nix官方的脚本是正常的。

运行完成后重启 terminal 客户端

  1. 安装 homebrew

(用于安装 casks)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. 下载我的配置repo 到 临时目录
mkdir -p ~/inbox
git clone http://github.com/theowenyoung/home ~/inbox/home
  1. 安装gui软件
cd ~/inbox/home/envs && brew bundle
  1. 在浏览器打开 Github 上存放 keepassxc 加密文件的repo,下载密钥文件 main.kdbx, 用 keepassxc 打开,找到我保存的 ssh 条目,保存该条目下的所有附件到 ~/.ssh/, (finder 无法直接选中 ~/.ssh文件夹,需要cmd+shift+g 手动输入该文件夹,选择后,keepassxc软件就会帮我把我的主ssh 下载到本机电脑,这样就可以恢复我的 ssh 文件,随后用于 github repo下载,加密解密密钥等。

  2. 用 nix 安装所有的命令行工具

nix --extra-experimental-features "nix-command flakes" profile install --refresh ~/envs
  1. 使用 nix 的最新版 bash 版本:
sudo vi /etc/shells

添加下面的内容到最后一行:

/Users/green/.nix-profile/bin/bash
chsh -s ~/.nix-profile/bin/bash
  1. 使用我的bashrc
if ! grep -q "# green-bashrc-start" ~/.bash_profile; then
cat >>~/.bash_profile <<EOF
# green-bashrc-start

if [ -f ~/.config/bash/.bashrc ]; then
    source ~/.config/bash/.bashrc
fi

# green-bashrc-end
EOF
fi

source it

. ~/.bash_profile
  1. 安装字体

nix 安装的字体不会自动被安装到系统,需要手动打开 font book, 选择 file add fonts to current user, 选择 ~/nix-profile/share/fonts/truetype/nerdfonts

  1. 打开 iterm2:

  2. Profile -> Window -> Style[Full Screen]

  3. Profile -> Keys -> Left Option Key -> Esc+

  4. Profile -> Keys -> Right Option Key -> Esc+

  5. Profile -> Text -> Font -> FiraCode Nerd Font

  6. General -> Selections -> Applications in terminal may access clipboard.

  7. General -> Selections -> double click performs smart selections

  8. surfingkeys 扩展配置

加载远程配置: https://raw.githubusercontent.com/theowenyoung/home/main/.config/surfingkeys/default.js

  1. alfred 工作流

  2. 修改快捷键为 cmd+space, 移除默认的 spotlight 快捷键

  3. item to finder: https://github.com/LeEnno/alfred-terminalfinder

  4. vimium 配置

unmapAll
map j scrollDown
map k scrollUp
map d scrollPageDown
map a LinkHints.activateModeToOpenInNewTab
map f LinkHints.activateMode
map J nextTab
map K previousTab
map gg scrollToTop
map G scrollToBottom
map h scrollLeft
map l scrollRight

Linux proxy init

  1. (可选) 打开端口

TCP: 34000-37000 UDP: 34000-37000

  1. (可选) 如果需要代理的话,在这里启动,请查看 ./.config/bin/ssnow.sh
sudo apt-get -y update
sudo apt -y install snapd
sudo apt -y install sudo
sudo snap install shadowsocks-rust

# use your own ss://xxxxx
export SERVER_URL=

/snap/bin/shadowsocks-rust.sslocal -b 127.0.0.1:1080 --server-url $SERVER_URL &
/snap/bin/shadowsocks-rust.sslocal --protocol http -b 127.0.0.1:8080 --server-url $SERVER_URL &
export http_proxy=http://127.0.0.1:8080
export https_proxy=http://127.0.0.1:8080
export all_proxy=socks5://127.0.0.1:1080

  1. 安装nix
sh <(curl -L https://nixos.org/nix/install) --daemon --yes
  1. 重新进入 sheel
exit
# reconnect to ssh

(可选)

临时代理需要重新开启:

export SERVER_URL=

/snap/bin/shadowsocks-rust.sslocal -b 127.0.0.1:1080 --server-url $SERVER_URL &
/snap/bin/shadowsocks-rust.sslocal --protocol http -b 127.0.0.1:8080 --server-url $SERVER_URL &
export http_proxy=http://127.0.0.1:8080
export https_proxy=http://127.0.0.1:8080
export all_proxy=socks5://127.0.0.1:1080

  1. 启用 linger (这样让用户级别的任务即使退出也能运行)
sudo loginctl enable-linger $USER
  1. 安装对应的环境软件
nix --extra-experimental-features "nix-command flakes" profile install --refresh "github:theowenyoung/home?dir=envs#proxy"

(可选)如果需要安装root only:

sudo su

如果需要代理:

export http_proxy=http://127.0.0.1:8080
export https_proxy=http://127.0.0.1:8080
export all_proxy=socks5://127.0.0.1:1080

安装 rootonly

nix --extra-experimental-features "nix-command flakes" profile install --refresh "github:theowenyoung/home?dir=envs#rootonly"
  1. 写入 密钥token

// infisical 似乎被墙了...?

这里获取服务器密钥,根据需要选择过期时间

# Get infisical token
export INFISICAL_TOKEN=
# 写入到该地址,root 和 普通用户 应该都需要一份
touch ~/.infisicalenv && chmod 600 ~/.infisicalenv && echo "INFISICAL_TOKEN=$INFISICAL_TOKEN" > ~/.infisicalenv
  1. 下载 dotfiles

只读:

cd "$HOME"
rm -rf .git
git init -b main
git remote add origin https://github.com/theowenyoung/home.git
git fetch origin main
git reset --hard origin/main
git branch --set-upstream-to origin/main main

后期可写:

cd "$HOME"
rm -rf .git
git init -b main
git remote add origin https://github.com/theowenyoung/home.git
git fetch origin main
git reset --hard origin/main
git branch --set-upstream-to origin/main main
git remote set-url --push origin [email protected]:theowenyoung/home.git
git remote -v
  1. 使用我的bashrc(可选)
if ! grep -q "# green-bashrc-start" ~/.bashrc; then
cat >>~/.bashrc <<EOF
# green-bashrc-start

if [ -f ~/.config/bash/.bashrc ]; then
    source ~/.config/bash/.bashrc
fi

# green-bashrc-end
EOF
fi
  1. source it(可选)
. ~/.bashrc
  1. 安装 ss 的service(只能普通用户)
./.config/ss/init.sh
  1. 启动 ss
./.config/ss/up.sh
  1. (可选)安装 Clash meta

Clone secret

git clone [email protected]:theowenyoung/secret.git
./.config/clash/init.sh

everything is ok now.

客户端 ss

一键ss

nixos 初始化

制作 flake.lock 文件

cd envs && nix flake lock
nix run github:nix-community/nixos-anywhere -- --flake .#nixos root@<ip address> --build-on-remote

参考

home's People

Contributors

theowenyoung avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.