Compare commits
250 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d6ffd7785 | |||
| 647f56d213 | |||
| 210aa544fc | |||
| 5e83259bcb | |||
| 0a2aae246a | |||
| 30881f356a | |||
| 3aaaeb49ca | |||
| 55e12cddaf | |||
| ac4f625768 | |||
| 2d44bc6006 | |||
| 03c1d14ed9 | |||
| 73a746cebd | |||
| 1e9dc4df4b | |||
| 7dd55a5de9 | |||
| e61116140d | |||
| b75b79057b | |||
| 1f08d10ac7 | |||
| b2cf885637 | |||
| 44eb487df9 | |||
| 006bf56fd7 | |||
| 73e3707570 | |||
| 82cfa4c6f7 | |||
| 27dd5ebb13 | |||
| a589feee7b | |||
| a9459e7606 | |||
| ad86ed60dc | |||
| 2a42da46ad | |||
| 1817f41423 | |||
| 217057612c | |||
| a1b5572eea | |||
| cddd8101c7 | |||
| d6f6154a22 | |||
| 8ac24e4f13 | |||
| e4abf62ec3 | |||
| 05aa451895 | |||
| c49a96ae29 | |||
| ac3c05545f | |||
| b12af73ff6 | |||
| 45b52845f7 | |||
| 434b3bfe81 | |||
| 6c1cd365a0 | |||
| b1d9bbc26e | |||
| 76b0b1c68d | |||
| 6dca4d1492 | |||
| a237c108d1 | |||
| 9832a955e4 | |||
| c90bb514d0 | |||
| 932e1a236c | |||
| e70f7269f4 | |||
| a07dfbe36a | |||
| d57e3ff61b | |||
| 6f38faef79 | |||
| 50d9301e13 | |||
| 58b02a6b16 | |||
| 29511fa574 | |||
| 809a68fa27 | |||
| 2ac43c8a33 | |||
| 802e9e6e39 | |||
| 625691084a | |||
| 38e7a45bb8 | |||
| dbe62811c7 | |||
| 8d83ded0fb | |||
| 74cec7dd8e | |||
| b2f75a37dc | |||
| a04a058077 | |||
| 7d03e63bdd | |||
| 1cf34add85 | |||
| 20b6aa07af | |||
| ab5a68ce9d | |||
| da729c1ade | |||
| f899d59da9 | |||
| ca8f0dc166 | |||
| 393338a23d | |||
| 5ca251646a | |||
| 75ef84913f | |||
| b92537e264 | |||
| e3a17925f2 | |||
| c170e251ac | |||
| ec1747707b | |||
| 56f2abc737 | |||
| cb6f46aea8 | |||
| dfab5ddacc | |||
| 0e2faec44f | |||
| 88671c40e7 | |||
| 9f59301a0e | |||
| d13a353921 | |||
| 989989ecc6 | |||
| 0a66a3b0a3 | |||
| be036118ca | |||
| 601fcafd31 | |||
| 087d38487c | |||
| b0e481a1f1 | |||
| 1ca7607814 | |||
| 59ea29a7ab | |||
| 486a3b343c | |||
| 3b7772712e | |||
| 37b34beca4 | |||
| ef60e7bf91 | |||
| 05bfd2df13 | |||
| 9d00eb39f9 | |||
| 30a9619f2c | |||
| da2ab6f86b | |||
| 7c61a58808 | |||
| 67c62534e8 | |||
| 26dc7bb149 | |||
| a1120fd930 | |||
| 13c72a8256 | |||
| 0322de2622 | |||
| d9be6f9213 | |||
| b977203d15 | |||
| db4e3b5fdd | |||
| a1f4764526 | |||
| 0996ec71e9 | |||
| 2e8d068070 | |||
| ee606e5518 | |||
| 440eb287ed | |||
| ee9828151c | |||
| 0b6bafb39c | |||
| df570294b4 | |||
| 5e0c7e90ff | |||
| ada780afc8 | |||
| d624ab4323 | |||
| f2dfb10c1b | |||
| f10666ff7c | |||
| a378fa3d60 | |||
| dfefa53e6b | |||
| 09a6af9d36 | |||
| 1172968a93 | |||
| 6d2ba3f0c1 | |||
| 262988949c | |||
| f5a745f37e | |||
| 02b6079198 | |||
| c645d31dd3 | |||
| 32a6789f44 | |||
| f173808e10 | |||
| 7ba80d4458 | |||
| e63a1a92e8 | |||
| 90cb0f987b | |||
| bfd05251f2 | |||
| 13b70df944 | |||
| a0c6965438 | |||
| e36daaa48c | |||
| ca239579d5 | |||
| d34d2adb42 | |||
| cc80f0e885 | |||
| 737603403a | |||
| 05a94aae60 | |||
| b02b7c0af8 | |||
| 24cd473387 | |||
| f6630bc6e0 | |||
| 417e6658dc | |||
| f626371732 | |||
| d318e35a93 | |||
| 7ddac56e17 | |||
| b060b69114 | |||
| 12f3032d8d | |||
| bbd300422b | |||
| b2d19ee218 | |||
| f5c1148c94 | |||
| f682523804 | |||
| b635efba09 | |||
| bd474f798e | |||
| 1575e50fea | |||
| ae851875a9 | |||
| 24630c5e5d | |||
| ae35522d11 | |||
| 6634eb7cb0 | |||
| d0568b9f19 | |||
| 803992635f | |||
| 9dbf2293ce | |||
| bc9b29f62b | |||
| 7347bcb842 | |||
| cc9dfa7940 | |||
| 0db7703857 | |||
| c8e84fbc36 | |||
| d3553ae104 | |||
| 9c5a1b12ef | |||
| d282a3b0b6 | |||
| 62487cc5ca | |||
| f81c62dc0a | |||
| f02f673012 | |||
| 0be942efe2 | |||
| 9f91849707 | |||
| 1cdf80adff | |||
| 8be00a52c8 | |||
| eb5c35d670 | |||
| d00d8cd43b | |||
| b4ea5aa354 | |||
| 8a9af081fc | |||
| ef86bc96f6 | |||
| 289888aa50 | |||
| 5b1b79a760 | |||
| c60388668c | |||
| 9c3e4bea8d | |||
| 2f6d1aa482 | |||
| c5267e7932 | |||
| 08baea2e22 | |||
| 356ed4bfdc | |||
| 3799aa0c90 | |||
| 28779f60ea | |||
| d0a9bdd002 | |||
| 0ee541c9e4 | |||
| e1baf45441 | |||
| e6c1b945f3 | |||
| 0efb7dfba1 | |||
| 4760e508be | |||
| 682346a66a | |||
| 0fac56f612 | |||
| 270d43251f | |||
| c3cf8138f8 | |||
| 7ccccfc84c | |||
| e39b79c508 | |||
| 664506b6cb | |||
| a946ff7cce | |||
| 99819c1df5 | |||
| c515ea9807 | |||
| 7ce3e9a391 | |||
| f61271a323 | |||
| 4a988dbce7 | |||
| 79a866a287 | |||
| bd53ef65ec | |||
| 804bf99e74 | |||
| 6e7fa3e223 | |||
| 508a45d801 | |||
| 7c9cb5156f | |||
| 08d8c4cbc5 | |||
| 7dc0adee72 | |||
| d61b27bcb5 | |||
| 0030a41a8f | |||
| 66fa46afb6 | |||
| 26da19ba38 | |||
| 81a4104973 | |||
| 6b55dfca46 | |||
| b3676ccbe6 | |||
| 71af10ff3b | |||
| a99adf065d | |||
| 2485f24fcc | |||
| 777d915cd2 | |||
| 5df740ca6e | |||
| dd27f9eaeb | |||
| d370d96f47 | |||
| 1e98f591f5 | |||
| 5e2bec4ac5 | |||
| 0c30883e22 | |||
| c9a42f1a13 | |||
| a9c123d9d4 | |||
| e4c9e863cf | |||
| 2970073d5e | |||
| 8bef422482 | |||
| 6247cecf0b |
@@ -0,0 +1,2 @@
|
|||||||
|
patreon: ryan4yin
|
||||||
|
custom: ['https://buymeacoffee.com/ryan4yin', 'https://afdian.net/a/ryan4yin']
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
name: Nix Flake Check
|
||||||
|
|
||||||
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
checks:
|
||||||
|
name: Check expressions
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# - name: Checkout repository
|
||||||
|
# uses: actions/checkout@v4
|
||||||
|
# - name: Install nix
|
||||||
|
# uses: cachix/install-nix-action@v24
|
||||||
|
# with:
|
||||||
|
# install_url: https://nixos.org/nix/install
|
||||||
|
# extra_nix_config: |
|
||||||
|
# access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
||||||
|
# experimental-features = nix-command flakes
|
||||||
|
|
||||||
|
- name: Run Nix Flake Check
|
||||||
|
run: |
|
||||||
|
echo 'TODO: nix flake check'
|
||||||
|
# nix flake check
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
name: Mirror this repo to Gitee
|
||||||
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
|
push: {}
|
||||||
|
jobs:
|
||||||
|
mirror:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Mirror repo to Gitee
|
||||||
|
id: mirror-to-gitee
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
INPUT_SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY_GITEE_MIRROR }}
|
||||||
|
INPUT_TARGET_REPO_URL: git@gitee.com:ryan_yin/nix-config.git
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "$INPUT_SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
|
||||||
|
export GIT_SSH_COMMAND="ssh -v -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no"
|
||||||
|
git remote add mirror "$INPUT_TARGET_REPO_URL"
|
||||||
|
git push --tags --force --prune mirror "refs/remotes/origin/*:refs/heads/*"
|
||||||
|
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
result
|
result
|
||||||
result/
|
result/
|
||||||
|
.direnv/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
|||||||
@@ -13,32 +13,41 @@
|
|||||||
i3:
|
i3:
|
||||||
nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo
|
nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo
|
||||||
|
|
||||||
|
s-i3:
|
||||||
|
nixos-rebuild switch --flake .#shoukei_i3 --use-remote-sudo
|
||||||
|
|
||||||
hypr:
|
hypr:
|
||||||
nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo
|
nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo
|
||||||
|
|
||||||
|
s-hypr:
|
||||||
|
nixos-rebuild switch --flake .#shoukei_hyprland --use-remote-sudo
|
||||||
|
|
||||||
i3-debug:
|
i3-debug:
|
||||||
nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo --show-trace --verbose
|
nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo --show-trace --verbose
|
||||||
|
|
||||||
hypr-debug:
|
hypr-debug:
|
||||||
nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo --show-trace --verbose
|
nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo --show-trace --verbose
|
||||||
|
|
||||||
update:
|
up:
|
||||||
nix flake update
|
nix flake update
|
||||||
|
|
||||||
|
# Update specific input
|
||||||
|
# usage: make upp i=wallpapers
|
||||||
|
upp:
|
||||||
|
nix flake lock --update-input $(i)
|
||||||
|
|
||||||
history:
|
history:
|
||||||
nix profile history --profile /nix/var/nix/profiles/system
|
nix profile history --profile /nix/var/nix/profiles/system
|
||||||
|
|
||||||
|
repl:
|
||||||
|
nix repl -f flake:nixpkgs
|
||||||
|
|
||||||
gc:
|
gc:
|
||||||
# remove all generations older than 7 days
|
# remove all generations older than 7 days
|
||||||
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
|
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
|
||||||
|
|
||||||
# garbage collect all unused nix store entries
|
# garbage collect all unused nix store entries
|
||||||
sudo nix store gc --debug
|
# sudo nix store gc --debug
|
||||||
|
|
||||||
# adjust brightness(x11)
|
|
||||||
# usage: make bright b=0.9
|
|
||||||
bright:
|
|
||||||
xrandr --output DP-2 --brightness $(b)
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
@@ -48,15 +57,27 @@ bright:
|
|||||||
|
|
||||||
darwin-set-proxy:
|
darwin-set-proxy:
|
||||||
sudo python3 scripts/darwin_set_proxy.py
|
sudo python3 scripts/darwin_set_proxy.py
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
darwin-rollback:
|
||||||
|
./result/sw/bin/darwin-rebuild rollback
|
||||||
|
|
||||||
ha: darwin-set-proxy
|
ha: darwin-set-proxy
|
||||||
nix build .#darwinConfigurations.harmonica.system
|
nix build .#darwinConfigurations.harmonica.system
|
||||||
./result/sw/bin/darwin-rebuild switch --flake .
|
./result/sw/bin/darwin-rebuild switch --flake .#harmonica
|
||||||
|
|
||||||
ha-debug: darwin-set-proxy
|
ha-debug: darwin-set-proxy
|
||||||
nix build .#darwinConfigurations.harmonica.system --show-trace --verbose
|
nom build .#darwinConfigurations.harmonica.system --show-trace --verbose
|
||||||
./result/sw/bin/darwin-rebuild switch --flake .#harmonica --show-trace --verbose
|
./result/sw/bin/darwin-rebuild switch --flake .#harmonica --show-trace --verbose
|
||||||
|
|
||||||
|
fe: darwin-set-proxy
|
||||||
|
nix build .#darwinConfigurations.fern.system
|
||||||
|
./result/sw/bin/darwin-rebuild switch --flake .#fern
|
||||||
|
|
||||||
|
fe-debug: darwin-set-proxy
|
||||||
|
nom build .#darwinConfigurations.fern.system --show-trace --verbose
|
||||||
|
./result/sw/bin/darwin-rebuild switch --flake .#fern --show-trace --verbose
|
||||||
|
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
@@ -64,45 +85,70 @@ ha-debug: darwin-set-proxy
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
|
||||||
add-idols-ssh-key:
|
add-idols-ssh-key:
|
||||||
ssh-add ~/.ssh/ai-idols
|
ssh-add ~/.ssh/ai-idols
|
||||||
|
|
||||||
aqua: add-idols-ssh-key
|
idols: add-idols-ssh-key
|
||||||
nixos-rebuild --flake .#aquamarine --target-host aquamarine --build-host aquamarine switch --use-remote-sudo
|
colmena apply --on '@dist-build'
|
||||||
|
|
||||||
aqua-debug: add-idols-ssh-key
|
aqua:
|
||||||
nixos-rebuild --flake .#aquamarine --target-host aquamarine --build-host aquamarine switch --use-remote-sudo --show-trace --verbose
|
colmena apply --on '@aqua'
|
||||||
|
|
||||||
ruby: add-idols-ssh-key
|
ruby:
|
||||||
nixos-rebuild --flake .#ruby --target-host ruby --build-host ruby switch --use-remote-sudo
|
colmena apply --on '@ruby'
|
||||||
|
|
||||||
ruby-debug: add-idols-ssh-key
|
kana:
|
||||||
nixos-rebuild --flake .#ruby --target-host ruby --build-host ruby switch --use-remote-sudo --show-trace --verbose
|
colmena apply --on '@kana'
|
||||||
|
|
||||||
kana: add-idols-ssh-key
|
idols-debug: add-idols-ssh-key
|
||||||
nixos-rebuild --flake .#kana --target-host kana --build-host kana switch --use-remote-sudo
|
colmena apply --on '@dist-build' --verbose --show-trace
|
||||||
|
|
||||||
kana-debug: add-idols-ssh-key
|
|
||||||
nixos-rebuild --flake .#kana --target-host kana --build-host kana switch --use-remote-sudo --show-trace --verbose
|
|
||||||
|
|
||||||
idols: aqua ruby kana
|
|
||||||
|
|
||||||
idols-debug: aqua-debug ruby-debug kana-debug
|
|
||||||
|
|
||||||
# only used once to setup the virtual machines
|
# only used once to setup the virtual machines
|
||||||
idols-image:
|
idols-image:
|
||||||
# take image for idols, and upload the image to proxmox nodes.
|
# take image for idols, and upload the image to proxmox nodes.
|
||||||
nom build .#aquamarine
|
nom build .#aquamarine
|
||||||
scp result/vzdump-qemu-*.vma.zst root@gtr5:/var/lib/vz/dump
|
scp result root@gtr5:/var/lib/vz/dump/vzdump-qemu-aquamarine.vma.zst
|
||||||
|
|
||||||
nom build .#ruby
|
nom build .#ruby
|
||||||
scp result/vzdump-qemu-*.vma.zst root@s500plus:/var/lib/vz/dump
|
scp result root@s500plus:/var/lib/vz/dump/vzdump-qemu-ruby.vma.zst
|
||||||
|
|
||||||
nom build .#kana
|
nom build .#kana
|
||||||
scp result/vzdump-qemu-*.vma.zst root@um560:/var/lib/vz/dump
|
scp result root@um560:/var/lib/vz/dump/vzdump-qemu-kana.vma.zst
|
||||||
|
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# RISC-V related commands
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
roll: add-idols-ssh-key
|
||||||
|
colmena apply --on '@riscv'
|
||||||
|
|
||||||
|
roll-debug: add-idols-ssh-key
|
||||||
|
colmena apply --on '@dist-build' --verbose --show-trace
|
||||||
|
|
||||||
|
nozomi:
|
||||||
|
colmena apply --on '@nozomi'
|
||||||
|
|
||||||
|
yukina:
|
||||||
|
colmena apply --on '@yukina'
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# Aarch64 related commands
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
aarch:
|
||||||
|
colmena apply --on '@aarch'
|
||||||
|
|
||||||
|
suzu:
|
||||||
|
colmena apply --on '@suzu'
|
||||||
|
|
||||||
|
suzu-debug:
|
||||||
|
colmena apply --on '@suzu' --verbose --show-trace
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Misc, other useful commands
|
# Misc, other useful commands
|
||||||
@@ -113,6 +159,3 @@ fmt:
|
|||||||
# format the nix files in this repo
|
# format the nix files in this repo
|
||||||
nix fmt
|
nix fmt
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -rf result
|
|
||||||
|
|||||||
@@ -16,25 +16,27 @@
|
|||||||
|
|
||||||
This repository is home to the nix code that builds my systems.
|
This repository is home to the nix code that builds my systems.
|
||||||
|
|
||||||
## Why Nix?
|
## Why NixOS & Flakes?
|
||||||
|
|
||||||
Nix allows for easy-to-manage, collaborative, reproducible deployments. This means that once something is setup and configured once, it works forever. If someone else shares their configuration, anyone can make use of it.
|
Nix allows for easy-to-manage, collaborative, reproducible deployments. This means that once something is setup and configured once, it works (almost) forever. If someone else shares their configuration, anyone can make use of it(if you really understand what you're copying/refering now).
|
||||||
|
|
||||||
**Want to know Nix in detail? Looking for a beginner-friendly tutorial or best practices? Check out [NixOS & Nix Flakes Book - 🛠️ ❤️ An unofficial & opinionated :book: for beginners](https://github.com/ryan4yin/nixos-and-flakes-book)!**
|
As for Flakes, refer to [Introduction to Flakes - NixOS & Nix Flakes Book](https://nixos-and-flakes.thiscute.world/nixos-with-flakes/introduction-to-flakes)
|
||||||
|
|
||||||
> If you're using macOS, you can also check out [ryan4yin/nix-darwin-kickstarter](https://github.com/ryan4yin/nix-darwin-kickstarter) for a quick start.
|
**Want to know NixOS & Flaks in detail? Looking for a beginner-friendly tutorial or best practices? You don't have to go through the pain I've experienced again! Check out my [NixOS & Nix Flakes Book - 🛠️ ❤️ An unofficial & opinionated :book: for beginners](https://github.com/ryan4yin/nixos-and-flakes-book)!**
|
||||||
|
|
||||||
|
> If you're using macOS, check out [ryan4yin/nix-darwin-kickstarter](https://github.com/ryan4yin/nix-darwin-kickstarter) for a quick start.
|
||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
| | NixOS(Wayland) | NixOS(Xorg) |
|
| | NixOS(Wayland) | NixOS(Xorg) |
|
||||||
| --------------------------- | :--------------------------------------------------------------------------------------------- | :------------------------------------------------------ |
|
| --------------------------- | :---------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- |
|
||||||
| **Window Manager** | [Hyprland][Hyprland] | [i3][i3] |
|
| **Window Manager** | [Hyprland][Hyprland] | [i3][i3] |
|
||||||
| **Terminal Emulator** | [Kitty][Kitty] | [Kitty][Kitty] |
|
| **Terminal Emulator** | [Kitty][Kitty] | [Kitty][Kitty] |
|
||||||
| **Bar** | [Waybar][Waybar] | [i3block][i3block] |
|
| **Bar** | [Waybar][Waybar] | [i3block][i3block] |
|
||||||
| **Application Launcher** | [wofi][wofi] | [rofi][rofi] |
|
| **Application Launcher** | [anyrun][anyrun] | [rofi][rofi] |
|
||||||
| **Notification Daemon** | [Mako][Mako] | [Dunst][Dunst] |
|
| **Notification Daemon** | [Mako][Mako] | [Dunst][Dunst] |
|
||||||
| **Display Manager** | [GDM][GDM] | [GDM][GDM] |
|
| **Display Manager** | [GDM][GDM] | [GDM][GDM] |
|
||||||
| \***\*Color Scheme\*\*** | [Catppuccin][Catppuccin] | [Catppuccin][Catppuccin] |
|
| **Color Scheme** | [Catppuccin][Catppuccin] | [Catppuccin][Catppuccin] |
|
||||||
| **network management tool** | [NetworkManager][NetworkManager] | [NetworkManager][NetworkManager] |
|
| **network management tool** | [NetworkManager][NetworkManager] | [NetworkManager][NetworkManager] |
|
||||||
| **Input method framework** | [Fcitx5][Fcitx5] | [Fcitx5][Fcitx5] |
|
| **Input method framework** | [Fcitx5][Fcitx5] | [Fcitx5][Fcitx5] |
|
||||||
| **System resource monitor** | [Btop][Btop] | [Btop][Btop] |
|
| **System resource monitor** | [Btop][Btop] | [Btop][Btop] |
|
||||||
@@ -44,9 +46,11 @@ Nix allows for easy-to-manage, collaborative, reproducible deployments. This mea
|
|||||||
| **Media Player** | [mpv][mpv] | [mpv][mpv] |
|
| **Media Player** | [mpv][mpv] | [mpv][mpv] |
|
||||||
| **Text Editor** | [Neovim][Neovim] | [Neovim][Neovim] |
|
| **Text Editor** | [Neovim][Neovim] | [Neovim][Neovim] |
|
||||||
| **Fonts** | [Nerd fonts][Nerd fonts] | [Nerd fonts][Nerd fonts] |
|
| **Fonts** | [Nerd fonts][Nerd fonts] | [Nerd fonts][Nerd fonts] |
|
||||||
| **Image Viewer** | [imv][imv] | [feh][feh] |
|
| **Image Viewer** | [imv][imv] | [imv][imv] |
|
||||||
| **Screenshot Software** | [grim][grim] | [flameshot](https://github.com/flameshot-org/flameshot) |
|
| **Screenshot Software** | [grim][grim] | [flameshot](https://github.com/flameshot-org/flameshot) |
|
||||||
| **Screen Recording** | [OBS][OBS] | [OBS][OBS] |
|
| **Screen Recording** | [OBS][OBS] | [OBS][OBS] |
|
||||||
|
| **Filesystem & Encryption** | tmpfs on `/`, [Btrfs][Btrfs] subvolumes on a [LUKS][LUKS] crypted partition for persistent, unlock via passphrase | tmpfs on `/`, [Btrfs][Btrfs] subvolumes on a [LUKS][LUKS] crypted partition for persistent, unlock via passphrase |
|
||||||
|
| **Secure Boot** | [lanzaboote][lanzaboote] | [lanzaboote][lanzaboote] |
|
||||||
|
|
||||||
Wallpapers: https://github.com/ryan4yin/wallpapers
|
Wallpapers: https://github.com/ryan4yin/wallpapers
|
||||||
|
|
||||||
@@ -61,17 +65,27 @@ Wallpapers: https://github.com/ryan4yin/wallpapers
|
|||||||

|

|
||||||

|

|
||||||
|
|
||||||
|
## Neovim
|
||||||
|
|
||||||
|
See [./home/base/desktop/neovim](./home/base/desktop/neovim) for details.
|
||||||
|
|
||||||
## Hosts
|
## Hosts
|
||||||
|
|
||||||
See [./hosts](./hosts) for details.
|
See [./hosts](./hosts) for details.
|
||||||
|
|
||||||
|
## Secrets Management
|
||||||
|
|
||||||
|
See [./secrets](./secrets) for details.
|
||||||
|
|
||||||
## How to Deploy this Flake?
|
## How to Deploy this Flake?
|
||||||
|
|
||||||
> :red_circle: **IMPORTANT**: **You should NOT deploy this flake directly on your machine:exclamation: It will not succeed.** this flake contains my hardware configuration(such as [hardware-configuration.nix](hosts/idols/ai/hardware-configuration.nix)) which is not suitable for your hardware, and my private secrets repository [ryan4yin/nix-secrets](https://github.com/ryan4yin/nix-config/tree/main/secrets) that only I have access to. You may use this repo as a reference to build your own configuration.
|
> :red_circle: **IMPORTANT**: **You should NOT deploy this flake directly on your machine:exclamation: It will not succeed.** this flake contains my hardware configuration(such as [hardware-configuration.nix](hosts/idols/ai/hardware-configuration.nix), [cifs-mount.nix](https://github.com/ryan4yin/nix-config/blob/v0.1.1/hosts/idols/ai/cifs-mount.nix), [Nvidia Support](https://github.com/ryan4yin/nix-config/blob/v0.1.1/hosts/idols/ai/default.nix#L77-L91), etc.) which is not suitable for your hardware, and my private secrets repository [ryan4yin/nix-secrets](https://github.com/ryan4yin/nix-config/tree/main/secrets) that only I have access to. You may use this repo as a reference to build your own configuration.
|
||||||
|
|
||||||
After installing NixOS with `nix-command` & `flake` enabled, follow the steps below to deploy this flake.
|
For NixOS:
|
||||||
|
|
||||||
For NixOS, use the following commands:
|
> To deploy this flake from NixOS's official ISO image(purest installation method), please refer to [./nixos-installer/](./nixos-installer/)
|
||||||
|
|
||||||
|
> Need to restart the machine when switching between `wayland` and `xorg`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# deploy one of the configuration based on the hostname
|
# deploy one of the configuration based on the hostname
|
||||||
@@ -87,34 +101,21 @@ make i3-debug
|
|||||||
# make hypr-debug
|
# make hypr-debug
|
||||||
```
|
```
|
||||||
|
|
||||||
For MacOS, use the following commands:
|
For macOS:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# deploy the darwin configuration(harmonicia)
|
# deploy harmonicia's configuration(macOS Intel)
|
||||||
make ha
|
make ha
|
||||||
|
|
||||||
|
# deploy fern's configuration(Apple Silicon)
|
||||||
|
make fe
|
||||||
|
|
||||||
# deploy with details
|
# deploy with details
|
||||||
make ha-debug
|
make ha-debug
|
||||||
|
# make fe
|
||||||
```
|
```
|
||||||
|
|
||||||
## Install Apps from Flatpak
|
> [What y'all will need when Nix drives you to drink.](https://www.youtube.com/watch?v=Eni9PPPPBpg) (copy from hlissner's dotfiles, it really matches my feelings when I first started using NixOS...)
|
||||||
|
|
||||||
We can install apps from flathub, which has a lot of apps that are not supported well in nixpkgs.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Add the Flathub repository
|
|
||||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
||||||
|
|
||||||
# install apps from flathub
|
|
||||||
flatpak install netease-cloud-music-gtk
|
|
||||||
|
|
||||||
# install 3d printer slicer - cura
|
|
||||||
flatpak install flathub com.ultimaker.cura
|
|
||||||
|
|
||||||
# or you can search apps from flathub
|
|
||||||
flatpak search <keyword>
|
|
||||||
# search on website is also supported: https://flathub.org/
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to create & managage VM from this flake?
|
## How to create & managage VM from this flake?
|
||||||
|
|
||||||
@@ -137,15 +138,12 @@ Once the virtual machine `aquamarine` is created, we can deploy updates to it wi
|
|||||||
# 1. add the ssh key to ssh-agent
|
# 1. add the ssh key to ssh-agent
|
||||||
ssh-add ~/.ssh/ai-idols
|
ssh-add ~/.ssh/ai-idols
|
||||||
|
|
||||||
# 2. deploy the configuration to the remote host, using the ssh key we added in step 1
|
# 2. deploy the configuration to all the remote host with tag `@dist-build`
|
||||||
# and the username defaults to `$USER`, it's `ryan` in my case.
|
# using the ssh key we added in step 1
|
||||||
nixos-rebuild --flake .#aquamarine --target-host aquamarine --build-host aquamarine switch --use-remote-sudo --verbose
|
colmena apply --on '@dist-build' --show-trace
|
||||||
|
|
||||||
# or we can replace the command above with the following command, which is defined in Makefile
|
|
||||||
make aqua
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The commands above will build & deploy the configuration to `aquamarine`, the build process will be executed on `aquamarine` too, and the `--use-remote-sudo` option indicates that we will use `sudo` on the remote host.
|
If you're not familiar with remote deployment, please read this tutorial first: [Remote Deployment - NixOS & Flakes Book](https://nixos-and-flakes.thiscute.world/best-practices/remote-deployment)
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
@@ -157,14 +155,19 @@ Other dotfiles that inspired me:
|
|||||||
- [xddxdd/nixos-config](https://github.com/xddxdd/nixos-config)
|
- [xddxdd/nixos-config](https://github.com/xddxdd/nixos-config)
|
||||||
- [bobbbay/dotfiles](https://github.com/bobbbay/dotfiles)
|
- [bobbbay/dotfiles](https://github.com/bobbbay/dotfiles)
|
||||||
- [gytis-ivaskevicius/nixfiles](https://github.com/gytis-ivaskevicius/nixfiles)
|
- [gytis-ivaskevicius/nixfiles](https://github.com/gytis-ivaskevicius/nixfiles)
|
||||||
- [fufexan/dotfiles](https://github.com/fufexan/dotfiles)
|
|
||||||
- [davidtwco/veritas](https://github.com/davidtwco/veritas)
|
- [davidtwco/veritas](https://github.com/davidtwco/veritas)
|
||||||
- [gvolpe/nix-config](https://github.com/gvolpe/nix-config)
|
- [gvolpe/nix-config](https://github.com/gvolpe/nix-config)
|
||||||
- [Ruixi-rebirth/flakes](https://github.com/Ruixi-rebirth/flakes)
|
- [Ruixi-rebirth/flakes](https://github.com/Ruixi-rebirth/flakes)
|
||||||
- Hyprland
|
- [fufexan/dotfiles](https://github.com/fufexan/dotfiles): gtk theme, xdg, git, media, anyrun, etc.
|
||||||
- [HeinzDev/Hyprland-dotfiles](https://github.com/HeinzDev/Hyprland-dotfiles)
|
- Modularized NixOS Configuration
|
||||||
- [notwidow/hyprland](https://github.com/notwidow/hyprland)
|
- [hlissner/dotfiles](https://github.com/hlissner/dotfiles)
|
||||||
|
- [viperML/dotfiles](https://github.com/viperML/dotfiles)
|
||||||
|
- Hyprland(wayland)
|
||||||
|
- [notwidow/hyprland](https://github.com/notwidow/hyprland): This is where I start my hyprland journey.
|
||||||
|
- [HeinzDev/Hyprland-dotfiles](https://github.com/HeinzDev/Hyprland-dotfiles): Refer to the waybar configuration here.
|
||||||
|
- [linuxmobile/kaku](https://github.com/linuxmobile/kaku)
|
||||||
- I3 Window Manager
|
- I3 Window Manager
|
||||||
|
- [endeavouros-i3wm-setup](https://github.com/endeavouros-team/endeavouros-i3wm-setup): I started using i3 here, and my i3 configuration is also based on it, but made a lot of changes.
|
||||||
- [denisse-dev/dotfiles](https://github.com/denisse-dev/dotfiles)
|
- [denisse-dev/dotfiles](https://github.com/denisse-dev/dotfiles)
|
||||||
- Neovim/AstroNvim
|
- Neovim/AstroNvim
|
||||||
- [maxbrunet/dotfiles](https://github.com/maxbrunet/dotfiles): astronvim with nix flakes.
|
- [maxbrunet/dotfiles](https://github.com/maxbrunet/dotfiles): astronvim with nix flakes.
|
||||||
@@ -179,7 +182,7 @@ Other dotfiles that inspired me:
|
|||||||
[Waybar]: https://github.com/Alexays/Waybar
|
[Waybar]: https://github.com/Alexays/Waybar
|
||||||
[i3block]: https://github.com/vivien/i3blocks
|
[i3block]: https://github.com/vivien/i3blocks
|
||||||
[rofi]: https://github.com/davatorium/rofi
|
[rofi]: https://github.com/davatorium/rofi
|
||||||
[wofi]: https://hg.sr.ht/~scoopta/wofi
|
[anyrun]: https://github.com/Kirottu/anyrun
|
||||||
[Dunst]: https://github.com/dunst-project/dunst
|
[Dunst]: https://github.com/dunst-project/dunst
|
||||||
[Fcitx5]: https://github.com/fcitx/fcitx5
|
[Fcitx5]: https://github.com/fcitx/fcitx5
|
||||||
[Btop]: https://github.com/aristocratos/btop
|
[Btop]: https://github.com/aristocratos/btop
|
||||||
@@ -188,7 +191,6 @@ Other dotfiles that inspired me:
|
|||||||
[AstroNvim]: https://github.com/AstroNvim/AstroNvim
|
[AstroNvim]: https://github.com/AstroNvim/AstroNvim
|
||||||
[flameshot]: https://github.com/flameshot-org/flameshot
|
[flameshot]: https://github.com/flameshot-org/flameshot
|
||||||
[grim]: https://github.com/emersion/grim
|
[grim]: https://github.com/emersion/grim
|
||||||
[feh]: https://github.com/derf/feh
|
|
||||||
[imv]: https://sr.ht/~exec64/imv/
|
[imv]: https://sr.ht/~exec64/imv/
|
||||||
[OBS]: https://obsproject.com
|
[OBS]: https://obsproject.com
|
||||||
[Mako]: https://github.com/emersion/mako
|
[Mako]: https://github.com/emersion/mako
|
||||||
@@ -204,3 +206,6 @@ Other dotfiles that inspired me:
|
|||||||
[thunar]: https://gitlab.xfce.org/xfce/thunar
|
[thunar]: https://gitlab.xfce.org/xfce/thunar
|
||||||
[ranger]: https://github.com/ranger/ranger
|
[ranger]: https://github.com/ranger/ranger
|
||||||
[Catppuccin]: https://github.com/catppuccin/catppuccin
|
[Catppuccin]: https://github.com/catppuccin/catppuccin
|
||||||
|
[Btrfs]: https://btrfs.readthedocs.io
|
||||||
|
[LUKS]: https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system
|
||||||
|
[lanzaboote]: https://github.com/nix-community/lanzaboote
|
||||||
|
|||||||
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 362 KiB |
|
After Width: | Height: | Size: 350 KiB |
@@ -0,0 +1,17 @@
|
|||||||
|
rec {
|
||||||
|
# user information
|
||||||
|
username = "ryan";
|
||||||
|
userfullname = "Ryan Yin";
|
||||||
|
useremail = "xiaoyin_c@qq.com";
|
||||||
|
|
||||||
|
allSystemAttrs = {
|
||||||
|
# linux systems
|
||||||
|
x64_system = "x86_64-linux";
|
||||||
|
riscv64_system = "riscv64-linux";
|
||||||
|
aarch64_system = "aarch64-linux";
|
||||||
|
# darwin systems
|
||||||
|
x64_darwin = "x86_64-darwin";
|
||||||
|
aarch64_darwin = "aarch64-darwin";
|
||||||
|
};
|
||||||
|
allSystems = builtins.attrValues allSystemAttrs;
|
||||||
|
}
|
||||||
@@ -16,146 +16,73 @@
|
|||||||
outputs = inputs @ {
|
outputs = inputs @ {
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
nixpkgs-unstable,
|
pre-commit-hooks,
|
||||||
nix-darwin,
|
|
||||||
home-manager,
|
|
||||||
nixos-generators,
|
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
username = "ryan";
|
constants = import ./constants.nix;
|
||||||
userfullname = "Ryan Yin";
|
|
||||||
useremail = "xiaoyin_c@qq.com";
|
|
||||||
|
|
||||||
x64_system = "x86_64-linux";
|
# `lib.genAttrs [ "foo" "bar" ] (name: "x_" + name)` => `{ foo = "x_foo"; bar = "x_bar"; }`
|
||||||
x64_darwin = "x86_64-darwin";
|
forEachSystem = func: (nixpkgs.lib.genAttrs constants.allSystems func);
|
||||||
allSystems = [x64_system x64_darwin];
|
|
||||||
|
|
||||||
nixosSystem = import ./lib/nixosSystem.nix;
|
|
||||||
macosSystem = import ./lib/macosSystem.nix;
|
|
||||||
in {
|
|
||||||
nixosConfigurations = let
|
|
||||||
# 星野 アイ, Hoshino Ai
|
|
||||||
idol_ai_modules_i3 = {
|
|
||||||
nixos-modules = [
|
|
||||||
./hosts/idols/ai
|
|
||||||
./modules/nixos/i3.nix
|
|
||||||
];
|
|
||||||
home-module = import ./home/linux/desktop-i3.nix;
|
|
||||||
};
|
|
||||||
idol_ai_modules_hyprland = {
|
|
||||||
nixos-modules = [
|
|
||||||
./hosts/idols/ai
|
|
||||||
./modules/nixos/hyprland.nix
|
|
||||||
];
|
|
||||||
home-module = import ./home/linux/desktop-hyprland.nix;
|
|
||||||
};
|
|
||||||
|
|
||||||
# 星野 愛久愛海, Hoshino Akuamarin
|
|
||||||
idol_aquamarine_modules = {
|
|
||||||
nixos-modules = [
|
|
||||||
./hosts/idols/aquamarine
|
|
||||||
];
|
|
||||||
home-module = import ./home/linux/server.nix;
|
|
||||||
};
|
|
||||||
|
|
||||||
# 星野 瑠美衣, Hoshino Rubii
|
|
||||||
idol_ruby_modules = {
|
|
||||||
nixos-modules = [
|
|
||||||
./hosts/idols/ruby
|
|
||||||
];
|
|
||||||
home-module = import ./home/linux/server.nix;
|
|
||||||
};
|
|
||||||
|
|
||||||
# 有馬 かな, Arima Kana
|
|
||||||
idol_kana_modules = {
|
|
||||||
nixos-modules = [
|
|
||||||
./hosts/idols/kana
|
|
||||||
];
|
|
||||||
home-module = import ./home/linux/server.nix;
|
|
||||||
};
|
|
||||||
|
|
||||||
system = x64_system;
|
|
||||||
specialArgs =
|
|
||||||
{
|
|
||||||
inherit username userfullname useremail;
|
|
||||||
# use unstable branch for some packages to get the latest updates
|
|
||||||
pkgs-unstable = import nixpkgs-unstable {
|
|
||||||
system = x64_system; # refer the `system` parameter form outer scope recursively
|
|
||||||
# To use chrome, we need to allow the installation of non-free software
|
|
||||||
config.allowUnfree = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// inputs;
|
|
||||||
base_args = {
|
|
||||||
inherit home-manager nixos-generators system specialArgs;
|
|
||||||
};
|
|
||||||
stable_args = base_args // {inherit nixpkgs;};
|
|
||||||
unstable_args = base_args // {nixpkgs = nixpkgs-unstable;};
|
|
||||||
in {
|
|
||||||
# ai with i3 window manager
|
|
||||||
ai_i3 = nixosSystem (idol_ai_modules_i3 // stable_args);
|
|
||||||
# ai with hyprland compositor
|
|
||||||
ai_hyprland = nixosSystem (idol_ai_modules_hyprland // stable_args);
|
|
||||||
|
|
||||||
aquamarine = nixosSystem (idol_aquamarine_modules // stable_args);
|
|
||||||
ruby = nixosSystem (idol_ruby_modules // stable_args);
|
|
||||||
kana = nixosSystem (idol_kana_modules // stable_args);
|
|
||||||
};
|
|
||||||
|
|
||||||
# take system images for idols
|
|
||||||
# https://github.com/nix-community/nixos-generators
|
|
||||||
packages."${x64_system}" =
|
|
||||||
# genAttrs returns an attribute set with the given keys and values(host => image).
|
|
||||||
nixpkgs.lib.genAttrs [
|
|
||||||
"ai_i3"
|
|
||||||
"ai_hyprland"
|
|
||||||
] (
|
|
||||||
host:
|
|
||||||
self.nixosConfigurations.${host}.config.formats.iso
|
|
||||||
)
|
|
||||||
// nixpkgs.lib.genAttrs [
|
|
||||||
"aquamarine"
|
|
||||||
"ruby"
|
|
||||||
"kana"
|
|
||||||
] (
|
|
||||||
host:
|
|
||||||
self.nixosConfigurations.${host}.config.formats.proxmox
|
|
||||||
);
|
|
||||||
|
|
||||||
# macOS's configuration, for work.
|
|
||||||
darwinConfigurations = let
|
|
||||||
system = x64_darwin;
|
|
||||||
specialArgs =
|
|
||||||
{
|
|
||||||
inherit username userfullname useremail;
|
|
||||||
# use unstable branch for some packages to get the latest updates
|
|
||||||
pkgs-unstable = import nixpkgs-unstable {
|
|
||||||
inherit system; # refer the `system` parameter form outer scope recursively
|
|
||||||
# To use chrome, we need to allow the installation of non-free software
|
|
||||||
config.allowUnfree = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// inputs;
|
|
||||||
base_args = {
|
|
||||||
inherit nix-darwin home-manager system specialArgs;
|
|
||||||
};
|
|
||||||
in {
|
|
||||||
harmonica = macosSystem (base_args // {
|
|
||||||
darwin-modules = [
|
|
||||||
./hosts/harmonica
|
|
||||||
];
|
|
||||||
home-module = import ./home/darwin;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
allSystemConfigurations = import ./systems {inherit self inputs constants;};
|
||||||
|
in
|
||||||
|
allSystemConfigurations
|
||||||
|
// {
|
||||||
# format the nix code in this flake
|
# format the nix code in this flake
|
||||||
# alejandra is a nix formatter with a beautiful output
|
# alejandra is a nix formatter with a beautiful output
|
||||||
formatter = nixpkgs.lib.genAttrs allSystems (
|
formatter = forEachSystem (
|
||||||
system:
|
system: nixpkgs.legacyPackages.${system}.alejandra
|
||||||
nixpkgs.legacyPackages.${system}.alejandra
|
);
|
||||||
|
|
||||||
|
# pre-commit hooks for nix code
|
||||||
|
checks = forEachSystem (
|
||||||
|
system: {
|
||||||
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||||
|
src = ./.;
|
||||||
|
hooks = {
|
||||||
|
alejandra.enable = true; # formatter
|
||||||
|
# deadnix.enable = true; # detect unused variable bindings in `*.nix`
|
||||||
|
statix.enable = true; # lints and suggestions for Nix code(auto suggestions)
|
||||||
|
prettier = {
|
||||||
|
enable = true;
|
||||||
|
excludes = [".js" ".md" ".ts"];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
devShells = forEachSystem (
|
||||||
|
system: {
|
||||||
|
default = nixpkgs.legacyPackages.${system}.mkShell {
|
||||||
|
packages = [
|
||||||
|
# fix https://discourse.nixos.org/t/non-interactive-bash-errors-from-flake-nix-mkshell/33310
|
||||||
|
nixpkgs.legacyPackages.${system}.bashInteractive
|
||||||
|
];
|
||||||
|
name = "dots";
|
||||||
|
shellHook = ''
|
||||||
|
${self.checks.${system}.pre-commit-check.shellHook}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# the nixConfig here only affects the flake itself, not the system configuration!
|
||||||
|
# for more information, see:
|
||||||
|
# https://nixos-and-flakes.thiscute.world/nixos-with-flakes/add-custom-cache-servers
|
||||||
|
nixConfig = {
|
||||||
|
# substituers will be appended to the default substituters when fetching packages
|
||||||
|
extra-substituters = [
|
||||||
|
"https://anyrun.cachix.org"
|
||||||
|
"https://hyprland.cachix.org"
|
||||||
|
# "https://nixpkgs-wayland.cachix.org"
|
||||||
|
];
|
||||||
|
extra-trusted-public-keys = [
|
||||||
|
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
||||||
|
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||||
|
# "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# This is the standard format for flake.nix. `inputs` are the dependencies of the flake,
|
# This is the standard format for flake.nix. `inputs` are the dependencies of the flake,
|
||||||
# Each item in `inputs` will be passed as a parameter to the `outputs` function after being pulled and built.
|
# Each item in `inputs` will be passed as a parameter to the `outputs` function after being pulled and built.
|
||||||
@@ -164,51 +91,85 @@
|
|||||||
# which represents the GitHub repository URL + branch/commit-id/tag.
|
# which represents the GitHub repository URL + branch/commit-id/tag.
|
||||||
|
|
||||||
# Official NixOS package source, using nixos's stable branch by default
|
# Official NixOS package source, using nixos's stable branch by default
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||||
|
# nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
# for macos
|
# for macos
|
||||||
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin";
|
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.11-darwin";
|
||||||
nix-darwin = {
|
nix-darwin = {
|
||||||
url = "github:lnl7/nix-darwin";
|
url = "github:lnl7/nix-darwin";
|
||||||
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||||
};
|
};
|
||||||
|
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||||
|
|
||||||
# home-manager, used for managing user configuration
|
# home-manager, used for managing user configuration
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager/release-23.05";
|
url = "github:nix-community/home-manager/release-23.11";
|
||||||
|
# url = "github:nix-community/home-manager/master";
|
||||||
|
|
||||||
# The `follows` keyword in inputs is used for inheritance.
|
# The `follows` keyword in inputs is used for inheritance.
|
||||||
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
|
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
|
||||||
# to avoid problems caused by different versions of nixpkgs dependencies.
|
# to avoid problems caused by different versions of nixpkgs dependencies.
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
# modern window compositor
|
lanzaboote = {
|
||||||
hyprland.url = "github:hyprwm/Hyprland/v0.27.2";
|
url = "github:nix-community/lanzaboote/v0.3.0";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
impermanence.url = "github:nix-community/impermanence";
|
||||||
|
|
||||||
|
hyprland = {
|
||||||
|
url = "github:hyprwm/Hyprland/v0.33.1";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# community wayland nixpkgs
|
# community wayland nixpkgs
|
||||||
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
# nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
||||||
|
# anyrun - a wayland launcher
|
||||||
|
anyrun = {
|
||||||
|
url = "github:Kirottu/anyrun";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# generate iso/qcow2/docker/... image from nixos configuration
|
# generate iso/qcow2/docker/... image from nixos configuration
|
||||||
nixos-generators = {
|
nixos-generators = {
|
||||||
url = "github:nix-community/nixos-generators";
|
url = "github:nix-community/nixos-generators";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
# secrets management
|
||||||
|
agenix = {
|
||||||
|
# lock with git commit at 0.14.0
|
||||||
|
url = "github:ryantm/agenix/54693c91d923fecb4cf04c4535e3d84f8dec7919";
|
||||||
|
# replaced with a type-safe reimplementation to get a better error message and less bugs.
|
||||||
|
# url = "github:ryan4yin/ragenix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# secrets management, lock with git commit at 2023/7/15
|
# add git hooks to format nix code before commit
|
||||||
agenix.url = "github:ryantm/agenix/0d8c5325fc81daf00532e3e26c6752f7bcde1143";
|
pre-commit-hooks = {
|
||||||
|
url = "github:cachix/pre-commit-hooks.nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
######################## Some non-flake repositories #########################################
|
||||||
|
|
||||||
# AstroNvim is an aesthetic and feature-rich neovim config.
|
# AstroNvim is an aesthetic and feature-rich neovim config.
|
||||||
astronvim = {
|
astronvim = {
|
||||||
url = "github:AstroNvim/AstroNvim/v3.34.0";
|
url = "github:AstroNvim/AstroNvim/v3.40.3";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# useful nushell scripts, such as auto_completion
|
# useful nushell scripts, such as auto_completion
|
||||||
nushell-scripts = {
|
nushell-scripts = {
|
||||||
url = "github:nushell/nu_scripts";
|
url = "github:nushell/nu_scripts/main";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
######################## My own repositories #########################################
|
||||||
|
|
||||||
# my private secrets, it's a private repository, you need to replace it with your own.
|
# my private secrets, it's a private repository, you need to replace it with your own.
|
||||||
# use ssh protocol to authenticate via ssh-agent/ssh-key, and shallow clone to save time
|
# use ssh protocol to authenticate via ssh-agent/ssh-key, and shallow clone to save time
|
||||||
mysecrets = {
|
mysecrets = {
|
||||||
@@ -222,61 +183,16 @@
|
|||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
# color scheme - catppuccin
|
nur-ryan4yin = {
|
||||||
catppuccin-btop = {
|
url = "github:ryan4yin/nur-packages";
|
||||||
url = "github:catppuccin/btop";
|
# inputs.nixpkgs.follows = "nixpkgs";
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
catppuccin-fcitx5 = {
|
|
||||||
url = "github:catppuccin/fcitx5";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
catppuccin-bat = {
|
|
||||||
url = "github:catppuccin/bat";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
catppuccin-alacritty = {
|
|
||||||
url = "github:catppuccin/alacritty";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
catppuccin-helix = {
|
|
||||||
url = "github:catppuccin/helix";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
catppuccin-starship = {
|
|
||||||
url = "github:catppuccin/starship";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
catppuccin-hyprland = {
|
|
||||||
url = "github:catppuccin/hyprland";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
catppuccin-cava = {
|
|
||||||
url = "github:catppuccin/cava";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# riscv64 SBCs
|
||||||
|
nixos-licheepi4a.url = "github:ryan4yin/nixos-licheepi4a";
|
||||||
|
# nixos-jh7110.url = "github:ryan4yin/nixos-jh7110";
|
||||||
|
|
||||||
# the nixConfig here only affects the flake itself, not the system configuration!
|
# aarch64 SBCs
|
||||||
nixConfig = {
|
nixos-rk3588.url = "github:ryan4yin/nixos-rk3588";
|
||||||
experimental-features = ["nix-command" "flakes"];
|
|
||||||
|
|
||||||
substituters = [
|
|
||||||
# replace official cache with a mirror located in China
|
|
||||||
"https://mirrors.ustc.edu.cn/nix-channels/store"
|
|
||||||
"https://cache.nixos.org"
|
|
||||||
];
|
|
||||||
|
|
||||||
# nix community's cache server
|
|
||||||
extra-substituters = [
|
|
||||||
"https://nix-community.cachix.org"
|
|
||||||
"https://nixpkgs-wayland.cachix.org"
|
|
||||||
];
|
|
||||||
extra-trusted-public-keys = [
|
|
||||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
||||||
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,9 @@
|
|||||||
{ username, ... }: {
|
{username, ...}: {
|
||||||
imports = [
|
|
||||||
../base/desktop
|
|
||||||
|
|
||||||
./base
|
|
||||||
./fcitx5
|
|
||||||
./desktop
|
|
||||||
|
|
||||||
./i3
|
|
||||||
];
|
|
||||||
|
|
||||||
# Home Manager needs a bit of information about you and the
|
# Home Manager needs a bit of information about you and the
|
||||||
# paths it should manage.
|
# paths it should manage.
|
||||||
home = {
|
home = {
|
||||||
username = username;
|
inherit username;
|
||||||
homeDirectory = "/home/${username}";
|
|
||||||
|
|
||||||
# This value determines the Home Manager release that your
|
# This value determines the Home Manager release that your
|
||||||
# configuration is compatible with. This helps avoid breakage
|
# configuration is compatible with. This helps avoid breakage
|
||||||
@@ -23,7 +13,7 @@
|
|||||||
# You can update Home Manager without changing this value. See
|
# You can update Home Manager without changing this value. See
|
||||||
# the Home Manager release notes for a list of state version
|
# the Home Manager release notes for a list of state version
|
||||||
# changes in each release.
|
# changes in each release.
|
||||||
stateVersion = "22.11";
|
stateVersion = "23.11";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{pkgs, ...}: {
|
||||||
|
home.packages = with pkgs;
|
||||||
|
[
|
||||||
|
# general tools
|
||||||
|
pulumi
|
||||||
|
pulumictl
|
||||||
|
# istioctl
|
||||||
|
|
||||||
|
# aws
|
||||||
|
awscli2
|
||||||
|
ssm-session-manager-plugin # Amazon SSM Session Manager Plugin
|
||||||
|
aws-iam-authenticator
|
||||||
|
eksctl
|
||||||
|
istioctl
|
||||||
|
|
||||||
|
# aliyun
|
||||||
|
aliyun-cli
|
||||||
|
]
|
||||||
|
++ (
|
||||||
|
if pkgs.stdenv.isLinux
|
||||||
|
then [
|
||||||
|
# cloud tools that nix do not have cache for.
|
||||||
|
terraform
|
||||||
|
terraformer # generate terraform configs from existing cloud resources
|
||||||
|
]
|
||||||
|
else []
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
pkgs-unstable,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
skopeo
|
||||||
|
docker-compose
|
||||||
|
dive # explore docker layers
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{mylib, ...}: {
|
||||||
|
imports = mylib.scanPaths ./.;
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
kubectl
|
||||||
|
kubernetes-helm
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
k9s = {
|
||||||
|
enable = true;
|
||||||
|
skin = let
|
||||||
|
skin_file = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-k9s}/dist/mocha.yml"; # theme - catppuccin mocha
|
||||||
|
skin_attr = builtins.fromJSON (
|
||||||
|
builtins.readFile
|
||||||
|
# replace 'base: &base "#1e1e2e"' with 'base: &base "default"'
|
||||||
|
# to make fg/bg color transparent. "default" means transparent in k9s skin.
|
||||||
|
(pkgs.runCommandNoCC "get-skin-json" {} ''
|
||||||
|
cat ${skin_file} \
|
||||||
|
| sed -E 's@(base: &base ).+@\1 "default"@g' \
|
||||||
|
| ${pkgs.yj}/bin/yj > $out
|
||||||
|
'')
|
||||||
|
);
|
||||||
|
in
|
||||||
|
skin_attr;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,14 +1,3 @@
|
|||||||
{...}: {
|
{mylib, ...}: {
|
||||||
imports = [
|
imports = mylib.scanPaths ./.;
|
||||||
../server
|
|
||||||
|
|
||||||
./neovim
|
|
||||||
|
|
||||||
./alacritty.nix
|
|
||||||
./development.nix
|
|
||||||
./helix.nix
|
|
||||||
./kitty.nix
|
|
||||||
./media.nix
|
|
||||||
./shell.nix
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,44 +8,29 @@
|
|||||||
# Basic settings for development environment
|
# Basic settings for development environment
|
||||||
#
|
#
|
||||||
# Please avoid to install language specific packages here(globally),
|
# Please avoid to install language specific packages here(globally),
|
||||||
# instead, install them independently using dev-templates:
|
# instead, install them:
|
||||||
# https://github.com/the-nix-way/dev-templates
|
# 1. per IDE, such as `programs.neovim.extraPackages`
|
||||||
|
# 2. per-project, using https://github.com/the-nix-way/dev-templates
|
||||||
#
|
#
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs;
|
||||||
pkgs-unstable.devbox
|
[
|
||||||
|
(python3.withPackages (
|
||||||
# cloud native
|
ps:
|
||||||
skopeo
|
|
||||||
docker-compose
|
|
||||||
dive # explore docker layers
|
|
||||||
kubectl
|
|
||||||
kubernetes-helm
|
|
||||||
terraform
|
|
||||||
# terraformer # generate terraform configs from existing cloud resources
|
|
||||||
pulumi
|
|
||||||
pulumictl
|
|
||||||
k9s
|
|
||||||
# istioctl
|
|
||||||
|
|
||||||
# cloud provider
|
|
||||||
awscli2
|
|
||||||
aws-iam-authenticator
|
|
||||||
eksctl
|
|
||||||
|
|
||||||
# DO NOT install build tools for C/C++, set it per project by devShell instead
|
|
||||||
gnumake # used by this repo, to simplify the deployment
|
|
||||||
|
|
||||||
# python
|
|
||||||
(python311.withPackages (ps:
|
|
||||||
with ps; [
|
with ps; [
|
||||||
ipython
|
ipython
|
||||||
pandas
|
pandas
|
||||||
requests
|
requests
|
||||||
pyquery
|
pyquery
|
||||||
pyyaml
|
pyyaml
|
||||||
]))
|
]
|
||||||
|
))
|
||||||
|
|
||||||
|
cargo # rust package manager
|
||||||
|
go
|
||||||
|
jdk17
|
||||||
|
guile # scheme language
|
||||||
|
|
||||||
# db related
|
# db related
|
||||||
dbeaver
|
dbeaver
|
||||||
@@ -57,11 +42,37 @@
|
|||||||
# embedded development
|
# embedded development
|
||||||
minicom
|
minicom
|
||||||
|
|
||||||
# other tools
|
# ai related
|
||||||
|
python311Packages.huggingface-hub # huggingface-cli
|
||||||
|
|
||||||
|
# misc
|
||||||
|
pkgs-unstable.devbox
|
||||||
|
glow # markdown previewer
|
||||||
|
fzf
|
||||||
|
gdu # disk usage analyzer, required by AstroNvim
|
||||||
|
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
||||||
|
bfg-repo-cleaner # remove large files from git history
|
||||||
k6 # load testing tool
|
k6 # load testing tool
|
||||||
mitmproxy # http/https proxy tool
|
|
||||||
protobuf # protocol buffer compiler
|
protobuf # protocol buffer compiler
|
||||||
];
|
]
|
||||||
|
++ (
|
||||||
|
if pkgs.stdenv.isLinux
|
||||||
|
then [
|
||||||
|
# Automatically trims your branches whose tracking remote refs are merged or gone
|
||||||
|
# It's really useful when you work on a project for a long time.
|
||||||
|
git-trim
|
||||||
|
|
||||||
|
# need to run `conda-install` before using it
|
||||||
|
# need to run `conda-shell` before using command `conda`
|
||||||
|
# conda is not available for MacOS
|
||||||
|
conda
|
||||||
|
|
||||||
|
mitmproxy # http/https proxy tool
|
||||||
|
insomnia # REST client
|
||||||
|
wireshark # network analyzer
|
||||||
|
]
|
||||||
|
else []
|
||||||
|
);
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
direnv = {
|
direnv = {
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
{ pkgs, catppuccin-helix, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
# https://github.com/catppuccin/helix
|
# https://github.com/catppuccin/helix
|
||||||
xdg.configFile."helix/themes".source = "${catppuccin-helix}/themes/default";
|
xdg.configFile."helix/themes".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-helix}/themes/default";
|
||||||
|
|
||||||
programs.helix = {
|
programs.helix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -22,10 +24,12 @@
|
|||||||
indent-guides.render = true;
|
indent-guides.render = true;
|
||||||
};
|
};
|
||||||
keys.normal = {
|
keys.normal = {
|
||||||
space.space = "file_picker";
|
space = {
|
||||||
space.w = ":w";
|
space = "file_picker";
|
||||||
space.q = ":q";
|
w = ":w";
|
||||||
esc = [ "collapse_selection" "keep_primary_selection" ];
|
q = ":q";
|
||||||
|
};
|
||||||
|
esc = ["collapse_selection" "keep_primary_selection"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,228 @@
|
|||||||
# AstroNvim
|
# AstroNvim Configuration and Shortcuts
|
||||||
|
|
||||||
My Neovim config based on [AstroNvim](https://github.com/AstroNvim/AstroNvim).
|
My Neovim config based on [AstroNvim](https://github.com/AstroNvim/AstroNvim).
|
||||||
|
For more details, visit the [AstroNvim website](https://astronvim.com/).
|
||||||
|
|
||||||
|
This document outlines neovim's configuration structure and various shortcuts/commands for efficient usage.
|
||||||
|
|
||||||
|
## Configuration Structure
|
||||||
|
|
||||||
|
| Description | Standard Location | My Location |
|
||||||
|
| ------------------------------------------------- | ------------------------------------------- | ------------------------------------------------------------------------- |
|
||||||
|
| Neovim's config | `~/.config/nvim` | AstroNvim's github repository, referenced as a flake input in this flake. |
|
||||||
|
| AstroNvim's user configuration | `$XDG_CONFIG_HOME/astronvim/lua/user` | [./astronvim_user/](./astronvim_user/) |
|
||||||
|
| Plugins installation directory (lazy.nvim) | `~/.local/share/nvim/` | The same as standard location, generated and managed by lazy.nvim. |
|
||||||
|
| LSP servers, DAP servers, linters, and formatters | `~/.local/share/nvim/mason/`(by mason.nvim) | [./default.nix](./default.nix), installed by nix. |
|
||||||
|
|
||||||
|
## Update/Clean Plugins
|
||||||
|
|
||||||
|
Note that lazy.nvim will not automatically update plugins, so you need to update them manually.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
:Lazy update
|
||||||
|
```
|
||||||
|
|
||||||
|
Remove all unused plugins:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
:Lazy clean
|
||||||
|
```
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||

|

|
||||||
|

|
||||||
|
|
||||||
|
## Visual Modes
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ------------------------ | ---------------------------------------- |
|
||||||
|
| Toggle visual mode | `v` |
|
||||||
|
| Toggle visual block mode | `<Ctrl> + v` (select a block vertically) |
|
||||||
|
|
||||||
|
## Incremental Selection
|
||||||
|
|
||||||
|
Provided by nvim-treesitter.
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ----------------- | -------------- |
|
||||||
|
| init selection | `<Ctrl-space>` |
|
||||||
|
| node incremental | `<Ctrl-space>` |
|
||||||
|
| scope incremental | `<Alt-Space>` |
|
||||||
|
| node decremental | `Backspace` |
|
||||||
|
|
||||||
|
## Search and Jump
|
||||||
|
|
||||||
|
Provided by [flash.nvim](https://github.com/folke/flash.nvim), it's a intelligent search and jump plugin.
|
||||||
|
|
||||||
|
1. It enhaces the default search and jump behavior of neovim.(search with prefix `/`)
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ----------------- | ------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| Search | `/`(normal search), `s`(disable all code highlight, only highlight matches) |
|
||||||
|
| Treesitter Search | `yR`,`dR`, `cR`, `vR`, `ctrl+v+R`(arround your matches, all the surrounding Treesitter nodes will be labeled) |
|
||||||
|
| Remote Flash | `yr`, `dr`, `cr`, (arround your matches, all the surrounding Treesitter nodes will be labeled) |
|
||||||
|
|
||||||
|
## Text Manipulation
|
||||||
|
|
||||||
|
- Add at the end of multiple lines: `:normal A<text>`
|
||||||
|
|
||||||
|
- Execublock: `:A<text>`
|
||||||
|
|
||||||
|
- visual block mode(ctrl + v)
|
||||||
|
- Append text at the end of each line in the selected block
|
||||||
|
- If position exceeds line end, neovim adds spaces automatically
|
||||||
|
|
||||||
|
- Delete the last char of multivle lines: `:normal $x`
|
||||||
|
|
||||||
|
- Execute `$x` on each line
|
||||||
|
- visual mode(v)
|
||||||
|
- `$` moves cursor to the end of line
|
||||||
|
- `x` deletes the character under the cursor
|
||||||
|
|
||||||
|
- Delete the last word of multiple lines: `:normal $bD`
|
||||||
|
- Execute `$bD` on each line
|
||||||
|
- visual mode(v)
|
||||||
|
- `$` moves cursor to the end of line
|
||||||
|
- `b` moves cursor to the beginning of the last word
|
||||||
|
- `D` deletes from cursor to the end of line
|
||||||
|
|
||||||
|
## Commands & Shortcuts
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ----------------------------- | -------------- |
|
||||||
|
| Learn Neovim's Basics | `:Tutor` |
|
||||||
|
| Open file explorer | `<Space> + e` |
|
||||||
|
| Focus Neotree to current file | `<Space> + o` |
|
||||||
|
| Floating Terminal | `<Space> + tf` |
|
||||||
|
| Horizontal Split Terminal | `<Space> + th` |
|
||||||
|
| Vertical Split Terminal | `<Space> + tv` |
|
||||||
|
| Open IPython REPL | `<Space> + tp` |
|
||||||
|
| Toggle line wrap | `<Space> + uw` |
|
||||||
|
| Show line diagnostics | `gl` |
|
||||||
|
| Show function/variable info | `K` |
|
||||||
|
| Go to definition | `gd` |
|
||||||
|
| References of a symbol | `gr` |
|
||||||
|
|
||||||
|
## Window Navigation
|
||||||
|
|
||||||
|
- Switch between windows: `<Ctrl> + h/j/k/l`
|
||||||
|
- Resize windows: `<Ctrl> + Up/Down/Left/Right`
|
||||||
|
- Note: On macOS, conflicts with system shortcuts
|
||||||
|
- Disable in System Preferences -> Keyboard -> Shortcuts -> Mission Control
|
||||||
|
|
||||||
|
## Splitting and Buffers
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| --------------------- | ------------- |
|
||||||
|
| Horizontal Split | `\` |
|
||||||
|
| Vertical Split | `\|` |
|
||||||
|
| Next Buffer (Tab) | `]b` |
|
||||||
|
| Previous Buffer (Tab) | `[b` |
|
||||||
|
| Close Buffer | `<Space> + c` |
|
||||||
|
|
||||||
|
## Editing and Formatting
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ----------------------------------------------------- | -------------- |
|
||||||
|
| Toggle buffer auto formatting | `<Space> + uf` |
|
||||||
|
| Format Document | `<Space> + lf` |
|
||||||
|
| Code Actions | `<Space> + la` |
|
||||||
|
| Rename | `<Space> + lr` |
|
||||||
|
| Opening LSP symbols | `<Space> + lS` |
|
||||||
|
| Comment Line(support multiple lines) | `<Space> + /` |
|
||||||
|
| Open filepath/URL at cursor(neovim's builtin command) | `gx` |
|
||||||
|
| Find files by name (fzf) | `<Space> + ff` |
|
||||||
|
| Grep string in files (ripgrep) | `<Space> + fw` |
|
||||||
|
|
||||||
|
## Sessions
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ------------------------------ | -------------- |
|
||||||
|
| Save Session | `<Space> + Ss` |
|
||||||
|
| Last Session | `<Space> + Sl` |
|
||||||
|
| Delete Session | `<Space> + Sd` |
|
||||||
|
| Search Session | `<Space> + Sf` |
|
||||||
|
| Load Current Directory Session | `<Space> + S.` |
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
Press `<Space> + D` to view available bindings and options.
|
||||||
|
|
||||||
|
## Find and Replace
|
||||||
|
|
||||||
|
| Action | Command |
|
||||||
|
| ------------------------ | ----------------------------------- |
|
||||||
|
| Replace in selected area | `:s/old/new/g` |
|
||||||
|
| Replace in current line | Same as above |
|
||||||
|
| Replace in whole file | `:% s/old/new/g` |
|
||||||
|
| Replace with regex | `:% s@\vhttp://(\w+)@https://\1@gc` |
|
||||||
|
|
||||||
|
1. `\v` means means that in the regex pattern after it can be used without backslash escaping(similar to python's raw string).
|
||||||
|
2. `\1` means the first matched group in the pattern.
|
||||||
|
|
||||||
|
## Replace in the specific lines
|
||||||
|
|
||||||
|
| Action | Command |
|
||||||
|
| ----------------------------------------- | -------------------------------------- |
|
||||||
|
| From the 10th line to the end of the file | `:10,$ s/old/new/g` or `:10,$ s@^@#@g` |
|
||||||
|
| From the 10th line to the 20th line | `:10,20 s/old/new/g` |
|
||||||
|
|
||||||
|
The postfix(flags) in the above commands:
|
||||||
|
|
||||||
|
1. `g` means replace all the matched strings in the current line/file.
|
||||||
|
2. `c` means ask for confirmation before replacing.
|
||||||
|
3. `i` means ignore case.
|
||||||
|
|
||||||
|
## Search and Replace Globally
|
||||||
|
|
||||||
|
| Description | Shortcut |
|
||||||
|
| ------------------------------------------------------------ | ---------------------------------------------------------------- |
|
||||||
|
| Open spectre.nvim search and replace panel | `<Space> + ss` |
|
||||||
|
| Search and replace in command line(need install `sad` first) | `find -name "*.nix" \| sad '<pattern>' '<replacement>' \| delta` |
|
||||||
|
|
||||||
|
## Surrounding Characters
|
||||||
|
|
||||||
|
Provided by mini.surround plugin.
|
||||||
|
|
||||||
|
- Prefix `gz`
|
||||||
|
|
||||||
|
| Action | Shortcut | Description |
|
||||||
|
| ------------------------------ | -------- | ----------------------------------------------- |
|
||||||
|
| Add surrounding characters | `gzaiw'` | Add `'` around the word under cursor |
|
||||||
|
| Delete surrounding characters | `gzd'` | Delete `'` around the word under cursor |
|
||||||
|
| Replace surrounding characters | `gzr'"` | Replace `'` by `"` around the word under cursor |
|
||||||
|
| Highlight surrounding | `gzh'` | Highlight `'` around the word under cursor |
|
||||||
|
|
||||||
|
## Text Manipulation
|
||||||
|
|
||||||
|
| Action | |
|
||||||
|
| -------------------------------------- | ------------- |
|
||||||
|
| Join Selection of Lines With Space | `:join` |
|
||||||
|
| Join without spaces | `:join!` |
|
||||||
|
| Join with LSP intelligence(treesj) | `<Space> + j` |
|
||||||
|
| Split Line into Multiple Lines(treesj) | `<Space> + s` |
|
||||||
|
|
||||||
|
## Convert Text Case
|
||||||
|
|
||||||
|
| Action | |
|
||||||
|
| -------------------- | --- |
|
||||||
|
| Toggle text's case | `~` |
|
||||||
|
| Convert to uppercase | `U` |
|
||||||
|
| Convert to lowercase | `u` |
|
||||||
|
|
||||||
|
## Miscellaneous
|
||||||
|
|
||||||
|
| Action | |
|
||||||
|
| ---------------------------- | -------------------------------------------- |
|
||||||
|
| Save selected text to a file | `:w filename` (Will show `:'<,'>w filename`) |
|
||||||
|
| Show all Yank History | `:<Space> + yh` |
|
||||||
|
| Show undo history | `:<Space> + uh` |
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
For more detailed information and advanced usage, refer to:
|
||||||
|
|
||||||
|
1. [AstroNvim walkthrough](https://astronvim.com/Basic%20Usage/walkthrough)
|
||||||
|
2. [./astronvim_user/mapping.lua](./astronvim_user/mappings.lua)
|
||||||
|
3. All the plugins' documentations
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ return {
|
|||||||
signcolumn = "auto", -- Show sign column when used only
|
signcolumn = "auto", -- Show sign column when used only
|
||||||
spell = false, -- Spell checking
|
spell = false, -- Spell checking
|
||||||
swapfile = false, -- Swapfile
|
swapfile = false, -- Swapfile
|
||||||
smartindent = false; -- fix https://github.com/ryan4yin/nix-config/issues/4
|
smartindent = false, -- fix https://github.com/ryan4yin/nix-config/issues/4
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -17,14 +17,13 @@ return {
|
|||||||
{ import = "astrocommunity.colorscheme.catppuccin" },
|
{ import = "astrocommunity.colorscheme.catppuccin" },
|
||||||
-- Highly experimental plugin that completely replaces
|
-- Highly experimental plugin that completely replaces
|
||||||
-- the UI for messages, cmdline and the popupmenu.
|
-- the UI for messages, cmdline and the popupmenu.
|
||||||
{ import = "astrocommunity.utility.noice-nvim" },
|
-- { import = "astrocommunity.utility.noice-nvim" },
|
||||||
-- Fully featured & enhanced replacement for copilot.vim
|
-- Fully featured & enhanced replacement for copilot.vim
|
||||||
-- <Tab> work with both auto completion in cmp and copilot
|
-- <Tab> work with both auto completion in cmp and copilot
|
||||||
{ import = "astrocommunity.media.vim-wakatime" },
|
{ import = "astrocommunity.media.vim-wakatime" },
|
||||||
{ import = "astrocommunity.motion.leap-nvim" },
|
{ import = "astrocommunity.motion.leap-nvim" },
|
||||||
{ import = "astrocommunity.motion.flit-nvim" },
|
{ import = "astrocommunity.motion.flit-nvim" },
|
||||||
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
|
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
|
||||||
{ import = "astrocommunity.editing-support.auto-save-nvim" },
|
|
||||||
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
|
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
|
||||||
-- Language Support
|
-- Language Support
|
||||||
---- Frontend & NodeJS
|
---- Frontend & NodeJS
|
||||||
@@ -35,7 +34,6 @@ return {
|
|||||||
{ import = "astrocommunity.pack.vue" },
|
{ import = "astrocommunity.pack.vue" },
|
||||||
---- Configuration Language
|
---- Configuration Language
|
||||||
{ import = "astrocommunity.pack.markdown" },
|
{ import = "astrocommunity.pack.markdown" },
|
||||||
{ import = "astrocommunity.markdown-and-latex.glow-nvim" },
|
|
||||||
{ import = "astrocommunity.pack.json" },
|
{ import = "astrocommunity.pack.json" },
|
||||||
{ import = "astrocommunity.pack.yaml" },
|
{ import = "astrocommunity.pack.yaml" },
|
||||||
{ import = "astrocommunity.pack.toml" },
|
{ import = "astrocommunity.pack.toml" },
|
||||||
@@ -53,6 +51,14 @@ return {
|
|||||||
{ import = "astrocommunity.pack.cmake" },
|
{ import = "astrocommunity.pack.cmake" },
|
||||||
{ import = "astrocommunity.pack.cpp" },
|
{ import = "astrocommunity.pack.cpp" },
|
||||||
{ import = "astrocommunity.pack.docker" },
|
{ import = "astrocommunity.pack.docker" },
|
||||||
|
-- Motion
|
||||||
|
{ import = "astrocommunity.motion.mini-surround" },
|
||||||
|
-- https://github.com/echasnovski/mini.ai
|
||||||
|
{ import = "astrocommunity.motion.mini-ai" },
|
||||||
|
{ import = "astrocommunity.motion.flash-nvim" },
|
||||||
|
{ "folke/flash.nvim", vscode = false },
|
||||||
|
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
|
||||||
|
{ import = "astrocommunity.motion.nvim-spider" },
|
||||||
-- AI Assistant
|
-- AI Assistant
|
||||||
{ import = "astrocommunity.completion.copilot-lua-cmp" },
|
{ import = "astrocommunity.completion.copilot-lua-cmp" },
|
||||||
-- Custom copilot-lua to enable filtypes: markdown
|
-- Custom copilot-lua to enable filtypes: markdown
|
||||||
@@ -60,30 +66,120 @@ return {
|
|||||||
"zbirenbaum/copilot.lua",
|
"zbirenbaum/copilot.lua",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts.filetypes = {
|
opts.filetypes = {
|
||||||
yaml = true;
|
yaml = true,
|
||||||
markdown = true,
|
markdown = true,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
---- Nushell
|
|
||||||
{
|
{
|
||||||
"LhKipp/nvim-nu",
|
"0x00-ketsu/autosave.nvim",
|
||||||
|
-- lazy-loading on events
|
||||||
|
event = { "InsertLeave", "TextChanged" },
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.prompt_style = "stdout" -- notify or stdout
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- markdown preview
|
||||||
|
{
|
||||||
|
"0x00-ketsu/markdown-preview.nvim",
|
||||||
|
ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" },
|
||||||
config = function()
|
config = function()
|
||||||
require'nu'.setup({
|
require("markdown-preview").setup({
|
||||||
use_lsp_features = true, -- requires https://github.com/jose-elias-alvarez/null-ls.nvim
|
-- your configuration comes here
|
||||||
-- lsp_feature: all_cmd_names is the source for the cmd name completion.
|
-- or leave it empty to use the default settings
|
||||||
-- It can be
|
-- refer to the setup section below
|
||||||
-- * a string, which is interpreted as a shell command and the returned list is the source for completions (requires plenary.nvim)
|
|
||||||
-- * a list, which is the direct source for completions (e.G. all_cmd_names = {"echo", "to csv", ...})
|
|
||||||
-- * a function, returning a list of strings and the return value is used as the source for completions
|
|
||||||
all_cmd_names = [[nu -c 'help commands | get name | str join "\n"']]
|
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
dependencies = {
|
},
|
||||||
{"nvim-treesitter/nvim-treesitter"},
|
|
||||||
{ "jose-elias-alvarez/null-ls.nvim"},
|
-- clipboard manager
|
||||||
|
{
|
||||||
|
"gbprod/yanky.nvim",
|
||||||
|
opts = function()
|
||||||
|
local mapping = require("yanky.telescope.mapping")
|
||||||
|
local mappings = mapping.get_defaults()
|
||||||
|
mappings.i["<c-p>"] = nil
|
||||||
|
return {
|
||||||
|
highlight = { timer = 200 },
|
||||||
|
picker = {
|
||||||
|
telescope = {
|
||||||
|
use_default_mappings = false,
|
||||||
|
mappings = mappings,
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
end,
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"y",
|
||||||
|
"<Plug>(YankyYank)",
|
||||||
|
mode = { "n", "x" },
|
||||||
|
desc = "Yank text",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"p",
|
||||||
|
"<Plug>(YankyPutAfter)",
|
||||||
|
mode = { "n", "x" },
|
||||||
|
desc = "Put yanked text after cursor",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"P",
|
||||||
|
"<Plug>(YankyPutBefore)",
|
||||||
|
mode = { "n", "x" },
|
||||||
|
desc = "Put yanked text before cursor",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gp",
|
||||||
|
"<Plug>(YankyGPutAfter)",
|
||||||
|
mode = { "n", "x" },
|
||||||
|
desc = "Put yanked text after selection",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gP",
|
||||||
|
"<Plug>(YankyGPutBefore)",
|
||||||
|
mode = { "n", "x" },
|
||||||
|
desc = "Put yanked text before selection",
|
||||||
|
},
|
||||||
|
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle forward through yank history" },
|
||||||
|
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle backward through yank history" },
|
||||||
|
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||||
|
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||||
|
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||||
|
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||||
|
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" },
|
||||||
|
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" },
|
||||||
|
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
|
||||||
|
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
|
||||||
|
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
|
||||||
|
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Enhanced matchparen.vim plugin for Neovim to highlight the outer pair.
|
||||||
|
{
|
||||||
|
"utilyre/sentiment.nvim",
|
||||||
|
version = "*",
|
||||||
|
event = "VeryLazy", -- keep for lazy loading
|
||||||
|
opts = {
|
||||||
|
-- config
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
-- `matchparen.vim` needs to be disabled manually in case of lazy loading
|
||||||
|
vim.g.loaded_matchparen = 1
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- joining blocks of code into oneline, or splitting one line into multiple lines.
|
||||||
|
{
|
||||||
|
"Wansmer/treesj",
|
||||||
|
keys = { "<space>m", "<space>j", "<space>s" },
|
||||||
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||||
|
config = function()
|
||||||
|
require("treesj").setup({ --[[ your config ]]
|
||||||
|
})
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- File explorer(Custom configs)
|
-- File explorer(Custom configs)
|
||||||
@@ -97,31 +193,43 @@ return {
|
|||||||
hide_gitignored = false,
|
hide_gitignored = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
-- The plugin offers the `:Refactor` command to refactor code.
|
},
|
||||||
-- TODO not work yet
|
-- The plugin offers the alibity to refactor code.
|
||||||
{
|
{
|
||||||
"ThePrimeagen/refactoring.nvim",
|
"ThePrimeagen/refactoring.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{"nvim-lua/plenary.nvim"},
|
{ "nvim-lua/plenary.nvim" },
|
||||||
{"nvim-treesitter/nvim-treesitter"}
|
{ "nvim-treesitter/nvim-treesitter" },
|
||||||
}
|
|
||||||
},
|
},
|
||||||
-- The plugin offers the `:Spectre` command to search and replace.
|
},
|
||||||
-- TODO not work yet
|
-- The plugin offers the abilibty to search and replace.
|
||||||
{
|
{
|
||||||
"nvim-pack/nvim-spectre",
|
"nvim-pack/nvim-spectre",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{"nvim-lua/plenary.nvim"},
|
{ "nvim-lua/plenary.nvim" },
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- full signature help, docs and completion for the nvim lua API.
|
||||||
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
|
|
||||||
|
{ "RRethy/vim-illuminate", config = function() end },
|
||||||
|
|
||||||
-- Language Parser for syntax highlighting / indentation / folding / Incremental selection
|
-- Language Parser for syntax highlighting / indentation / folding / Incremental selection
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local utils = require "astronvim.utils";
|
local utils = require("astronvim.utils")
|
||||||
opts.indent.enable = false;
|
opts.incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<C-space>", -- Ctrl + Space
|
||||||
|
node_incremental = "<C-space>",
|
||||||
|
scope_incremental = "<A-space>", -- Alt + Space
|
||||||
|
node_decremental = "<bs>", -- Backspace
|
||||||
|
},
|
||||||
|
}
|
||||||
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, {
|
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, {
|
||||||
-- neovim
|
-- neovim
|
||||||
"vim",
|
"vim",
|
||||||
@@ -137,6 +245,17 @@ return {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- implementation/definition preview
|
||||||
|
{
|
||||||
|
"rmagatti/goto-preview",
|
||||||
|
config = function()
|
||||||
|
require("goto-preview").setup({})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Undo tree
|
||||||
|
{ "debugloop/telescope-undo.nvim" },
|
||||||
|
|
||||||
-- Install lsp, formmatter and others via home manager instead of Mason.nvim
|
-- Install lsp, formmatter and others via home manager instead of Mason.nvim
|
||||||
-- LSP installations
|
-- LSP installations
|
||||||
{
|
{
|
||||||
@@ -160,7 +279,7 @@ return {
|
|||||||
{
|
{
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local null_ls = require "null-ls"
|
local null_ls = require("null-ls")
|
||||||
local code_actions = null_ls.builtins.code_actions
|
local code_actions = null_ls.builtins.code_actions
|
||||||
local diagnostics = null_ls.builtins.diagnostics
|
local diagnostics = null_ls.builtins.diagnostics
|
||||||
local formatting = null_ls.builtins.formatting
|
local formatting = null_ls.builtins.formatting
|
||||||
@@ -179,9 +298,6 @@ return {
|
|||||||
code_actions.proselint, -- English prose linter
|
code_actions.proselint, -- English prose linter
|
||||||
code_actions.statix, -- Lints and suggestions for Nix.
|
code_actions.statix, -- Lints and suggestions for Nix.
|
||||||
|
|
||||||
-- Completion
|
|
||||||
completion.luasnip,
|
|
||||||
|
|
||||||
-- Diagnostic
|
-- Diagnostic
|
||||||
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
|
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
|
||||||
diagnostics.buf, -- check text in current buffer
|
diagnostics.buf, -- check text in current buffer
|
||||||
@@ -204,6 +320,7 @@ return {
|
|||||||
extra_args = { "--dialect", "postgres" }, -- change to your dialect
|
extra_args = { "--dialect", "postgres" }, -- change to your dialect
|
||||||
}),
|
}),
|
||||||
formatting.nginx_beautifier, -- Nginx formatter
|
formatting.nginx_beautifier, -- Nginx formatter
|
||||||
|
null_ls.builtins.formatting.verible_verilog_format, -- Verilog formatter
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -217,6 +334,57 @@ return {
|
|||||||
opts.automatic_installation = false
|
opts.automatic_installation = false
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
branch = "0.1.x",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
init = function()
|
||||||
|
-- 1. Disable highlighting for certain filetypes
|
||||||
|
-- 2. Ignore files larger than a certain filesize
|
||||||
|
local previewers = require("telescope.previewers")
|
||||||
|
|
||||||
|
local _bad = { ".*%.csv", ".*%.min.js" } -- Put all filetypes that slow you down in this array
|
||||||
|
local filesize_threshold = 300 * 1024 -- 300KB
|
||||||
|
local bad_files = function(filepath)
|
||||||
|
for _, v in ipairs(_bad) do
|
||||||
|
if filepath:match(v) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local new_maker = function(filepath, bufnr, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
if opts.use_ft_detect == nil then
|
||||||
|
opts.use_ft_detect = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 1. Check if the file is in the bad_files array, and if so, don't highlight it
|
||||||
|
opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath)
|
||||||
|
|
||||||
|
-- 2. Check the file size, and ignore it if it's too big(preview nothing).
|
||||||
|
filepath = vim.fn.expand(filepath)
|
||||||
|
vim.loop.fs_stat(filepath, function(_, stat)
|
||||||
|
if not stat then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if stat.size > filesize_threshold then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
require("telescope").setup({
|
||||||
|
defaults = {
|
||||||
|
buffer_previewer_maker = new_maker,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Configure require("lazy").setup() options
|
-- Configure require("lazy").setup() options
|
||||||
@@ -225,11 +393,12 @@ return {
|
|||||||
performance = {
|
performance = {
|
||||||
rtp = {
|
rtp = {
|
||||||
-- customize default disabled vim plugins
|
-- customize default disabled vim plugins
|
||||||
disabled_plugins = { };
|
disabled_plugins = {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
lsp = {
|
lsp = {
|
||||||
config = {
|
config = {
|
||||||
-- the offset_enconding of clangd will confilicts whit null-ls
|
-- the offset_enconding of clangd will confilicts whit null-ls
|
||||||
@@ -264,6 +433,8 @@ return {
|
|||||||
"nil_ls", -- nix language server
|
"nil_ls", -- nix language server
|
||||||
"bufls", -- protocol buffer language server
|
"bufls", -- protocol buffer language server
|
||||||
"zls", -- zig language server
|
"zls", -- zig language server
|
||||||
|
---- HDL
|
||||||
|
"verible", -- verilog language server
|
||||||
---- Operation & Cloud Nativautoindente
|
---- Operation & Cloud Nativautoindente
|
||||||
"bashls", -- bash
|
"bashls", -- bash
|
||||||
"cmake", -- cmake language server
|
"cmake", -- cmake language server
|
||||||
|
|||||||
@@ -4,18 +4,65 @@
|
|||||||
-- lower level configuration and more robust one. (which-key will
|
-- lower level configuration and more robust one. (which-key will
|
||||||
-- automatically pick-up stored data by this setting.)
|
-- automatically pick-up stored data by this setting.)
|
||||||
local utils = require "astronvim.utils"
|
local utils = require "astronvim.utils"
|
||||||
|
|
||||||
|
require("telescope").load_extension("refactoring")
|
||||||
|
require("telescope").load_extension("yank_history")
|
||||||
|
require("telescope").load_extension("undo")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- first key is the mode
|
-- normal mode
|
||||||
n = {
|
n = {
|
||||||
-- second key is the lefthand side of the map
|
-- second key is the lefthand side of the map
|
||||||
-- mappings seen under group name "Buffer"
|
-- mappings seen under group name "Buffer"
|
||||||
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
||||||
-- quick save
|
-- quick save
|
||||||
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
||||||
["<leader>tp"] = { function() utils.toggle_term_cmd("ipython") end, desc = "ToggleTerm python" },
|
|
||||||
|
-- Terminal
|
||||||
|
-- NOTE: https://neovim.io/doc/user/builtin.html#jobstart()
|
||||||
|
-- 1. If {cmd} is a List it runs directly (no 'shell')
|
||||||
|
-- 2. If {cmd} is a String it runs in the 'shell'
|
||||||
|
["<leader>tp"] = { function() utils.toggle_term_cmd({ cmd = "ipython" }) end, desc = "ToggleTerm python" },
|
||||||
|
|
||||||
|
-- search and replace globally
|
||||||
|
['<leader>ss'] = {'<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" },
|
||||||
|
['<leader>sw'] = {'<cmd>lua require("spectre").open_visual({select_word=true})<CR>', desc = "Search current word" },
|
||||||
|
['<leader>sp'] ={'<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', desc = "Search on current file" },
|
||||||
|
|
||||||
|
-- refactoring
|
||||||
|
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" },
|
||||||
|
["<leader>rb"] = { function() require('refactoring').refactor('Extract Block') end, desc = "Extract Block" },
|
||||||
|
["<leader>rbf"] = { function() require('refactoring').refactor('Extract Block To File') end, desc = "Extract Block To File" },
|
||||||
|
["<leader>rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" },
|
||||||
|
["<leader>rp"] = { function() require('refactoring').debug.printf({below = false}) end, desc = "Insert print statement to mark the calling of a function" },
|
||||||
|
["<leader>rv"] = { function() require('refactoring').debug.print_var() end, desc = "Insert print statement to print a variable" },
|
||||||
|
["<leader>rc"] = { function() require('refactoring').debug.cleanup({}) end, desc = "Cleanup of all generated print statements" },
|
||||||
|
|
||||||
|
-- yank_history
|
||||||
|
["<leader>yh"] = { function() require("telescope").extensions.yank_history.yank_history() end, desc = "Preview Yank History" },
|
||||||
|
|
||||||
|
-- undo history
|
||||||
|
["<leader>uh"] = {"<cmd>Telescope undo<cr>", desc="Telescope undo" },
|
||||||
|
|
||||||
|
-- implementation/definition preview
|
||||||
|
["gpd"] = { "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", desc="goto_preview_definition" },
|
||||||
|
["gpt"] = { "<cmd>lua require('goto-preview').goto_preview_type_definition()<CR>", desc="goto_preview_type_definition" },
|
||||||
|
["gpi"] = { "<cmd>lua require('goto-preview').goto_preview_implementation()<CR>", desc="goto_preview_implementation" },
|
||||||
|
["gP" ] = { "<cmd>lua require('goto-preview').close_all_win()<CR>", desc="close_all_win" },
|
||||||
|
["gpr"] = { "<cmd>lua require('goto-preview').goto_preview_references()<CR>", desc="goto_preview_references" },
|
||||||
},
|
},
|
||||||
t = {
|
-- Visual mode
|
||||||
-- setting a mapping to false will disable it
|
v = {
|
||||||
-- ["<esc>"] = false,
|
-- search and replace globally
|
||||||
|
['<leader>sw'] = {'<esc><cmd>lua require("spectre").open_visual()<CR>', desc = "Search current word" },
|
||||||
|
},
|
||||||
|
-- visual mode(what's the difference between v and x???)
|
||||||
|
x = {
|
||||||
|
-- refactoring
|
||||||
|
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" },
|
||||||
|
["<leader>re"] = { function() require('refactoring').refactor('Extract Function') end, desc = "Extracts the selected code to a separate function" },
|
||||||
|
["<leader>rf"] = { function() require('refactoring').refactor('Extract Function To File') end, desc = "Extract Function To File" },
|
||||||
|
["<leader>rv"] = { function() require('refactoring').refactor('Extract Variable') end, desc = "Extracts occurrences of a selected expression to its own variable" },
|
||||||
|
["<leader>rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,120 +5,20 @@
|
|||||||
}:
|
}:
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# AstroNvim's configuration and all its dependencies
|
# AstroNvim's configuration and all its dependencies(lsp, formatter, etc.)
|
||||||
#
|
|
||||||
# Related folders:
|
|
||||||
# nvim's config: `~/.config/nvim`
|
|
||||||
# astronvim's user configuration: `$XDG_CONFIG_HOME/astronvim/lua/user`
|
|
||||||
# all plugins will be installed into(by lazy.nvim): `~/.local/share/nvim/`
|
|
||||||
#
|
|
||||||
# For details: https://astronvim.com/
|
|
||||||
#
|
|
||||||
# Toggle visual mode: `v`
|
|
||||||
# Toggle visual block mode: `<Ctrl> + v` (select a block(vertically) of text)
|
|
||||||
#
|
|
||||||
# Add at the end of Multiple line: `:normal A<text>`
|
|
||||||
# Note that `:normal` execute `A<text>` on each line.
|
|
||||||
# `A` means append text at the end of the line.
|
|
||||||
# You need to select the lines via visual mode first.
|
|
||||||
#
|
|
||||||
# Add at the end of the visual block: `:A<text>`
|
|
||||||
# You need to select the block via visual block mode first.
|
|
||||||
# And then this command will append text at the end of the block on each line.
|
|
||||||
# If the position exceeds the end of the line, neovim will automatically add spaces
|
|
||||||
#
|
|
||||||
# Commands & shortcuts in AstroNvim
|
|
||||||
# Learn Neovim's Basics: `:Tutor`
|
|
||||||
# Opening file explorer: `<Space> + e`
|
|
||||||
# Focus Neotree to current file: `<Space> + o`
|
|
||||||
# Floating Terminal: `<Space> + tf`
|
|
||||||
# Horizontal Split Terminal: `<Space> + th`
|
|
||||||
# Vertical Split Terminal: `<Space> + tv`
|
|
||||||
# Open IPython REPL: `<Space> + tp`
|
|
||||||
# Opening LSP symbols: `<Space> + lS`
|
|
||||||
# Toggle line wrap: `<Space> + uw`
|
|
||||||
# Show line diagnostics: `gl`
|
|
||||||
# Go to definition: `gd`
|
|
||||||
#
|
|
||||||
# Switching between windows: `<Ctrl> + h/j/k/l`
|
|
||||||
# Resizing windows: `<Ctrl> + Up/Down/Left/Right`
|
|
||||||
# Note that on macOS, this is conflict with system's default shortcuts.
|
|
||||||
# You need disable them in System Preferences -> Keyboard -> Shortcuts -> Mission Control.
|
|
||||||
# Horizontal Split: `\`
|
|
||||||
# Vertical Split: `|`
|
|
||||||
# Next Buffer(Tab): `]b`
|
|
||||||
# Previous Buffer(Tab): `[b`
|
|
||||||
# Close Buffer: `<Space> + c`
|
|
||||||
#
|
|
||||||
# Toggle buffer auto formatting: `<Space> + uf`
|
|
||||||
# Format Document: `<Space> + lf`
|
|
||||||
# Comment Line: `<Space> + /`
|
|
||||||
# Can be used in visual mode
|
|
||||||
# Code Actions: `<Space> + la`
|
|
||||||
# Rename: `<Space> + lr`
|
|
||||||
# Open filepath/URL at cursor: `gx`
|
|
||||||
# This is a neovim builtin command
|
|
||||||
# Find files by name(fzf): `<Space> + ff`
|
|
||||||
# Grep string in files(repgrep): `<Space> + fw`
|
|
||||||
#
|
|
||||||
# Save Session: `<Space> + Ss`
|
|
||||||
# Last Session: `<Space> + Sl`
|
|
||||||
# Delete Session: `<Space> + Sd`
|
|
||||||
# Search Session: `<Space> + Sf`
|
|
||||||
# Load Current Directory Session:`<Space> + S.`
|
|
||||||
#
|
|
||||||
# Debugging: press `<Space> + D` to see the available bindings and options.
|
|
||||||
#
|
|
||||||
# Replace in the selected area: `:s/old/new/g` (will show `:'<,'>s/old/new/g`)
|
|
||||||
# Replace in the current line: The same as above
|
|
||||||
# Replace in the whole file: `:% s/old/new/g`
|
|
||||||
# Replace with regex: `:% s@\vhttp://(\w+)@https://\1@gc`
|
|
||||||
# 1. `\v` means means that in the regex pattern after it can be used without backslash escaping(similar to python's raw string).
|
|
||||||
# 2. `\1` means the first matched group in the pattern.
|
|
||||||
# Replace in the specific lines:
|
|
||||||
# 1. From the 10th line to the end of the file: `:10,$ s/old/new/g`
|
|
||||||
# or `:10,$ s@^@#@g`
|
|
||||||
# 2. From the 10th line to the 20th line: `:10,20 s/old/new/g`
|
|
||||||
#
|
|
||||||
# The postfix(flgas) in the above commands:
|
|
||||||
# 1. `g` means replace all the matched strings in the current line/file.
|
|
||||||
# 2. `c` means ask for confirmation before replacing.
|
|
||||||
# 3. `i` means ignore case.
|
|
||||||
#
|
|
||||||
# Joining a Selection of Lines With Space: `:join`
|
|
||||||
# Joining without spaces: `:join!`
|
|
||||||
#
|
|
||||||
# Toggle text's case: `~`
|
|
||||||
# Convert to uppercase: `U`
|
|
||||||
# Convert to lowercase: `u`
|
|
||||||
#
|
|
||||||
# Save the selected text to a file: `:w filename` (will show `:'<,'>w filename`)
|
|
||||||
#
|
|
||||||
# Search key pattern and Replace in Multiple Files:
|
|
||||||
# sed -ri "s/pattern_str/replace_str/g" $(grep "key_pattern" 'path_pattern' -rl)
|
|
||||||
#
|
|
||||||
# Search file name pattern and Replace in Multiple Files:
|
|
||||||
# sed -ri "s/pattern_str/replace_str/g" $(find . -name "pattern")
|
|
||||||
#
|
|
||||||
# ......
|
|
||||||
# See https://astronvim.com/Basic%20Usage/walkthrough
|
|
||||||
#
|
#
|
||||||
#e#############################################################################
|
#e#############################################################################
|
||||||
{
|
{
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
# base config
|
# astronvim's config
|
||||||
"nvim" = {
|
"nvim" = {
|
||||||
# update AstroNvim
|
|
||||||
onChange = "${pkgs.neovim}/bin/nvim --headless +quitall";
|
|
||||||
source = astronvim;
|
source = astronvim;
|
||||||
|
force = true;
|
||||||
};
|
};
|
||||||
# my cusotom astronvim config, astronvim will load it after base config
|
|
||||||
|
# my custom astronvim config, astronvim will load it after base config
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
|
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
|
||||||
"astronvim/lua/user" = {
|
"astronvim/lua/user".source = ./astronvim_user;
|
||||||
# update AstroNvim
|
|
||||||
onChange = "${pkgs.neovim}/bin/nvim --headless +quitall";
|
|
||||||
source = ./astronvim_user;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.config = {
|
nixpkgs.config = {
|
||||||
@@ -130,24 +30,20 @@
|
|||||||
programs = {
|
programs = {
|
||||||
neovim = {
|
neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
defaultEditor = true;
|
defaultEditor = true;
|
||||||
|
viAlias = true;
|
||||||
viAlias = false;
|
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
|
|
||||||
withPython3 = true;
|
|
||||||
withNodeJs = true;
|
|
||||||
extraPackages = [];
|
|
||||||
|
|
||||||
# currently we use lazy.nvim as neovim's package manager, so comment this one.
|
# currently we use lazy.nvim as neovim's package manager, so comment this one.
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
# search all the plugins using https://search.nixos.org/packages
|
# search all the plugins using https://search.nixos.org/packages
|
||||||
luasnip
|
telescope-fzf-native-nvim
|
||||||
];
|
];
|
||||||
};
|
|
||||||
};
|
# Extra packages only available to nvim(won't pollute the global home environment)
|
||||||
home = {
|
extraPackages = with pkgs;
|
||||||
packages = with pkgs; [
|
[
|
||||||
#-- c/c++
|
#-- c/c++
|
||||||
cmake
|
cmake
|
||||||
cmake-language-server
|
cmake-language-server
|
||||||
@@ -155,13 +51,24 @@
|
|||||||
checkmake
|
checkmake
|
||||||
gcc # c/c++ compiler, required by nvim-treesitter!
|
gcc # c/c++ compiler, required by nvim-treesitter!
|
||||||
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
|
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
|
||||||
gdb
|
|
||||||
lldb
|
lldb
|
||||||
|
|
||||||
#-- python
|
#-- python
|
||||||
nodePackages.pyright # python language server
|
nodePackages.pyright # python language server
|
||||||
python311Packages.black # python formatter
|
python3Packages.black # python formatter
|
||||||
python311Packages.ruff-lsp
|
python3Packages.ruff-lsp
|
||||||
|
(python3.withPackages (
|
||||||
|
ps:
|
||||||
|
with ps; [
|
||||||
|
pynvim # Python client and plugin host for Nvim
|
||||||
|
|
||||||
|
ipython
|
||||||
|
pandas
|
||||||
|
requests
|
||||||
|
pyquery
|
||||||
|
pyyaml
|
||||||
|
]
|
||||||
|
))
|
||||||
|
|
||||||
#-- rust
|
#-- rust
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
@@ -188,6 +95,12 @@
|
|||||||
gopls # go language server
|
gopls # go language server
|
||||||
delve # go debugger
|
delve # go debugger
|
||||||
|
|
||||||
|
# -- java
|
||||||
|
jdk17
|
||||||
|
gradle
|
||||||
|
maven
|
||||||
|
spring-boot-cli
|
||||||
|
|
||||||
#-- lua
|
#-- lua
|
||||||
stylua
|
stylua
|
||||||
lua-language-server
|
lua-language-server
|
||||||
@@ -198,6 +111,7 @@
|
|||||||
shfmt
|
shfmt
|
||||||
|
|
||||||
#-- javascript/typescript --#
|
#-- javascript/typescript --#
|
||||||
|
nodePackages.nodejs
|
||||||
nodePackages.typescript
|
nodePackages.typescript
|
||||||
nodePackages.typescript-language-server
|
nodePackages.typescript-language-server
|
||||||
# HTML/CSS/JSON/ESLint language servers extracted from vscode
|
# HTML/CSS/JSON/ESLint language servers extracted from vscode
|
||||||
@@ -206,7 +120,7 @@
|
|||||||
|
|
||||||
#-- CloudNative
|
#-- CloudNative
|
||||||
nodePackages.dockerfile-language-server-nodejs
|
nodePackages.dockerfile-language-server-nodejs
|
||||||
terraform
|
# terraform # install via brew on macOS
|
||||||
terraform-ls
|
terraform-ls
|
||||||
jsonnet
|
jsonnet
|
||||||
jsonnet-language-server
|
jsonnet-language-server
|
||||||
@@ -219,16 +133,28 @@
|
|||||||
actionlint # GitHub Actions linter
|
actionlint # GitHub Actions linter
|
||||||
buf # protoc plugin for linting and formatting
|
buf # protoc plugin for linting and formatting
|
||||||
proselint # English prose linter
|
proselint # English prose linter
|
||||||
|
guile # scheme language
|
||||||
|
|
||||||
#-- Misc
|
#-- Misc
|
||||||
tree-sitter # common language parser/highlighter
|
tree-sitter # common language parser/highlighter
|
||||||
nodePackages.prettier # common code formatter
|
nodePackages.prettier # common code formatter
|
||||||
marksman # language server for markdown
|
marksman # language server for markdown
|
||||||
glow # markdown previewer
|
glow # markdown previewer
|
||||||
|
fzf
|
||||||
|
|
||||||
#-- Optional Requirements:
|
#-- Optional Requirements:
|
||||||
gdu # disk usage analyzer, required by AstroNvim
|
gdu # disk usage analyzer, required by AstroNvim
|
||||||
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
||||||
];
|
]
|
||||||
|
++ (
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then []
|
||||||
|
else [
|
||||||
|
#-- verilog / systemverilog
|
||||||
|
verible
|
||||||
|
gdb
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ nushell-scripts, ...}: {
|
{nushell-scripts, ...}: {
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
# load the alias file for work
|
# load the alias file for work
|
||||||
bashrcExtra = ''
|
bashrcExtra = ''
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{pkgs, ...}: {
|
_: {
|
||||||
programs.ssh = {
|
programs.ssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
@@ -23,13 +23,6 @@
|
|||||||
# required to prevent sending default identity files first.
|
# required to prevent sending default identity files first.
|
||||||
IdentitiesOnly yes
|
IdentitiesOnly yes
|
||||||
|
|
||||||
Host github.com
|
|
||||||
# github is controlled by gluttony~
|
|
||||||
IdentityFile ~/.ssh/gluttony
|
|
||||||
# Specifies that ssh should only use the identity file explicitly configured above
|
|
||||||
# required to prevent sending default identity files first.
|
|
||||||
IdentitiesOnly yes
|
|
||||||
|
|
||||||
Host gtr5
|
Host gtr5
|
||||||
HostName 192.168.5.172
|
HostName 192.168.5.172
|
||||||
Port 22
|
Port 22
|
||||||
@@ -41,11 +34,24 @@
|
|||||||
Host s500plus
|
Host s500plus
|
||||||
HostName 192.168.5.174
|
HostName 192.168.5.174
|
||||||
Port 22
|
Port 22
|
||||||
'';
|
|
||||||
|
|
||||||
# use ssh-agent so we only need to input passphrase once
|
Host k8s-main
|
||||||
# run `ssh-add /path/to/key` for every identity file
|
HostName 192.168.5.181
|
||||||
# check imported keys by `ssh-add -l`
|
ForwardAgent yes
|
||||||
# TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login.
|
IdentityFile ~/.ssh/romantic
|
||||||
|
IdentitiesOnly yes
|
||||||
|
|
||||||
|
Host k8s-data1
|
||||||
|
HostName 192.168.5.182
|
||||||
|
ForwardAgent yes
|
||||||
|
IdentityFile ~/.ssh/romantic
|
||||||
|
IdentitiesOnly yes
|
||||||
|
|
||||||
|
Host k8s-data2
|
||||||
|
HostName 192.168.5.183
|
||||||
|
ForwardAgent yes
|
||||||
|
IdentityFile ~/.ssh/romantic
|
||||||
|
IdentitiesOnly yes
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# Termianl Emulators
|
||||||
|
|
||||||
|
1. kitty: My main terminal emulator.
|
||||||
|
2. wezterm: My secondary terminal emulator.
|
||||||
|
3. alacritty: Standby terminal.
|
||||||
|
|
||||||
|
|
||||||
|
## 'xterm-kitty': unknown terminal type when `ssh` into a remote host or `sudo xxx`
|
||||||
|
|
||||||
|
> https://sw.kovidgoyal.net/kitty/faq/#i-get-errors-about-the-terminal-being-unknown-or-opening-the-terminal-failing-or-functional-keys-like-arrow-keys-don-t-work
|
||||||
|
|
||||||
|
> https://wezfurlong.org/wezterm/config/lua/config/term.html
|
||||||
|
|
||||||
|
kitty set `TERM` to `xterm-kitty` by default, and TUI apps like `viu`, `yazi`, `curses` will try to search in the host's [terminfo(terminal capability data base)](https://linux.die.net/man/5/terminfo) for value of `TERM` to determine the capabilities of the terminal.
|
||||||
|
|
||||||
|
But when you `ssh` into a remote host, the remote host is very likely to not have `xterm-kitty` in its terminfo, so you will get this error:
|
||||||
|
|
||||||
|
```
|
||||||
|
'xterm-kitty': unknown terminal type
|
||||||
|
```
|
||||||
|
|
||||||
|
Or when you `sudo xxx`, `sudo` won't preserve the `TERM` variable, it will be reset to root's default `TERM` value, which is `xterm` or `xterm-256color` in most linux distributions, so you will get this error:
|
||||||
|
|
||||||
|
```
|
||||||
|
'xterm-256color': unknown terminal type
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```
|
||||||
|
Error opening terminal: xterm-kitty.
|
||||||
|
```
|
||||||
|
|
||||||
|
NixOS preserve the `TERMINFO` and `TERMINFO_DIRS` environment variables, for `root` and the `wheel` group: [nixpkgs/nixos/modules/config/terminfo.nix](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/config/terminfo.nix#L18)
|
||||||
|
|
||||||
|
For nix-darwin, take a look at <https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues>
|
||||||
|
|
||||||
|
### Solutions
|
||||||
|
|
||||||
|
Simplest solution, it will automatically copy over the terminfo files and also magically enable shell integration on the remote machine:
|
||||||
|
|
||||||
|
```
|
||||||
|
kitten ssh user@host
|
||||||
|
```
|
||||||
|
|
||||||
|
Or if you do not care about kitty's features(such as true color & graphics protocol), you can simply set `TERM` to `xterm-256color`, which is built-in in most linux distributions:
|
||||||
|
|
||||||
|
```
|
||||||
|
export TERM=xterm-256color
|
||||||
|
```
|
||||||
|
|
||||||
|
If you need kitty's features, but do not like the magic of `kitten`, you can manually install kitty's terminfo on the remote host:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# install on ubuntu / debian
|
||||||
|
sudo apt-get install kitty-terminfo
|
||||||
|
|
||||||
|
# or copy from local machine
|
||||||
|
infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin
|
||||||
|
```
|
||||||
|
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
{pkgs, catppuccin-alacritty, ...}:
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}:
|
||||||
###########################################################
|
###########################################################
|
||||||
#
|
#
|
||||||
# Alacritty Configuration
|
# Alacritty Configuration
|
||||||
@@ -7,18 +11,20 @@
|
|||||||
# 1. Multi-Window: `command + N`
|
# 1. Multi-Window: `command + N`
|
||||||
# 2. Increase Font Size: `command + =` | `command + +`
|
# 2. Increase Font Size: `command + =` | `command + +`
|
||||||
# 3. Decrease Font Size: `command + -` | `command + _`
|
# 3. Decrease Font Size: `command + -` | `command + _`
|
||||||
# 4. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
# 4. Search Text: `command + F`
|
||||||
|
# 5. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
||||||
#
|
#
|
||||||
# Useful Hot Keys for Linux:
|
# Useful Hot Keys for Linux:
|
||||||
# 1. Increase Font Size: `ctrl + shift + =` | `ctrl + shift + +`
|
# 1. Increase Font Size: `ctrl + shift + =` | `ctrl + shift + +`
|
||||||
# 2. Decrease Font Size: `ctrl + shift + -` | `ctrl + shift + _`
|
# 2. Decrease Font Size: `ctrl + shift + -` | `ctrl + shift + _`
|
||||||
# 3. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
# 3. Search Text: `ctrl + shift + N`
|
||||||
|
# 4. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
||||||
#
|
#
|
||||||
# Note: Alacritty do not have support for Tabs, and any graphic protocol.
|
# Note: Alacritty do not have support for Tabs, and any graphic protocol.
|
||||||
#
|
#
|
||||||
###########################################################
|
###########################################################
|
||||||
{
|
{
|
||||||
xdg.configFile."alacritty/theme_catppuccin.yml".source = "${catppuccin-alacritty}/catppuccin-mocha.yml";
|
xdg.configFile."alacritty/theme_catppuccin.yml".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-alacritty}/catppuccin-mocha.yml";
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
@@ -35,7 +41,7 @@
|
|||||||
#
|
#
|
||||||
# Window opacity as a floating point number from `0.0` to `1.0`.
|
# Window opacity as a floating point number from `0.0` to `1.0`.
|
||||||
# The value `0.0` is completely transparent and `1.0` is opaque.
|
# The value `0.0` is completely transparent and `1.0` is opaque.
|
||||||
opacity: 0.95
|
opacity: 0.93
|
||||||
|
|
||||||
# Startup Mode (changes require restart)
|
# Startup Mode (changes require restart)
|
||||||
#
|
#
|
||||||
@@ -46,7 +52,7 @@
|
|||||||
#
|
#
|
||||||
# Values for `startup_mode` (macOS only):
|
# Values for `startup_mode` (macOS only):
|
||||||
# - SimpleFullscreen
|
# - SimpleFullscreen
|
||||||
startup_mode: Windowed
|
startup_mode: Maximized
|
||||||
|
|
||||||
# Allow terminal applications to change Alacritty's window title.
|
# Allow terminal applications to change Alacritty's window title.
|
||||||
dynamic_title: true
|
dynamic_title: true
|
||||||
@@ -81,14 +87,22 @@
|
|||||||
# If the bold italic family is not specified, it will fall back to the
|
# If the bold italic family is not specified, it will fall back to the
|
||||||
# value specified for the normal font.
|
# value specified for the normal font.
|
||||||
family: JetBrainsMono Nerd Font
|
family: JetBrainsMono Nerd Font
|
||||||
|
shell:
|
||||||
|
# To resolve issues:
|
||||||
|
# 1. https://github.com/ryan4yin/nix-config/issues/26
|
||||||
|
# 2. https://github.com/ryan4yin/nix-config/issues/8
|
||||||
|
# Spawn a nushell in login mode via `bash`
|
||||||
|
program: ${pkgs.bash}/bin/bash
|
||||||
|
args:
|
||||||
|
- --login
|
||||||
|
- -c
|
||||||
|
- 'nu --login --interactive'
|
||||||
''
|
''
|
||||||
+ (
|
+ (
|
||||||
if pkgs.stdenv.isDarwin
|
if pkgs.stdenv.isDarwin
|
||||||
then ''
|
then ''
|
||||||
# Point size
|
# Point size
|
||||||
size: 14
|
size: 14
|
||||||
shell: # force nushell as default shell on macOS
|
|
||||||
program: /run/current-system/sw/bin/nu
|
|
||||||
''
|
''
|
||||||
else ''
|
else ''
|
||||||
# holder identation
|
# holder identation
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{mylib, ...}: {
|
||||||
|
imports = mylib.scanPaths ./.;
|
||||||
|
}
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
# 4. Increase Font Size: `command + =` | `command + +`
|
# 4. Increase Font Size: `command + =` | `command + +`
|
||||||
# 5. Decrease Font Size: `command + -` | `command + _`
|
# 5. Decrease Font Size: `command + -` | `command + _`
|
||||||
# 6. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
# 6. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
||||||
|
# 7. Search in the current window(show_scrollback): `ctrl + shift + h`
|
||||||
|
# This will open a pager, it's defined by `scrollback_pager`, default is `less`
|
||||||
|
#
|
||||||
#
|
#
|
||||||
# Useful Hot Keys for Linux:
|
# Useful Hot Keys for Linux:
|
||||||
# 1. New Tab: `ctrl + shift + t`
|
# 1. New Tab: `ctrl + shift + t`
|
||||||
@@ -27,7 +30,10 @@
|
|||||||
{
|
{
|
||||||
programs.kitty = {
|
programs.kitty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
theme = "Catppuccin-Mocha"; # kitty has catppuccin theme built-in
|
# kitty has catppuccin theme built-in,
|
||||||
|
# all the built-in themes are packaged into an extra package named `kitty-themes`
|
||||||
|
# and it's installed by home-manager if `theme` is specified.
|
||||||
|
theme = "Catppuccin-Mocha";
|
||||||
font = {
|
font = {
|
||||||
name = "JetBrainsMono Nerd Font";
|
name = "JetBrainsMono Nerd Font";
|
||||||
# use different font size on macOS
|
# use different font size on macOS
|
||||||
@@ -37,23 +43,24 @@
|
|||||||
else 13;
|
else 13;
|
||||||
};
|
};
|
||||||
|
|
||||||
settings =
|
keybindings = {
|
||||||
{
|
"ctrl+shift+m" = "toggle_maximized";
|
||||||
background_opacity = "0.95";
|
};
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
background_opacity = "0.93";
|
||||||
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
||||||
scrollback_lines = 10000;
|
scrollback_lines = 10000;
|
||||||
enable_audio_bell = false;
|
enable_audio_bell = false;
|
||||||
}
|
tab_bar_edge = "top"; # tab bar on top
|
||||||
// (
|
# To resolve issues:
|
||||||
if pkgs.stdenv.isDarwin
|
# 1. https://github.com/ryan4yin/nix-config/issues/26
|
||||||
then {
|
# 2. https://github.com/ryan4yin/nix-config/issues/8
|
||||||
# macOS specific settings, force kitty to use nushell as default shell
|
# Spawn a nushell in login mode via `bash`
|
||||||
shell = "/run/current-system/sw/bin/nu";
|
shell = "${pkgs.bash}/bin/bash --login -c 'nu --login --interactive'";
|
||||||
}
|
};
|
||||||
else {}
|
|
||||||
);
|
|
||||||
|
|
||||||
# macOS specific settings
|
# macOS specific settings
|
||||||
darwinLaunchOptions = ["--start-as=fullscreen"];
|
darwinLaunchOptions = ["--start-as=maximized"];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
{pkgs, ...}:
|
||||||
|
###########################################################
|
||||||
|
#
|
||||||
|
# Wezterm Configuration
|
||||||
|
#
|
||||||
|
# Default Keybindings: https://wezfurlong.org/wezterm/config/default-keys.html
|
||||||
|
#
|
||||||
|
###########################################################
|
||||||
|
{
|
||||||
|
# wezterm has catppuccin theme built-in,
|
||||||
|
# it's not necessary to install it separately.
|
||||||
|
|
||||||
|
# we can add wezterm as a flake input once this PR is merged:
|
||||||
|
# https://github.com/wez/wezterm/pull/3547
|
||||||
|
|
||||||
|
programs.wezterm =
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# TODO: Fix: https://github.com/wez/wezterm/issues/4483
|
||||||
|
# package = pkgs.wezterm.override { };
|
||||||
|
|
||||||
|
extraConfig = let
|
||||||
|
fontsize =
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then "14.0"
|
||||||
|
else "13.0";
|
||||||
|
in ''
|
||||||
|
-- Pull in the wezterm API
|
||||||
|
local wezterm = require 'wezterm'
|
||||||
|
|
||||||
|
-- This table will hold the configuration.
|
||||||
|
local config = {}
|
||||||
|
|
||||||
|
-- In newer versions of wezterm, use the config_builder which will
|
||||||
|
-- help provide clearer error messages
|
||||||
|
if wezterm.config_builder then
|
||||||
|
config = wezterm.config_builder()
|
||||||
|
end
|
||||||
|
|
||||||
|
wezterm.on('toggle-opacity', function(window, pane)
|
||||||
|
local overrides = window:get_config_overrides() or {}
|
||||||
|
if not overrides.window_background_opacity then
|
||||||
|
overrides.window_background_opacity = 0.93
|
||||||
|
else
|
||||||
|
overrides.window_background_opacity = nil
|
||||||
|
end
|
||||||
|
window:set_config_overrides(overrides)
|
||||||
|
end)
|
||||||
|
|
||||||
|
wezterm.on('toggle-maximize', function(window, pane)
|
||||||
|
window:maximize()
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- This is where you actually apply your config choices
|
||||||
|
config.color_scheme = "Catppuccin Mocha"
|
||||||
|
config.font = wezterm.font_with_fallback {
|
||||||
|
"JetBrainsMono Nerd Font",
|
||||||
|
"FiraCode Nerd Font",
|
||||||
|
|
||||||
|
-- To avoid 'Chinese characters displayed as variant (Japanese) glyphs'
|
||||||
|
"Source Han Sans SC",
|
||||||
|
"Source Han Sans TC"
|
||||||
|
}
|
||||||
|
|
||||||
|
config.hide_tab_bar_if_only_one_tab = true
|
||||||
|
config.scrollback_lines = 10000
|
||||||
|
config.enable_scroll_bar = true
|
||||||
|
|
||||||
|
config.keys = {
|
||||||
|
-- toggle opacity(CTRL + SHIFT + B)
|
||||||
|
{
|
||||||
|
key = 'B',
|
||||||
|
mods = 'CTRL',
|
||||||
|
action = wezterm.action.EmitEvent 'toggle-opacity',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key = 'M',
|
||||||
|
mods = 'CTRL',
|
||||||
|
action = wezterm.action.EmitEvent 'toggle-maximize',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
config.font_size = ${fontsize}
|
||||||
|
|
||||||
|
-- To resolve issues:
|
||||||
|
-- 1. https://github.com/ryan4yin/nix-config/issues/26
|
||||||
|
-- 2. https://github.com/ryan4yin/nix-config/issues/8
|
||||||
|
-- Spawn a nushell in login mode via `bash`
|
||||||
|
config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' }
|
||||||
|
|
||||||
|
return config
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
// (
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then {
|
||||||
|
# install wezterm via homebrew on macOS to avoid compilation, dummy package here.
|
||||||
|
package = pkgs.hello;
|
||||||
|
enableBashIntegration = false;
|
||||||
|
enableZshIntegration = false;
|
||||||
|
}
|
||||||
|
else {}
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{pkgs-unstable, ...}: {
|
||||||
|
# terminal file manager
|
||||||
|
programs.yazi = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs-unstable.yazi;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
# TODO: nushellIntegration is broken on release-23.11, wait for master's fix to be released
|
||||||
|
enableNushellIntegration = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{...}: {
|
|
||||||
programs.bash = {
|
|
||||||
enable = true;
|
|
||||||
enableCompletion = true;
|
|
||||||
bashrcExtra = ''
|
|
||||||
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
|
||||||
'';
|
|
||||||
|
|
||||||
shellAliases = {
|
|
||||||
k = "kubectl";
|
|
||||||
|
|
||||||
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
|
||||||
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,21 @@
|
|||||||
{ catppuccin-bat, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
# a cat(1) clone with syntax highlighting and Git integration.
|
# a cat(1) clone with syntax highlighting and Git integration.
|
||||||
programs.bat = {
|
programs.bat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
config = {
|
||||||
pager = "less -FR";
|
pager = "less -FR";
|
||||||
theme = "Catppuccin-mocha";
|
theme = "catppuccin-mocha";
|
||||||
};
|
};
|
||||||
themes = {
|
themes = {
|
||||||
# https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme
|
# https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme
|
||||||
Catppuccin-mocha = builtins.readFile "${catppuccin-bat}/Catppuccin-mocha.tmTheme";
|
catppuccin-mocha = {
|
||||||
|
src = nur-ryan4yin.packages.${pkgs.system}.catppuccin-bat;
|
||||||
|
file = "Catppuccin-mocha.tmTheme";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# https://github.com/catppuccin/btop/blob/main/themes/catppuccin_mocha.theme
|
||||||
|
xdg.configFile."btop/themes".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-btop}/themes";
|
||||||
|
|
||||||
|
# replacement of htop/nmon
|
||||||
|
programs.btop = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
color_theme = "catppuccin_mocha";
|
||||||
|
theme_background = false; # make btop transparent
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -9,11 +9,6 @@
|
|||||||
unzip
|
unzip
|
||||||
p7zip
|
p7zip
|
||||||
|
|
||||||
# utils
|
|
||||||
ripgrep # recursively searches directories for a regex pattern
|
|
||||||
jq # A lightweight and flexible command-line JSON processor
|
|
||||||
yq-go # yaml processer https://github.com/mikefarah/yq
|
|
||||||
|
|
||||||
# networking tools
|
# networking tools
|
||||||
mtr # A network diagnostic tool
|
mtr # A network diagnostic tool
|
||||||
iperf3
|
iperf3
|
||||||
@@ -24,14 +19,27 @@
|
|||||||
nmap # A utility for network discovery and security auditing
|
nmap # A utility for network discovery and security auditing
|
||||||
ipcalc # it is a calculator for the IPv4/v6 addresses
|
ipcalc # it is a calculator for the IPv4/v6 addresses
|
||||||
|
|
||||||
|
# Text Processing
|
||||||
|
# Docs: https://github.com/learnbyexample/Command-line-text-processing
|
||||||
|
gnugrep # GNU grep, provides `grep`/`egrep`/`fgrep`
|
||||||
|
gnused # GNU sed, very powerful(mainly for replacing text in files)
|
||||||
|
gawk # GNU awk, a pattern scanning and processing language
|
||||||
|
ripgrep # recursively searches directories for a regex pattern
|
||||||
|
sad # CLI search and replace, with diff preview, really useful!!!
|
||||||
|
delta # A viewer for git and diff output
|
||||||
|
# A fast and polyglot tool for code searching, linting, rewriting at large scale
|
||||||
|
# supported languages: only some mainstream languages currently(do not support nix/nginx/yaml/toml/...)
|
||||||
|
ast-grep
|
||||||
|
jq # A lightweight and flexible command-line JSON processor
|
||||||
|
yq-go # yaml processer https://github.com/mikefarah/yq
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
|
tldr
|
||||||
cowsay
|
cowsay
|
||||||
file
|
file
|
||||||
which
|
which
|
||||||
tree
|
tree
|
||||||
gnused
|
|
||||||
gnutar
|
gnutar
|
||||||
gawk
|
|
||||||
zstd
|
zstd
|
||||||
caddy
|
caddy
|
||||||
gnupg
|
gnupg
|
||||||
@@ -49,18 +57,11 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
# modern vim
|
|
||||||
neovim = {
|
|
||||||
enable = true;
|
|
||||||
defaultEditor = true;
|
|
||||||
vimAlias = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# A modern replacement for ‘ls’
|
# A modern replacement for ‘ls’
|
||||||
# useful in bash/zsh prompt, not in nushell.
|
# useful in bash/zsh prompt, not in nushell.
|
||||||
exa = {
|
eza = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableAliases = true;
|
enableAliases = false; # do not enable aliases in nushell!
|
||||||
git = true;
|
git = true;
|
||||||
icons = true;
|
icons = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,13 +1,3 @@
|
|||||||
{...}: {
|
{mylib, ...}: {
|
||||||
imports = [
|
imports = mylib.scanPaths ./.;
|
||||||
./nushell
|
|
||||||
./tmux
|
|
||||||
./zellij
|
|
||||||
|
|
||||||
./bash.nix
|
|
||||||
./bat.nix
|
|
||||||
./core.nix
|
|
||||||
./git.nix
|
|
||||||
./starship.nix
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
|
||||||
userfullname,
|
userfullname,
|
||||||
useremail,
|
useremail,
|
||||||
...
|
...
|
||||||
@@ -12,9 +11,12 @@
|
|||||||
#
|
#
|
||||||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
|
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
|
||||||
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
||||||
rm -f ~/.gitconfig
|
rm -f ${config.home.homeDirectory}/.gitconfig
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
];
|
||||||
|
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
lfs.enable = true;
|
lfs.enable = true;
|
||||||
@@ -37,15 +39,15 @@
|
|||||||
|
|
||||||
# replace https with ssh
|
# replace https with ssh
|
||||||
url = {
|
url = {
|
||||||
"ssh://git@github.com/" = {
|
"ssh://git@github.com/ryan4yin" = {
|
||||||
insteadOf = "https://github.com/";
|
insteadOf = "https://github.com/ryan4yin";
|
||||||
};
|
|
||||||
"ssh://git@gitlab.com/" = {
|
|
||||||
insteadOf = "https://gitlab.com/";
|
|
||||||
};
|
|
||||||
"ssh://git@bitbucket.com/" = {
|
|
||||||
insteadOf = "https://bitbucket.com/";
|
|
||||||
};
|
};
|
||||||
|
# "ssh://git@gitlab.com/" = {
|
||||||
|
# insteadOf = "https://gitlab.com/";
|
||||||
|
# };
|
||||||
|
# "ssh://git@bitbucket.com/" = {
|
||||||
|
# insteadOf = "https://bitbucket.com/";
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,10 +56,15 @@
|
|||||||
# signByDefault = true;
|
# signByDefault = true;
|
||||||
# };
|
# };
|
||||||
|
|
||||||
|
# A syntax-highlighting pager in Rust(2019 ~ Now)
|
||||||
delta = {
|
delta = {
|
||||||
enable = true;
|
enable = true;
|
||||||
options = {
|
options = {
|
||||||
features = "side-by-side";
|
diff-so-fancy = true;
|
||||||
|
line-numbers = true;
|
||||||
|
true-color = "always";
|
||||||
|
# features => named groups of settings, used to keep related settings organized
|
||||||
|
# features = "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -68,10 +75,21 @@
|
|||||||
st = "status";
|
st = "status";
|
||||||
ls = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate";
|
ls = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate";
|
||||||
ll = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --numstat";
|
ll = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --numstat";
|
||||||
cm = "commit -m";
|
cm = "commit -m"; # commit via `git cm <message>`
|
||||||
ca = "commit -am";
|
ca = "commit -am"; # commit all changes via `git ca <message>`
|
||||||
dc = "diff --cached";
|
dc = "diff --cached";
|
||||||
amend = "commit --amend -m";
|
|
||||||
|
amend = "commit --amend -m"; # amend commit message via `git amend <message>`
|
||||||
|
unstage = "reset HEAD --"; # unstage file via `git unstage <file>`
|
||||||
|
merged = "branch --merged"; # list merged(into HEAD) branches via `git merged`
|
||||||
|
unmerged = "branch --no-merged"; # list unmerged(into HEAD) branches via `git unmerged`
|
||||||
|
nonexist = "remote prune origin --dry-run"; # list non-exist(remote) branches via `git nonexist`
|
||||||
|
|
||||||
|
# delete merged branches except master & dev & staging
|
||||||
|
# `!` indicates it's a shell script, not a git subcommand
|
||||||
|
delmerged = ''! git branch --merged | egrep -v "(^\*|main|master|dev|staging)" | xargs git branch -d'';
|
||||||
|
# delete non-exist(remote) branches
|
||||||
|
delnonexist = "remote prune origin";
|
||||||
|
|
||||||
# aliases for submodule
|
# aliases for submodule
|
||||||
update = "submodule update --init --recursive";
|
update = "submodule update --init --recursive";
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
{ config, ...}: {
|
|
||||||
programs.nushell = {
|
|
||||||
enable = true;
|
|
||||||
configFile.source = ./config.nu;
|
|
||||||
|
|
||||||
extraConfig = ''
|
|
||||||
let-env PATH = ([
|
|
||||||
"${config.home.homeDirectory}/bin"
|
|
||||||
"${config.home.homeDirectory}/.local/bin"
|
|
||||||
"${config.home.homeDirectory}/go/bin"
|
|
||||||
|
|
||||||
($env.PATH | split row (char esep))
|
|
||||||
] | flatten)
|
|
||||||
'';
|
|
||||||
|
|
||||||
# home-manager will merge the cotent in `environmentVariables` with the `envFile.source`
|
|
||||||
# but basically, I set all environment variables via the shell-independent way, so I don't need to use those two options
|
|
||||||
#
|
|
||||||
# envFile.source = ./env.nu;
|
|
||||||
# environmentVariables = { FOO="bar"; };
|
|
||||||
|
|
||||||
shellAliases = {
|
|
||||||
k = "kubectl";
|
|
||||||
|
|
||||||
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
|
||||||
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -71,7 +71,7 @@ let catppuccin_theme = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# The default config record. This is where much of your global configuration is setup.
|
# The default config record. This is where much of your global configuration is setup.
|
||||||
let-env config = {
|
$env.config = {
|
||||||
color_config: $catppuccin_theme # <-- this is the theme
|
color_config: $catppuccin_theme # <-- this is the theme
|
||||||
use_ansi_coloring: true
|
use_ansi_coloring: true
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
let
|
||||||
|
shellAliases = {
|
||||||
|
k = "kubectl";
|
||||||
|
|
||||||
|
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
||||||
|
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
# only works in bash/zsh, not nushell
|
||||||
|
home.shellAliases = shellAliases;
|
||||||
|
|
||||||
|
programs.nushell = {
|
||||||
|
enable = true;
|
||||||
|
configFile.source = ./config.nu;
|
||||||
|
shellAliases = shellAliases;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.bash = {
|
||||||
|
enable = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
bashrcExtra = ''
|
||||||
|
export PATH="$HOME/.local/bin:$HOME/go/bin:$PATH"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
{ catppuccin-starship, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
programs.starship = {
|
programs.starship = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
@@ -6,7 +10,8 @@
|
|||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
enableNushellIntegration = true;
|
enableNushellIntegration = true;
|
||||||
|
|
||||||
settings = {
|
settings =
|
||||||
|
{
|
||||||
character = {
|
character = {
|
||||||
success_symbol = "[›](bold green)";
|
success_symbol = "[›](bold green)";
|
||||||
error_symbol = "[›](bold red)";
|
error_symbol = "[›](bold red)";
|
||||||
@@ -22,6 +27,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
palette = "catppuccin_mocha";
|
palette = "catppuccin_mocha";
|
||||||
} // builtins.fromTOML (builtins.readFile "${catppuccin-starship}/palettes/mocha.toml");
|
}
|
||||||
|
// builtins.fromTOML (builtins.readFile "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-starship}/palettes/mocha.toml");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
{pkgs, ...}: let
|
|
||||||
buildTmuxPlugin = pkgs.tmuxPlugins.mkTmuxPlugin;
|
|
||||||
in {
|
|
||||||
draculaTheme = buildTmuxPlugin {
|
|
||||||
pluginName = "dracula";
|
|
||||||
version = "v2.2.0";
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
name = "dracula-tmux-v2.2.0";
|
|
||||||
url = "https://github.com/dracula/tmux/archive/refs/tags/v2.2.0.tar.gz";
|
|
||||||
sha256 = "sha256:0v2k994yy4xx2iw8qxg7qphw46gq2qmg496i3a3h9b6jgwxqm7zn";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
{
|
{pkgs, ...}: {
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
plugins = pkgs.tmuxPlugins // pkgs.callPackage ./custom-plugins.nix {};
|
|
||||||
in {
|
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
shell = "${pkgs.nushell}/bin/nu";
|
shell = "${pkgs.nushell}/bin/nu";
|
||||||
@@ -17,26 +11,33 @@ in {
|
|||||||
# tmux-sensible overwrites default tmux shortcuts, makes them more sane.
|
# tmux-sensible overwrites default tmux shortcuts, makes them more sane.
|
||||||
sensibleOnTop = true;
|
sensibleOnTop = true;
|
||||||
|
|
||||||
# extraConfig = builtins.readFile ./tmux.conf;
|
# https://github.com/sxyazi/yazi/wiki/Image-preview-within-tmux
|
||||||
|
extraConfig = ''
|
||||||
|
set -g allow-passthrough on
|
||||||
|
|
||||||
|
set -ga update-environment TERM
|
||||||
|
set -ga update-environment TERM_PROGRAM
|
||||||
|
'';
|
||||||
# keyMode = "vi"; # default is emacs
|
# keyMode = "vi"; # default is emacs
|
||||||
|
|
||||||
baseIndex = 1; # start index from 1
|
baseIndex = 1; # start index from 1
|
||||||
escapeTime = 0; # do not wait for escape key
|
escapeTime = 0; # do not wait for escape key
|
||||||
terminal = "xterm-256color";
|
|
||||||
|
|
||||||
plugins = with plugins; [
|
plugins = with pkgs.tmuxPlugins; [
|
||||||
draculaTheme # theme
|
|
||||||
{
|
{
|
||||||
# https://github.com/tmux-plugins/tmux-continuum
|
# theme
|
||||||
# Continuous saving of tmux environment. Automatic restore when tmux is started.
|
# https://github.com/catppuccin/tmux
|
||||||
plugin = continuum;
|
plugin = catppuccin;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
set -g @continuum-save-interval '15'
|
set -g @catppuccin_flavour 'mocha' # or frappe, macchiato, mocha
|
||||||
|
set -g @catppuccin_window_status_enable "yes"
|
||||||
# Option to display current status of tmux continuum in tmux status line.
|
|
||||||
set -g status-right 'Continuum status: #{continuum_status}'
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# https://github.com/tmux-plugins/tmux-yank
|
||||||
|
# Enables copying to system clipboard.
|
||||||
|
yank
|
||||||
|
|
||||||
{
|
{
|
||||||
# https://github.com/tmux-plugins/tmux-resurrect
|
# https://github.com/tmux-plugins/tmux-resurrect
|
||||||
# Manually persists tmux environment across system restarts.
|
# Manually persists tmux environment across system restarts.
|
||||||
@@ -47,11 +48,7 @@ in {
|
|||||||
# Restore Neovim sessions
|
# Restore Neovim sessions
|
||||||
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
# https://github.com/tmux-plugins/tmux-yank
|
|
||||||
# Enables copying to system clipboard.
|
|
||||||
plugin = yank;
|
|
||||||
}
|
|
||||||
# set -g @plugin 'tmux-plugins/tmux-cpu'
|
# set -g @plugin 'tmux-plugins/tmux-cpu'
|
||||||
{
|
{
|
||||||
plugin = cpu;
|
plugin = cpu;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{...}: {
|
_: {
|
||||||
programs.zellij = {
|
programs.zellij = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".config/zellij/config.kdl".source = ./config.kdl;
|
xdg.configFile."zellij/config.kdl".source = ./config.kdl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,49 +1,3 @@
|
|||||||
{pkgs, ...}: {
|
{username, ...}: {
|
||||||
##########################################################################
|
home.homeDirectory = "/Users/${username}";
|
||||||
#
|
|
||||||
# MacOS specific home configuration
|
|
||||||
#
|
|
||||||
##########################################################################
|
|
||||||
programs.zsh = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.ssh = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
# all my ssh private key are generated by `ssh-keygen -t ed25519 -C "ryan@nickname"`
|
|
||||||
# the config's format:
|
|
||||||
# Host — given the pattern used to match against the host name given on the command line.
|
|
||||||
# HostName — specify nickname or abbreviation for host
|
|
||||||
# IdentityFile — the location of your SSH key authentication file for the account.
|
|
||||||
# format in details:
|
|
||||||
# https://www.ssh.com/academy/ssh/config
|
|
||||||
extraConfig = ''
|
|
||||||
# a private key that is used during authentication will be added to ssh-agent if it is running
|
|
||||||
AddKeysToAgent yes
|
|
||||||
|
|
||||||
Host 192.168.*
|
|
||||||
# allow to securely use local SSH agent to authenticate on the remote machine.
|
|
||||||
# It has the same effect as adding cli option `ssh -A user@host`
|
|
||||||
ForwardAgent yes
|
|
||||||
# romantic holds my homelab~
|
|
||||||
IdentityFile ~/.ssh/romantic
|
|
||||||
# Specifies that ssh should only use the identity file explicitly configured above
|
|
||||||
# required to prevent sending default identity files first.
|
|
||||||
IdentitiesOnly yes
|
|
||||||
|
|
||||||
Host github.com
|
|
||||||
Hostname github.com
|
|
||||||
# github is controlled by gluttony~
|
|
||||||
IdentityFile ~/.ssh/harmonica
|
|
||||||
# Specifies that ssh should only use the identity file explicitly configured above
|
|
||||||
# required to prevent sending default identity files first.
|
|
||||||
IdentitiesOnly yes
|
|
||||||
'';
|
|
||||||
|
|
||||||
# use ssh-agent so we only need to input passphrase once
|
|
||||||
# run `ssh-add /path/to/key` for every identity file
|
|
||||||
# check imported keys by `ssh-add -l`
|
|
||||||
# TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login.
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +1,9 @@
|
|||||||
{ username, ... }: {
|
{mylib, ...}: {
|
||||||
imports = [
|
imports =
|
||||||
|
(mylib.scanPaths ./.)
|
||||||
|
++ [
|
||||||
|
../base/server
|
||||||
../base/desktop
|
../base/desktop
|
||||||
|
../base/core.nix
|
||||||
./core.nix
|
|
||||||
./nushell.nix
|
|
||||||
./rime-squirrel.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# Home Manager needs a bit of information about you and the
|
|
||||||
# paths it should manage.
|
|
||||||
home = {
|
|
||||||
username = username;
|
|
||||||
# set homeDirectory make build fail
|
|
||||||
homeDirectory = "/Users/${username}";
|
|
||||||
|
|
||||||
# This value determines the Home Manager release that your
|
|
||||||
# configuration is compatible with. This helps avoid breakage
|
|
||||||
# when a new Home Manager release introduces backwards
|
|
||||||
# incompatible changes.
|
|
||||||
#
|
|
||||||
# You can update Home Manager without changing this value. See
|
|
||||||
# the Home Manager release notes for a list of state version
|
|
||||||
# changes in each release.
|
|
||||||
stateVersion = "22.11";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
|
||||||
programs.home-manager.enable = true;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
{config, ...}: {
|
|
||||||
# nix-darwin do not set PATH for nushell! so we need to do it manually
|
|
||||||
# this is a workaround to add nix's PATH to nushell
|
|
||||||
programs.nushell.extraConfig = ''
|
|
||||||
let-env PATH = ([
|
|
||||||
"${config.home.homeDirectory}/bin"
|
|
||||||
"${config.home.homeDirectory}/.local/bin"
|
|
||||||
"${config.home.homeDirectory}/go/bin"
|
|
||||||
"/usr/local/bin"
|
|
||||||
"${config.home.homeDirectory}/.nix-profile/bin"
|
|
||||||
"/etc/profiles/per-user/${config.home.username}/bin"
|
|
||||||
"/run/current-system/sw/bin"
|
|
||||||
"/nix/var/nix/profiles/default/bin"
|
|
||||||
|
|
||||||
($env.PATH | split row (char esep))
|
|
||||||
] | flatten)
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
home.file.".proxychains/proxychains.conf".source = ./proxychains.conf;
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
|
||||||
|
# proxychains.conf VER 4.x
|
||||||
|
#
|
||||||
|
# HTTP, SOCKS4a, SOCKS5 tunneling proxifier with DNS.
|
||||||
|
|
||||||
|
|
||||||
|
# The option below identifies how the ProxyList is treated.
|
||||||
|
# only one option should be uncommented at time,
|
||||||
|
# otherwise the last appearing option will be accepted
|
||||||
|
#
|
||||||
|
#dynamic_chain
|
||||||
|
#
|
||||||
|
# Dynamic - Each connection will be done via chained proxies
|
||||||
|
# all proxies chained in the order as they appear in the list
|
||||||
|
# at least one proxy must be online to play in chain
|
||||||
|
# (dead proxies are skipped)
|
||||||
|
# otherwise EINTR is returned to the app
|
||||||
|
#
|
||||||
|
strict_chain
|
||||||
|
#
|
||||||
|
# Strict - Each connection will be done via chained proxies
|
||||||
|
# all proxies chained in the order as they appear in the list
|
||||||
|
# all proxies must be online to play in chain
|
||||||
|
# otherwise EINTR is returned to the app
|
||||||
|
#
|
||||||
|
#round_robin_chain
|
||||||
|
#
|
||||||
|
# Round Robin - Each connection will be done via chained proxies
|
||||||
|
# of chain_len length
|
||||||
|
# all proxies chained in the order as they appear in the list
|
||||||
|
# at least one proxy must be online to play in chain
|
||||||
|
# (dead proxies are skipped).
|
||||||
|
# the start of the current proxy chain is the proxy after the last
|
||||||
|
# proxy in the previously invoked proxy chain.
|
||||||
|
# if the end of the proxy chain is reached while looking for proxies
|
||||||
|
# start at the beginning again.
|
||||||
|
# otherwise EINTR is returned to the app
|
||||||
|
# These semantics are not guaranteed in a multithreaded environment.
|
||||||
|
#
|
||||||
|
#random_chain
|
||||||
|
#
|
||||||
|
# Random - Each connection will be done via random proxy
|
||||||
|
# (or proxy chain, see chain_len) from the list.
|
||||||
|
# this option is good to test your IDS :)
|
||||||
|
|
||||||
|
# Make sense only if random_chain or round_robin_chain
|
||||||
|
#chain_len = 2
|
||||||
|
|
||||||
|
# Quiet mode (no output from library)
|
||||||
|
#quiet_mode
|
||||||
|
|
||||||
|
## Proxy DNS requests - no leak for DNS data
|
||||||
|
# (disable all of the 3 items below to not proxy your DNS requests)
|
||||||
|
|
||||||
|
# method 1. this uses the proxychains4 style method to do remote dns:
|
||||||
|
# a thread is spawned that serves DNS requests and hands down an ip
|
||||||
|
# assigned from an internal list (via remote_dns_subnet).
|
||||||
|
# this is the easiest (setup-wise) and fastest method, however on
|
||||||
|
# systems with buggy libcs and very complex software like webbrowsers
|
||||||
|
# this might not work and/or cause crashes.
|
||||||
|
proxy_dns
|
||||||
|
|
||||||
|
# method 2. use the old proxyresolv script to proxy DNS requests
|
||||||
|
# in proxychains 3.1 style. requires `proxyresolv` in $PATH
|
||||||
|
# plus a dynamically linked `dig` binary.
|
||||||
|
# this is a lot slower than `proxy_dns`, doesn't support .onion URLs,
|
||||||
|
# but might be more compatible with complex software like webbrowsers.
|
||||||
|
#proxy_dns_old
|
||||||
|
|
||||||
|
# method 3. use proxychains4-daemon process to serve remote DNS requests.
|
||||||
|
# this is similar to the threaded `proxy_dns` method, however it requires
|
||||||
|
# that proxychains4-daemon is already running on the specified address.
|
||||||
|
# on the plus side it doesn't do malloc/threads so it should be quite
|
||||||
|
# compatible with complex, async-unsafe software.
|
||||||
|
# note that if you don't start proxychains4-daemon before using this,
|
||||||
|
# the process will simply hang.
|
||||||
|
#proxy_dns_daemon 127.0.0.1:1053
|
||||||
|
|
||||||
|
# set the class A subnet number to use for the internal remote DNS mapping
|
||||||
|
# we use the reserved 224.x.x.x range by default,
|
||||||
|
# if the proxified app does a DNS request, we will return an IP from that range.
|
||||||
|
# on further accesses to this ip we will send the saved DNS name to the proxy.
|
||||||
|
# in case some control-freak app checks the returned ip, and denies to
|
||||||
|
# connect, you can use another subnet, e.g. 10.x.x.x or 127.x.x.x.
|
||||||
|
# of course you should make sure that the proxified app does not need
|
||||||
|
# *real* access to this subnet.
|
||||||
|
# i.e. dont use the same subnet then in the localnet section
|
||||||
|
#remote_dns_subnet 127
|
||||||
|
#remote_dns_subnet 10
|
||||||
|
remote_dns_subnet 224
|
||||||
|
|
||||||
|
# Some timeouts in milliseconds
|
||||||
|
tcp_read_time_out 15000
|
||||||
|
tcp_connect_time_out 8000
|
||||||
|
|
||||||
|
### Examples for localnet exclusion
|
||||||
|
## localnet ranges will *not* use a proxy to connect.
|
||||||
|
## note that localnet works only when plain IP addresses are passed to the app,
|
||||||
|
## the hostname resolves via /etc/hosts, or proxy_dns is disabled or proxy_dns_old used.
|
||||||
|
|
||||||
|
## Exclude connections to 192.168.1.0/24 with port 80
|
||||||
|
# localnet 192.168.1.0:80/255.255.255.0
|
||||||
|
|
||||||
|
## Exclude connections to 192.168.100.0/24
|
||||||
|
# localnet 192.168.100.0/255.255.255.0
|
||||||
|
|
||||||
|
## Exclude connections to ANYwhere with port 80
|
||||||
|
# localnet 0.0.0.0:80/0.0.0.0
|
||||||
|
# localnet [::]:80/0
|
||||||
|
|
||||||
|
## RFC6890 Loopback address range
|
||||||
|
## if you enable this, you have to make sure remote_dns_subnet is not 127
|
||||||
|
## you'll need to enable it if you want to use an application that
|
||||||
|
## connects to localhost.
|
||||||
|
# localnet 127.0.0.0/255.0.0.0
|
||||||
|
# localnet ::1/128
|
||||||
|
|
||||||
|
## RFC1918 Private Address Ranges
|
||||||
|
# localnet 10.0.0.0/255.0.0.0
|
||||||
|
# localnet 172.16.0.0/255.240.0.0
|
||||||
|
# localnet 192.168.0.0/255.255.0.0
|
||||||
|
|
||||||
|
### Examples for dnat
|
||||||
|
## Trying to proxy connections to destinations which are dnatted,
|
||||||
|
## will result in proxying connections to the new given destinations.
|
||||||
|
## Whenever I connect to 1.1.1.1 on port 1234 actually connect to 1.1.1.2 on port 443
|
||||||
|
# dnat 1.1.1.1:1234 1.1.1.2:443
|
||||||
|
|
||||||
|
## Whenever I connect to 1.1.1.1 on port 443 actually connect to 1.1.1.2 on port 443
|
||||||
|
## (no need to write :443 again)
|
||||||
|
# dnat 1.1.1.2:443 1.1.1.2
|
||||||
|
|
||||||
|
## No matter what port I connect to on 1.1.1.1 port actually connect to 1.1.1.2 on port 443
|
||||||
|
# dnat 1.1.1.1 1.1.1.2:443
|
||||||
|
|
||||||
|
## Always, instead of connecting to 1.1.1.1, connect to 1.1.1.2
|
||||||
|
# dnat 1.1.1.1 1.1.1.2
|
||||||
|
|
||||||
|
# ProxyList format
|
||||||
|
# type ip port [user pass]
|
||||||
|
# (values separated by 'tab' or 'blank')
|
||||||
|
#
|
||||||
|
# only numeric ipv4 addresses are valid
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
#
|
||||||
|
# socks5 192.168.67.78 1080 lamer secret
|
||||||
|
# http 192.168.89.3 8080 justu hidden
|
||||||
|
# socks4 192.168.1.49 1080
|
||||||
|
# http 192.168.39.93 8080
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# proxy types: http, socks4, socks5, raw
|
||||||
|
# * raw: The traffic is simply forwarded to the proxy without modification.
|
||||||
|
# ( auth types supported: "basic"-http "user/pass"-socks )
|
||||||
|
#
|
||||||
|
[ProxyList]
|
||||||
|
# add proxy here ...
|
||||||
|
# set to clash's http/socks5 port
|
||||||
|
socks5 127.0.0.1 7890
|
||||||
@@ -1,17 +1,11 @@
|
|||||||
{
|
{pkgs, ...}: {
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
# remove existing rime data (squirrel)
|
|
||||||
home.activation.removeExistingRimeData = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
|
||||||
rm -rf "~/Library/Rime/build/flypy.prism.bin"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Squirrel Input Method
|
# Squirrel Input Method
|
||||||
home.file."Library/Rime" = {
|
home.file."Library/Rime" = {
|
||||||
# my custom squirrel data (flypy input method)
|
# my custom squirrel data (flypy input method)
|
||||||
source = "${pkgs.flypy-squirrel}/share/rime-data";
|
source = "${pkgs.flypy-squirrel}/share/rime-data";
|
||||||
recursive = true;
|
recursive = true;
|
||||||
|
# overwrite possible existing data dynamically generated by squirrel
|
||||||
|
# https://github.com/nix-community/home-manager/blob/release-23.05/modules/lib/file-type.nix#L101-L111
|
||||||
|
force = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
# Homebrew's default install location:
|
||||||
|
# /opt/homebrew for Apple Silicon
|
||||||
|
# /usr/local for macOS Intel
|
||||||
|
# The prefix /opt/homebrew was chosen to allow installations
|
||||||
|
# in /opt/homebrew for Apple Silicon and /usr/local for Rosetta 2 to coexist and use bottles.
|
||||||
|
programs.bash = {
|
||||||
|
enable = true;
|
||||||
|
bashrcExtra = ''
|
||||||
|
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
envExtra = ''
|
||||||
|
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -11,3 +11,13 @@
|
|||||||
1. used by my hyprland desktop.
|
1. used by my hyprland desktop.
|
||||||
7. `desktop-i3.nix`: the entrypoint of i3's configuration, it import all the submodules above, except `hyprland`.
|
7. `desktop-i3.nix`: the entrypoint of i3's configuration, it import all the submodules above, except `hyprland`.
|
||||||
1. used by my i3 desktop.
|
1. used by my i3 desktop.
|
||||||
|
|
||||||
|
|
||||||
|
## Why install I3/Hyprland in Home Manager instead of a NixOS Module?
|
||||||
|
|
||||||
|
1. I3 & Hyprland's configuration file is located in `~/.config`, which can be easily managed by Home Manager.
|
||||||
|
2. There're other user-specific systemd servcies, such gammastep, wallpaper-switcher, etc. which can be easily managed by Home Manager, but if we start i3/hyprland in NixOS Module, they may failed to start automatically. With i3/hyprland installed via home-manager, we can control their systemd service's dependent order, to avoid issues like this.
|
||||||
|
3. By install as less as possible in NixOS Module, we can:
|
||||||
|
1. Make the NixOS system more secure and stable.
|
||||||
|
2. Make this flake more portable to other non-NixOS systems, as home-manager can be installed on any Linux system.
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
{ catppuccin-btop, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
# https://github.com/catppuccin/btop/blob/main/themes/catppuccin_mocha.theme
|
|
||||||
home.file.".config/btop/themes".source = "${catppuccin-btop}/themes";
|
|
||||||
|
|
||||||
# replacement of htop/nmon
|
|
||||||
programs.btop = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
color_theme = "catppuccin_mocha";
|
|
||||||
theme_background = false; # make btop transparent
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
{
|
{mylib, ...}: {
|
||||||
imports = [
|
imports = mylib.scanPaths ./.;
|
||||||
./btop.nix
|
|
||||||
./shell.nix
|
|
||||||
./system-tools.nix
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
{config, nushell-scripts, ...}: let
|
|
||||||
|
{config, username, ...}: let
|
||||||
d = config.xdg.dataHome;
|
d = config.xdg.dataHome;
|
||||||
c = config.xdg.configHome;
|
c = config.xdg.configHome;
|
||||||
cache = config.xdg.cacheHome;
|
cache = config.xdg.cacheHome;
|
||||||
in rec {
|
in rec {
|
||||||
# add environment variables
|
|
||||||
systemd.user.sessionVariables = {
|
home.homeDirectory = "/home/${username}";
|
||||||
|
|
||||||
|
# environment variables that always set at login
|
||||||
|
home.sessionVariables = {
|
||||||
# clean up ~
|
# clean up ~
|
||||||
LESSHISTFILE = cache + "/less/history";
|
LESSHISTFILE = cache + "/less/history";
|
||||||
LESSKEY = c + "/less/lesskey";
|
LESSKEY = c + "/less/lesskey";
|
||||||
@@ -17,13 +21,8 @@ in rec {
|
|||||||
|
|
||||||
# set default applications
|
# set default applications
|
||||||
BROWSER = "firefox";
|
BROWSER = "firefox";
|
||||||
TERM = "xterm-256color";
|
|
||||||
|
|
||||||
# enable scrolling in git diff
|
# enable scrolling in git diff
|
||||||
DELTA_PAGER = "less -R";
|
DELTA_PAGER = "less -R";
|
||||||
|
|
||||||
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.sessionVariables = systemd.user.sessionVariables;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,11 @@
|
|||||||
libnotify
|
libnotify
|
||||||
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
||||||
|
|
||||||
# need to run `conda-install` before using it
|
|
||||||
# need to run `conda-shell` before using command `conda`
|
|
||||||
# conda is not available for MacOS
|
|
||||||
conda
|
|
||||||
|
|
||||||
# system call monitoring
|
# system call monitoring
|
||||||
strace # system call monitoring
|
strace # system call monitoring
|
||||||
ltrace # library call monitoring
|
ltrace # library call monitoring
|
||||||
|
bpftrace # powerful tracing tool
|
||||||
|
tcpdump # network sniffer
|
||||||
lsof # list open files
|
lsof # list open files
|
||||||
|
|
||||||
# system tools
|
# system tools
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
{ username, ... }: {
|
|
||||||
imports = [
|
|
||||||
../base/desktop
|
|
||||||
|
|
||||||
./base
|
|
||||||
./fcitx5
|
|
||||||
./desktop
|
|
||||||
|
|
||||||
./hyprland
|
|
||||||
];
|
|
||||||
|
|
||||||
# Home Manager needs a bit of information about you and the
|
|
||||||
# paths it should manage.
|
|
||||||
home = {
|
|
||||||
username = username;
|
|
||||||
homeDirectory = "/home/${username}";
|
|
||||||
|
|
||||||
# This value determines the Home Manager release that your
|
|
||||||
# configuration is compatible with. This helps avoid breakage
|
|
||||||
# when a new Home Manager release introduces backwards
|
|
||||||
# incompatible changes.
|
|
||||||
#
|
|
||||||
# You can update Home Manager without changing this value. See
|
|
||||||
# the Home Manager release notes for a list of state version
|
|
||||||
# changes in each release.
|
|
||||||
stateVersion = "22.11";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
|
||||||
programs.home-manager.enable = true;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../base/server
|
||||||
|
../base/desktop
|
||||||
|
../base/core.nix
|
||||||
|
|
||||||
|
./base
|
||||||
|
./desktop
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
pkgs-unstable,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# creative
|
||||||
|
blender # 3d modeling
|
||||||
|
# gimp # image editing, I prefer using figma in browser instead of this one
|
||||||
|
inkscape # vector graphics
|
||||||
|
krita # digital painting
|
||||||
|
musescore # music notation
|
||||||
|
# reaper # audio production
|
||||||
|
pkgs-unstable.sonic-pi # music programming
|
||||||
|
|
||||||
|
# this app consumes a lot of storage, so do not install it currently
|
||||||
|
# kicad # 3d printing, eletrical engineering
|
||||||
|
|
||||||
|
# fpga
|
||||||
|
pkgs-unstable.python311Packages.apycula # gowin fpga
|
||||||
|
pkgs-unstable.yosys # fpga synthesis
|
||||||
|
pkgs-unstable.nextpnr # fpga place and route
|
||||||
|
pkgs-unstable.openfpgaloader # fpga programming
|
||||||
|
nur-ryan4yin.packages.${pkgs.system}.gowin-eda-edu-ide # app: `gowin-env` => `gw_ide` / `gw_pack` / ...
|
||||||
|
];
|
||||||
|
|
||||||
|
programs = {
|
||||||
|
# live streaming
|
||||||
|
obs-studio.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{mylib, ...}: {
|
||||||
|
imports = mylib.scanPaths ./.;
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# Adjust the color temperature(& brightness) of your screen according to
|
||||||
|
# your surroundings. This may help your eyes hurt less if you are
|
||||||
|
# working in front of the screen at night.
|
||||||
|
#
|
||||||
|
# works fine with both x11 & wayland(hyprland)
|
||||||
|
#
|
||||||
|
# https://gitlab.com/chinstrap/gammastep
|
||||||
|
services.gammastep = {
|
||||||
|
enable = true;
|
||||||
|
# add a gammastep icon in the system tray
|
||||||
|
# has problem with wayland, so disable it
|
||||||
|
tray = false;
|
||||||
|
temperature = {
|
||||||
|
day = 5700;
|
||||||
|
night = 4000;
|
||||||
|
};
|
||||||
|
# https://gitlab.com/chinstrap/gammastep/-/blob/master/gammastep.conf.sample?ref_type=heads
|
||||||
|
settings = {
|
||||||
|
general = {
|
||||||
|
fade = "1"; # gradually apply the new screen temperature/brightness over a couple of seconds.
|
||||||
|
# it is a fake brightness adjustment obtained by manipulating the gamma ramps,
|
||||||
|
# which means that it does not reduce the backlight of the screen.
|
||||||
|
# Preferably only use it if your normal backlight adjustment is too coarse-grained.
|
||||||
|
brightness-day = "1.0";
|
||||||
|
brightness-night = "0.8";
|
||||||
|
location-provider = "manual";
|
||||||
|
|
||||||
|
# by default, Redshift will use the current elevation of the sun
|
||||||
|
# to determine whether it is daytime, night or in transition (dawn/dusk).
|
||||||
|
# dawn-time = "6:00-8:45";
|
||||||
|
# dusk-time = "18:35-20:15";
|
||||||
|
};
|
||||||
|
manual = {
|
||||||
|
# China, Shenzhen
|
||||||
|
lat = "22.5"; # latitude
|
||||||
|
lon = "114.1"; # longitude
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
home.file.".local/share/fcitx5/themes".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-fcitx5}/src";
|
||||||
|
|
||||||
|
xdg.configFile = {
|
||||||
|
"fcitx5/profile" = {
|
||||||
|
source = ./profile;
|
||||||
|
# every time fcitx5 switch input method, it will modify ~/.config/fcitx5/profile,
|
||||||
|
# so we need to force replace it in every rebuild to avoid file conflict.
|
||||||
|
force = true;
|
||||||
|
};
|
||||||
|
"fcitx5/conf/classicui.conf".source = ./classicui.conf;
|
||||||
|
};
|
||||||
|
|
||||||
|
i18n.inputMethod = {
|
||||||
|
enabled = "fcitx5";
|
||||||
|
fcitx5.addons = with pkgs; [
|
||||||
|
# for flypy chinese input method
|
||||||
|
fcitx5-rime
|
||||||
|
# needed enable rime using configtool after installed
|
||||||
|
fcitx5-configtool
|
||||||
|
fcitx5-chinese-addons
|
||||||
|
# fcitx5-mozc # japanese input method
|
||||||
|
fcitx5-gtk # gtk im module
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# If your themes for mouse cursor, icons or windows don’t load correctly,
|
||||||
|
# try setting them with home.pointerCursor and gtk.theme,
|
||||||
|
# which enable a bunch of compatibility options that should make the themes load in all situations.
|
||||||
|
|
||||||
|
home.pointerCursor = {
|
||||||
|
gtk.enable = true;
|
||||||
|
x11.enable = true;
|
||||||
|
package = pkgs.bibata-cursors;
|
||||||
|
name = "Bibata-Modern-Ice";
|
||||||
|
size = 24;
|
||||||
|
};
|
||||||
|
|
||||||
|
# set dpi for 4k monitor
|
||||||
|
xresources.properties = {
|
||||||
|
# dpi for Xorg's font
|
||||||
|
"Xft.dpi" = 150;
|
||||||
|
# or set a generic dpi
|
||||||
|
"*.dpi" = 150;
|
||||||
|
};
|
||||||
|
|
||||||
|
# gtk's theme settings, generate files:
|
||||||
|
# 1. ~/.gtkrc-2.0
|
||||||
|
# 2. ~/.config/gtk-3.0/settings.ini
|
||||||
|
# 3. ~/.config/gtk-4.0/settings.ini
|
||||||
|
gtk = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
font = {
|
||||||
|
name = "Noto Sans";
|
||||||
|
package = pkgs.noto-fonts;
|
||||||
|
size = 11;
|
||||||
|
};
|
||||||
|
|
||||||
|
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
|
||||||
|
|
||||||
|
iconTheme = {
|
||||||
|
name = "Papirus-Dark";
|
||||||
|
package = pkgs.papirus-icon-theme;
|
||||||
|
};
|
||||||
|
|
||||||
|
theme = {
|
||||||
|
# https://github.com/catppuccin/gtk
|
||||||
|
name = "Catppuccin-Macchiato-Compact-Pink-dark";
|
||||||
|
package = pkgs.catppuccin-gtk.override {
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix
|
||||||
|
accents = ["pink"];
|
||||||
|
size = "compact";
|
||||||
|
variant = "mocha";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
##############################################################################################
|
##############################################################################################
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.home.immutable-file;
|
cfg = config.home.immutable-file;
|
||||||
immutableFileOpts = {...}: {
|
immutableFileOpts = _: {
|
||||||
options = {
|
options = {
|
||||||
src = mkOption {
|
src = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
catppuccin-cava,
|
pkgs-unstable,
|
||||||
|
nur-ryan4yin,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# media - control and enjoy audio/video
|
# media - control and enjoy audio/video
|
||||||
@@ -23,9 +24,11 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
# https://github.com/catppuccin/cava
|
# https://github.com/catppuccin/cava
|
||||||
home.file.".config/cava/config".text = ''
|
xdg.configFile."cava/config".text =
|
||||||
|
''
|
||||||
# custom cava config
|
# custom cava config
|
||||||
'' + builtins.readFile "${catppuccin-cava}/mocha.cava";
|
''
|
||||||
|
+ builtins.readFile "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-cava}/mocha.cava";
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
mpv = {
|
mpv = {
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
{pkgs, ...}: {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
# GUI apps
|
||||||
|
# e-book viewer(.epub/.mobi/...)
|
||||||
|
# do not support .pdf
|
||||||
|
foliate
|
||||||
|
|
||||||
|
# instant messaging
|
||||||
|
telegram-desktop
|
||||||
|
discord
|
||||||
|
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
|
||||||
|
|
||||||
|
# remote desktop(rdp connect)
|
||||||
|
remmina
|
||||||
|
freerdp # required by remmina
|
||||||
|
|
||||||
|
# misc
|
||||||
|
flameshot
|
||||||
|
ventoy # multi-boot usb creator
|
||||||
|
];
|
||||||
|
|
||||||
|
# GitHub CLI tool
|
||||||
|
programs.gh = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
wallpapers,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
systemd.user.services.wallpaper = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Wallpaper Switcher daemon";
|
||||||
|
After = ["graphical-session-pre.target" "xdg-desktop-autostart.target"];
|
||||||
|
Wants = ["graphical-session-pre.target"];
|
||||||
|
};
|
||||||
|
Install.WantedBy = ["graphical-session.target"];
|
||||||
|
Service = {
|
||||||
|
ExecStart = lib.getExe (pkgs.writeShellApplication {
|
||||||
|
name = "wallpaper";
|
||||||
|
runtimeInputs = with pkgs; [procps feh swaybg python3];
|
||||||
|
text = ''
|
||||||
|
export WALLPAPERS_DIR="${wallpapers}"
|
||||||
|
export WALLPAPERS_STATE_FILEPATH="${config.xdg.stateHome}/wallpaper-switcher/switcher_state"
|
||||||
|
export WALLPAPER_WAIT_MIN=10
|
||||||
|
export WALLPAPER_WAIT_MAX=20
|
||||||
|
exec ${./wallpaper-switcher.py}
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
RestartSec = 3;
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
"""
|
||||||
|
This script will randomly select a wallpaper from the wallpapers directory.
|
||||||
|
It will skip the last wallpaper used, so that you don't get the same wallpaper.
|
||||||
|
|
||||||
|
It will also set the wallpaper using `feh` for X11, or `swaybg` for Wayland.
|
||||||
|
|
||||||
|
Maintainer: ryan4yin [xiaoyin_c@qq.com]
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import random
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Union
|
||||||
|
import subprocess
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class WallpaperSwitcher:
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
wait_min,
|
||||||
|
wait_max,
|
||||||
|
wallpapers_dir: Path,
|
||||||
|
state_filepath: Path,
|
||||||
|
image_extensions: Union[tuple, list],
|
||||||
|
) -> None:
|
||||||
|
self.wallpapers_dir = wallpapers_dir
|
||||||
|
self.image_extensions = image_extensions
|
||||||
|
self.state_filepath = state_filepath
|
||||||
|
self.wait_min = wait_min
|
||||||
|
self.wait_max = wait_max
|
||||||
|
|
||||||
|
# initialize the state file
|
||||||
|
self.state_filepath.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
self.current_state = self.state_filepath.open("a+", encoding="utf-8")
|
||||||
|
self.current_wallpaper_list = list()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""
|
||||||
|
Iterate on all wallpapers in the wallpapers directory, cycling through them in a random order.
|
||||||
|
"""
|
||||||
|
self.initialize_state()
|
||||||
|
while True:
|
||||||
|
for i, w in enumerate(self.current_wallpaper_list):
|
||||||
|
if i < self.current_wallpaper_index:
|
||||||
|
continue
|
||||||
|
|
||||||
|
logger.info(
|
||||||
|
f"Setting wallpaper {i+1}/{len(self.current_wallpaper_list)}: {w}"
|
||||||
|
)
|
||||||
|
self.set_wallpaper(w)
|
||||||
|
|
||||||
|
# update the state
|
||||||
|
self.current_wallpaper_index = i
|
||||||
|
self.save_state()
|
||||||
|
|
||||||
|
wait_time = random.randint(self.wait_min, self.wait_max)
|
||||||
|
logger.info(f"Waiting {wait_time} seconds...")
|
||||||
|
time.sleep(wait_time)
|
||||||
|
|
||||||
|
# reset the state
|
||||||
|
self.reset_state()
|
||||||
|
|
||||||
|
def save_state(self):
|
||||||
|
wallpaper_list = [w.as_posix() for w in self.current_wallpaper_list]
|
||||||
|
state = {
|
||||||
|
"current_wallpaper_list": wallpaper_list,
|
||||||
|
"current_wallpaper_index": self.current_wallpaper_index,
|
||||||
|
}
|
||||||
|
self.current_state.truncate(0)
|
||||||
|
self.current_state.write(json.dumps(state, indent=4))
|
||||||
|
self.current_state.flush()
|
||||||
|
|
||||||
|
def initialize_state(self):
|
||||||
|
self.current_state.seek(0)
|
||||||
|
data = self.current_state.read()
|
||||||
|
if not data:
|
||||||
|
logger.info("No state found, resetting...")
|
||||||
|
self.reset_state()
|
||||||
|
else:
|
||||||
|
logger.info("State found, reloading...")
|
||||||
|
state = json.loads(data)
|
||||||
|
wallpapers = [Path(w) for w in state["current_wallpaper_list"]]
|
||||||
|
self.current_wallpaper_list = wallpapers
|
||||||
|
self.current_wallpaper_index = state["current_wallpaper_index"]
|
||||||
|
|
||||||
|
def reset_state(self):
|
||||||
|
logger.info(f"Rescanning & shuffle wallpapers in {self.wallpapers_dir} ...")
|
||||||
|
wallpapers = list(
|
||||||
|
filter(
|
||||||
|
lambda x: x.suffix in self.image_extensions,
|
||||||
|
self.wallpapers_dir.iterdir(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
random.shuffle(wallpapers)
|
||||||
|
self.current_wallpaper_list = wallpapers
|
||||||
|
self.current_wallpaper_index = 0
|
||||||
|
|
||||||
|
def set_wallpaper(self, path: Path):
|
||||||
|
# check if we are running under x11 or wayland
|
||||||
|
if (
|
||||||
|
"WAYLAND_DISPLAY" in os.environ
|
||||||
|
or os.environ.get("XDG_SESSION_TYPE") == "wayland"
|
||||||
|
):
|
||||||
|
self.set_wallpaper_wayland(path)
|
||||||
|
else:
|
||||||
|
self.set_wallpaper_x11(path)
|
||||||
|
|
||||||
|
def set_wallpaper_x11(self, path: Path):
|
||||||
|
subprocess.run(["feh", "--bg-fill", path])
|
||||||
|
|
||||||
|
def set_wallpaper_wayland(self, path: Path):
|
||||||
|
# find all swaybg processes
|
||||||
|
swaybg_pids = subprocess.run(
|
||||||
|
["pgrep", "-f", "swaybg"], stdout=subprocess.PIPE
|
||||||
|
).stdout.decode("utf-8")
|
||||||
|
|
||||||
|
# run swaybg in the background, and make it running even after the parent process exits
|
||||||
|
subprocess.Popen(
|
||||||
|
["swaybg", "--output", "*", "--mode", "fill", "--image", path],
|
||||||
|
start_new_session=True,
|
||||||
|
)
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
# kill all old swaybg processes
|
||||||
|
for pid in swaybg_pids.splitlines():
|
||||||
|
try:
|
||||||
|
os.kill(int(pid), 9)
|
||||||
|
except ProcessLookupError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
wallpapers_dir = os.getenv("WALLPAPERS_DIR")
|
||||||
|
state_filepath = os.getenv("WALLPAPERS_STATE_FILEPATH")
|
||||||
|
if not wallpapers_dir:
|
||||||
|
raise Exception("WALLPAPERS_DIR not set")
|
||||||
|
if not state_filepath:
|
||||||
|
raise Exception("WALLPAPERS_STATE_FILEPATH not set")
|
||||||
|
|
||||||
|
image_postfix = (
|
||||||
|
".jpg",
|
||||||
|
".jpeg",
|
||||||
|
".png",
|
||||||
|
# ".gif",
|
||||||
|
# ".webp"
|
||||||
|
)
|
||||||
|
wait_min = int(os.getenv("WALLPAPER_WAIT_MIN", 60))
|
||||||
|
wait_max = int(os.getenv("WALLPAPER_WAIT_MAX", 300))
|
||||||
|
wallpaper_switcher = WallpaperSwitcher(
|
||||||
|
wait_min,
|
||||||
|
wait_max,
|
||||||
|
Path(wallpapers_dir).expanduser(),
|
||||||
|
Path(state_filepath).expanduser(),
|
||||||
|
image_postfix,
|
||||||
|
)
|
||||||
|
wallpaper_switcher.run()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -12,9 +12,14 @@
|
|||||||
xdg-user-dirs
|
xdg-user-dirs
|
||||||
];
|
];
|
||||||
|
|
||||||
|
xdg.configFile."mimeapps.list".force = true;
|
||||||
xdg = {
|
xdg = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cacheHome = config.home.homeDirectory + "/.local/cache";
|
|
||||||
|
cacheHome = "${config.home.homeDirectory}/.cache";
|
||||||
|
configHome = "${config.home.homeDirectory}/.config";
|
||||||
|
dataHome = "${config.home.homeDirectory}/.local/share";
|
||||||
|
stateHome = "${config.home.homeDirectory}/.local/state";
|
||||||
|
|
||||||
# manage $XDG_CONFIG_HOME/mimeapps.list
|
# manage $XDG_CONFIG_HOME/mimeapps.list
|
||||||
# xdg search all desktop entries from $XDG_DATA_DIRS, check it by command:
|
# xdg search all desktop entries from $XDG_DATA_DIRS, check it by command:
|
||||||
@@ -51,7 +56,7 @@
|
|||||||
"x-scheme-handler/unknown" = browser;
|
"x-scheme-handler/unknown" = browser;
|
||||||
|
|
||||||
"x-scheme-handler/discord" = ["discord.desktop"];
|
"x-scheme-handler/discord" = ["discord.desktop"];
|
||||||
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
|
"x-scheme-handler/tg" = ["org.telegram.desktop.desktop "];
|
||||||
|
|
||||||
"audio/*" = ["mpv.desktop"];
|
"audio/*" = ["mpv.desktop"];
|
||||||
"video/*" = ["mpv.dekstop"];
|
"video/*" = ["mpv.dekstop"];
|
||||||
@@ -62,8 +67,7 @@
|
|||||||
"image/webp" = ["imv.desktop"];
|
"image/webp" = ["imv.desktop"];
|
||||||
};
|
};
|
||||||
|
|
||||||
associations.removed =
|
associations.removed = {
|
||||||
{
|
|
||||||
# ......
|
# ......
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{pkgs, ...}: {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
# creative
|
|
||||||
# blender # 3d modeling
|
|
||||||
# gimp # image editing, I prefer using figma in browser instead of this one
|
|
||||||
inkscape # vector graphics
|
|
||||||
krita # digital painting
|
|
||||||
musescore # music notation
|
|
||||||
reaper # audio production
|
|
||||||
|
|
||||||
# this app consumes a lot of storage, so do not install it currently
|
|
||||||
# kicad # 3d printing, eletrical engineering
|
|
||||||
];
|
|
||||||
|
|
||||||
programs = {
|
|
||||||
# live streaming
|
|
||||||
obs-studio.enable = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,37 +1,3 @@
|
|||||||
{pkgs, ...}: {
|
{mylib, ...}: {
|
||||||
imports = [
|
imports = mylib.scanPaths ./.;
|
||||||
./creative.nix
|
|
||||||
./immutable-file.nix
|
|
||||||
./media.nix
|
|
||||||
./ssh.nix
|
|
||||||
./wallpaper.nix
|
|
||||||
./xdg.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
# GUI apps
|
|
||||||
insomnia # REST client
|
|
||||||
wireshark # network analyzer
|
|
||||||
|
|
||||||
# e-book viewer(.epub/.mobi/...)
|
|
||||||
# do not support .pdf
|
|
||||||
foliate
|
|
||||||
|
|
||||||
# instant messaging
|
|
||||||
telegram-desktop
|
|
||||||
discord
|
|
||||||
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
|
|
||||||
|
|
||||||
# remote desktop(rdp connect)
|
|
||||||
remmina
|
|
||||||
freerdp # required by remmina
|
|
||||||
|
|
||||||
# misc
|
|
||||||
flameshot
|
|
||||||
];
|
|
||||||
|
|
||||||
# GitHub CLI tool
|
|
||||||
programs.gh = {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,3 @@
|
|||||||
## Hyprland configuration file
|
|
||||||
|
|
||||||
# color-scheme: cappuccin-mocha
|
|
||||||
source=~/.config/hypr/themes/mocha.conf
|
|
||||||
|
|
||||||
#-- Output ----------------------------------------------------
|
|
||||||
# Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info.
|
|
||||||
|
|
||||||
# format:
|
|
||||||
# monitor=name,resolution,position,scale
|
|
||||||
monitor=DP-2,3840x2160@144,0x0,1.6
|
|
||||||
workspace=DP-2,1
|
|
||||||
|
|
||||||
#-- Input ----------------------------------------------------
|
#-- Input ----------------------------------------------------
|
||||||
# Configure mouse and touchpad here.
|
# Configure mouse and touchpad here.
|
||||||
input {
|
input {
|
||||||
@@ -45,16 +32,17 @@ general {
|
|||||||
# Decoration settings like Rounded Corners, Opacity, Blur, etc.
|
# Decoration settings like Rounded Corners, Opacity, Blur, etc.
|
||||||
decoration {
|
decoration {
|
||||||
rounding=8 # Original: rounding=-1
|
rounding=8 # Original: rounding=-1
|
||||||
multisample_edges=0
|
|
||||||
|
|
||||||
active_opacity=1.0
|
active_opacity=1.0
|
||||||
inactive_opacity=0.9
|
inactive_opacity=0.9
|
||||||
fullscreen_opacity=1.0
|
fullscreen_opacity=1.0
|
||||||
|
|
||||||
blur=0
|
blur {
|
||||||
blur_size=3 # minimum 1
|
enabled=true
|
||||||
blur_passes=1 # minimum 1, more passes = more resource intensive.
|
size=3 # minimum 1
|
||||||
blur_ignore_opacity=0
|
passes=1 # minimum 1, more passes = more resource intensive.
|
||||||
|
ignore_opacity=false
|
||||||
|
}
|
||||||
|
|
||||||
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
|
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
|
||||||
# if you want heavy blur, you need to up the blur_passes.
|
# if you want heavy blur, you need to up the blur_passes.
|
||||||
@@ -103,13 +91,12 @@ $lockscreen = ~/.config/hypr/scripts/lockscreen
|
|||||||
$wlogout = ~/.config/hypr/scripts/wlogout
|
$wlogout = ~/.config/hypr/scripts/wlogout
|
||||||
$colorpicker = ~/.config/hypr/scripts/colorpicker
|
$colorpicker = ~/.config/hypr/scripts/colorpicker
|
||||||
$files = thunar
|
$files = thunar
|
||||||
$editor = code # vscode
|
|
||||||
$browser = firefox
|
$browser = firefox
|
||||||
|
|
||||||
# -- Terminal --
|
# -- Terminal --
|
||||||
bind=SUPER,Return,exec,$term
|
bind=SUPER,Return,exec,$term
|
||||||
|
|
||||||
# -- Wofi --
|
# -- App Launcher --
|
||||||
bind=SUPER,D,exec,$app_launcher
|
bind=SUPER,D,exec,$app_launcher
|
||||||
|
|
||||||
# -- Hyprland --
|
# -- Hyprland --
|
||||||
@@ -194,21 +181,14 @@ bind=SUPER,mouse_up,workspace,e-1
|
|||||||
#-- Startup ----------------------------------------------------
|
#-- Startup ----------------------------------------------------
|
||||||
exec-once=~/.config/hypr/scripts/startup
|
exec-once=~/.config/hypr/scripts/startup
|
||||||
|
|
||||||
|
# -- Fcitx5 input method
|
||||||
#-- Fcitx5 input method ----------------------------------------------------
|
|
||||||
windowrule=pseudo,fcitx # enable this will make fcitx5 works, but fcitx5-configtool will not work!
|
windowrule=pseudo,fcitx # enable this will make fcitx5 works, but fcitx5-configtool will not work!
|
||||||
exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore fcitx5 profile manged by nixos
|
exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore fcitx5 profile managed by nixos
|
||||||
exec-once=fcitx5 -d --replace # start fcitx5 daemon
|
exec-once=fcitx5 -d --replace # start fcitx5 daemon
|
||||||
bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r
|
bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r
|
||||||
|
|
||||||
|
# fix xwayland apps
|
||||||
|
windowrulev2 = rounding 0, xwayland:1, floating:1
|
||||||
|
windowrulev2 = center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$
|
||||||
|
windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$
|
||||||
|
|
||||||
# -- Fix input method in vscode
|
|
||||||
exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24
|
|
||||||
# 效果是 wayland 原生窗口缩放完全正常
|
|
||||||
# xwayland 窗口先渲染到 200% 再降到 hyprland config 里 monitor 设置的值,看上去和原生没啥区别
|
|
||||||
# 相比较一开始的方案输入法字体大小也正确了.唯一有点问题的可能是 xwayland 窗口下的鼠标指针大小不对
|
|
||||||
exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
|
|
||||||
exec-once = xrdb -merge ~/.Xresources
|
|
||||||
# env = GDK_SCALE,2
|
|
||||||
env = XCURSOR_SIZE,48
|
|
||||||
env = XCURSOR_THEME,"Bibata-Modern-Ice"
|
|
||||||
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if [[ ! $(pidof anyrun) ]]; then
|
||||||
|
anyrun
|
||||||
|
else
|
||||||
|
pkill anyrun
|
||||||
|
fi
|
||||||