Compare commits
515 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 | |||
| 721e74845a | |||
| 349ff8b5a1 | |||
| 4cf9b16faf | |||
| 8fc95549bf | |||
| f2dbaba802 | |||
| 538c81ca47 | |||
| 32161dd090 | |||
| a310ab4d4a | |||
| bc290e371b | |||
| b407453836 | |||
| 6ff9c397c8 | |||
| 033d50c738 | |||
| 7dc223a77e | |||
| c472654934 | |||
| 189a3a4689 | |||
| 1f0040a9dd | |||
| 5d8615cdb0 | |||
| 2f96ab5464 | |||
| c8bd133e49 | |||
| 5778d72dd4 | |||
| 01285af535 | |||
| e1cd93d6d1 | |||
| 714c45f5f9 | |||
| 87df015862 | |||
| c09091fa25 | |||
| 8b4a0a7055 | |||
| 78319f4ef6 | |||
| f66e73c5a6 | |||
| cf9d5acd95 | |||
| 98fed47741 | |||
| ed57391eb0 | |||
| fc4a44c023 | |||
| c158f17c63 | |||
| e61bd9ae14 | |||
| 4f6b899643 | |||
| 5d2cf3e5dd | |||
| befddfe476 | |||
| 204cb03922 | |||
| eebbb9f5e6 | |||
| ad76bb3451 | |||
| 0564357a9c | |||
| b44672d16c | |||
| 1164bebee4 | |||
| 29129215a5 | |||
| bc08dc1949 | |||
| 6e825eef7f | |||
| 6ae4d4ba80 | |||
| c34911ba26 | |||
| 82819ff091 | |||
| 12ef055135 | |||
| 5beb15c165 | |||
| cf6584ea71 | |||
| 3bbe86cb55 | |||
| 18c6e79d0c | |||
| 6fbefd0a67 | |||
| d502490bf6 | |||
| 3f6b5b321a | |||
| 2d06846467 | |||
| baac168826 | |||
| 78e5053ae5 | |||
| 25ac706450 | |||
| edff2bdc6c | |||
| 337f67109e | |||
| 450389400a | |||
| f52d604d42 | |||
| d12e3b979a | |||
| 7b482f8cfa | |||
| de1bc12b1b | |||
| a6fb453c9e | |||
| 32429619ab | |||
| cc6e5ea071 | |||
| ba29d32d80 | |||
| 0f08976902 | |||
| b3ac7784ca | |||
| b271e43df4 | |||
| 3dff682ceb | |||
| 8d05c3a204 | |||
| 887825d254 | |||
| 8061e07a00 | |||
| fa1cf24af5 | |||
| 1ab318b6db | |||
| 59493d03fa | |||
| c06504032c | |||
| cf80c7549e | |||
| e6b7e24a36 | |||
| 1b5a415d7a | |||
| 95d9cd0a27 | |||
| cca05de49b | |||
| fa9f23751c | |||
| cf33721ec1 | |||
| 52c72bd45d | |||
| c6e736d64b | |||
| c90d1c0208 | |||
| 5ed0ece058 | |||
| 8684376b98 | |||
| 03cee6582f | |||
| 86291af053 | |||
| 54bb672d9e | |||
| f34bf79884 | |||
| db9ebd5ffd | |||
| 64e384c18a | |||
| 1e325739b1 | |||
| 2bf5d295d4 | |||
| 040d8a210c | |||
| df63bce926 | |||
| b5707d8457 | |||
| cd4ed3679c | |||
| 55b6aadf00 | |||
| 849ecfd6b7 | |||
| ca60e962f0 | |||
| 7bf52e7a75 | |||
| 872caa0407 | |||
| 580a08841f | |||
| ff6442e588 | |||
| 271846703f | |||
| 298affd460 | |||
| d718c8084a | |||
| 39d35091d6 | |||
| cf9b184c9f | |||
| 4abe5d7b8d | |||
| 54ebad9151 | |||
| 3234d0db2e | |||
| c9b5a1d39b | |||
| fc8d43982b | |||
| c4a47b9e53 | |||
| 34182f3e45 | |||
| 87de22fec4 | |||
| 787010ac34 | |||
| 874a1ab939 | |||
| 95df12c59e | |||
| 25c0938a64 | |||
| 5731b52d3c | |||
| c7d88c1f57 | |||
| 678016e391 | |||
| e14d6f8405 | |||
| 588cbabbc2 | |||
| 7cc49c29f1 | |||
| 21b3d4ad37 | |||
| b6629a38a1 | |||
| a88afaaab3 | |||
| 2acda6e977 | |||
| d1dd9bfdd6 | |||
| 027d819860 | |||
| 7e02cc8566 | |||
| bacc1bf9cd | |||
| 6e7815ce22 | |||
| 0193f84847 | |||
| bb2c967981 | |||
| 8d24a094bf | |||
| cb0dc30c7e | |||
| 190d409992 | |||
| acd7f8308c | |||
| 4af3fa88dd | |||
| e90d2eca1e | |||
| 462f671a76 | |||
| 5d2371dda4 | |||
| 379032a40b | |||
| 65b5146dcb | |||
| 4c53b59e89 | |||
| 9bd5cac675 | |||
| 2e65d0aa03 | |||
| afc74dcf68 | |||
| e7e3d0040a | |||
| 14c174890e | |||
| dd472488b6 | |||
| ec4d00509e | |||
| aa0c789b6e | |||
| 016115faa5 | |||
| f6ade7c612 | |||
| 0bfd154437 | |||
| 9a752121ba | |||
| 3ea707245b | |||
| e31ae3f553 | |||
| c38db38207 | |||
| 6b364e19de | |||
| dae0504f5c | |||
| d53ed4ef7e | |||
| 530f8498a1 | |||
| ef3c903582 | |||
| 8314b91324 | |||
| ccd4752d04 | |||
| 1bfeeacf2f | |||
| bfac95b71e | |||
| b91508af5f | |||
| e51486a796 | |||
| 897af2712f | |||
| ed5b4d121c | |||
| 45a7973553 | |||
| a5f0922ba7 | |||
| 792a7e7bfc | |||
| 8f512eb0bd | |||
| 4936c0c46e | |||
| fe54e220e4 | |||
| 0c5b01b5f0 | |||
| 0024dff048 | |||
| 7c42d4d950 | |||
| dc0fc97cb9 | |||
| 86114a4db1 | |||
| 24ef3ed105 | |||
| be437c3417 | |||
| e2e75407c9 | |||
| b99f77e0de | |||
| 909409ff29 | |||
| 408d7dfd95 | |||
| de1d6fbf4c | |||
| e499f0ee37 | |||
| 0e194466d4 | |||
| 5da21ce346 | |||
| 0b4e365ce9 | |||
| 2ebbe3ae09 | |||
| 2a8a0d1c62 | |||
| a42c8f0aeb | |||
| f083f74825 | |||
| 4e0774e5d8 | |||
| 6582721050 | |||
| 609c9e53ff | |||
| 3a141b62df | |||
| 2865241acd | |||
| c6834707f0 | |||
| ef16db0bcd | |||
| b3b2136579 | |||
| dc2d5f1c6a | |||
| c935031234 | |||
| 0a16aa1b32 | |||
| ec485779ce | |||
| 1a474ec960 | |||
| e6b57d9d11 | |||
| 11fb1932ac | |||
| c224f9c773 | |||
| 86f3503245 | |||
| 7d99fab205 | |||
| d38bc4ff38 | |||
| d04f4109f2 | |||
| 0d53bea851 | |||
| dd2040568d | |||
| 89d8acd8eb | |||
| 3f24fa464d | |||
| 5b99c2ceca | |||
| df8a7e68e1 | |||
| 058031ad29 | |||
| a622057fb4 | |||
| 20ce65210b | |||
| 203edbffea | |||
| 226a3a2596 | |||
| 4f79b64f11 | |||
| 443d15e03b | |||
| 35b2b3f8be | |||
| f4428b9b23 | |||
| 814c29f72b | |||
| 5fd4a788df | |||
| 7f5cc5be23 | |||
| 3d93f5e624 | |||
| 967b408e41 | |||
| a81cfaf9fe | |||
| f971ec030d | |||
| ab11958597 | |||
| 6707783d0a | |||
| 9ec7a76e02 | |||
| 5a6bfc9e60 | |||
| be5f2338f6 | |||
| a880b9b20d | |||
| fedcf1bafd | |||
| c694c81215 | |||
| 5503e7bac0 | |||
| 7c7591e167 | |||
| d86aae96ff | |||
| ab1ecc49ed | |||
| 2baeb2e284 | |||
| 2c3df9ba1e | |||
| 4511f834af | |||
| 89653cabe4 | |||
| 4959da0b7e | |||
| 14f4ef912a | |||
| 08ffdb556e | |||
| 58d4005e4f | |||
| a2daad2719 | |||
| 4adbc39dc4 | |||
| 6710f34e50 | |||
| 32d6353cdc | |||
| 613e763f8b | |||
| bf762454c0 | |||
| d232f4a063 | |||
| 63471d7d80 | |||
| dcde7ff162 | |||
| 587d29656c | |||
| 2d60de8c72 | |||
| 8ae561fd0c | |||
| 7aaf208007 | |||
| 3d310ae45c | |||
| 79a8e9d293 | |||
| 848c6fbca2 | |||
| a862e0a55d | |||
| 0517d0e8df | |||
| ed27505556 | |||
| d8a4bde357 | |||
| e05f4bec8f | |||
| 373348e406 | |||
| 47a7828bc7 | |||
| abb7c84675 | |||
| 42c24dbb6f | |||
| 1237c68b8f | |||
| c0b1c5cba1 | |||
| 188607b2ae | |||
| 26252cf448 | |||
| daa9fe00b2 | |||
| 05dbbe4a64 | |||
| 79ff9977b9 | |||
| 5ca09cf75c | |||
| 78e620001f | |||
| 1b9801c15a | |||
| ffd4313dec | |||
| ad5f3da45f | |||
| 129302ac26 | |||
| be47ea74cd | |||
| f1c20d68f9 | |||
| 0716174fb7 | |||
| b25b6a48e2 | |||
| 162399ad8a | |||
| 79c424e08e | |||
| 381f0c5123 | |||
| e83aec85f1 | |||
| 1235f08891 | |||
| ed7ebb0802 | |||
| 82f0248cf6 | |||
| 88faaa950c | |||
| e9e63e6d4a | |||
| b8b4d843d6 | |||
| 99e12fde04 | |||
| bb47747529 | |||
| 4f4bccbb59 | |||
| ea35e5dc49 | |||
| b50cca1ec6 | |||
| 07d13c7cc9 | |||
| 57ed18fe8b | |||
| e3a9bea779 | |||
| 65e2672a68 | |||
| 8619d9a284 | |||
| 7619f7ca41 | |||
| 90c61f0625 | |||
| 1b95d4945f | |||
| 830605aeec |
@@ -0,0 +1,2 @@
|
||||
patreon: ryan4yin
|
||||
custom: ['https://buymeacoffee.com/ryan4yin', 'https://afdian.net/a/ryan4yin']
|
||||
@@ -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/*"
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
result
|
||||
result/
|
||||
.DS_Store
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Ryan Yin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,147 @@
|
||||
#
|
||||
# NOTE: Makefile's target name should not be the same as one of the file or directory in the current directory,
|
||||
# otherwise the target will not be executed!
|
||||
#
|
||||
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# Nix commands related to the local machine
|
||||
#
|
||||
############################################################################
|
||||
|
||||
i3:
|
||||
nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo
|
||||
|
||||
hypr:
|
||||
nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo
|
||||
|
||||
i3-debug:
|
||||
nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo --show-trace --verbose
|
||||
|
||||
hypr-debug:
|
||||
nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo --show-trace --verbose
|
||||
|
||||
up:
|
||||
nix flake update
|
||||
|
||||
# Update specific input
|
||||
# usage: make upp i=wallpapers
|
||||
upp:
|
||||
nix flake lock --update-input $(i)
|
||||
|
||||
history:
|
||||
nix profile history --profile /nix/var/nix/profiles/system
|
||||
|
||||
gc:
|
||||
# remove all generations older than 7 days
|
||||
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
|
||||
|
||||
# garbage collect all unused nix store entries
|
||||
sudo nix store gc --debug
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# Darwin related commands, harmonica is my macbook pro's hostname
|
||||
#
|
||||
############################################################################
|
||||
|
||||
darwin-set-proxy:
|
||||
echo "skip setting proxy, use global proxy instead"
|
||||
# sudo python3 scripts/darwin_set_proxy.py
|
||||
|
||||
ha: darwin-set-proxy
|
||||
nix build .#darwinConfigurations.harmonica.system
|
||||
./result/sw/bin/darwin-rebuild switch --flake .
|
||||
sleep 3
|
||||
sudo chmod 644 /etc/agenix/alias-for-work.*
|
||||
|
||||
ha-debug: darwin-set-proxy
|
||||
nix build .#darwinConfigurations.harmonica.system --show-trace --verbose
|
||||
./result/sw/bin/darwin-rebuild switch --flake .#harmonica --show-trace --verbose
|
||||
sleep 3
|
||||
sudo chmod 644 /etc/agenix/alias-for-work.*
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# Idols, Commands related to my remote distributed building cluster
|
||||
#
|
||||
############################################################################
|
||||
|
||||
add-idols-ssh-key:
|
||||
ssh-add ~/.ssh/ai-idols
|
||||
|
||||
idols: add-idols-ssh-key
|
||||
colmena apply --on '@dist-build'
|
||||
|
||||
aqua:
|
||||
colmena apply --on '@aqua'
|
||||
|
||||
ruby:
|
||||
colmena apply --on '@ruby'
|
||||
|
||||
kana:
|
||||
colmena apply --on '@kana'
|
||||
|
||||
idols-debug: add-idols-ssh-key
|
||||
colmena apply --on '@dist-build' --verbose --show-trace
|
||||
|
||||
# only used once to setup the virtual machines
|
||||
idols-image:
|
||||
# take image for idols, and upload the image to proxmox nodes.
|
||||
nom build .#aquamarine
|
||||
scp result root@gtr5:/var/lib/vz/dump/vzdump-qemu-aquamarine.vma.zst
|
||||
|
||||
nom build .#ruby
|
||||
scp result root@s500plus:/var/lib/vz/dump/vzdump-qemu-ruby.vma.zst
|
||||
|
||||
nom build .#kana
|
||||
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
|
||||
#
|
||||
############################################################################
|
||||
|
||||
fmt:
|
||||
# format the nix files in this repo
|
||||
nix fmt
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf result
|
||||
@@ -1,28 +1,200 @@
|
||||
# Nix Configuration
|
||||
<h2 align="center">:snowflake: Ryan4Yin's Nix Config :snowflake:</h2>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/palette/macchiato.png" width="400" />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/ryan4yin/nix-config/stargazers">
|
||||
<img alt="Stargazers" src="https://img.shields.io/github/stars/ryan4yin/nix-config?style=for-the-badge&logo=starship&color=C9CBFF&logoColor=D9E0EE&labelColor=302D41"></a>
|
||||
<a href="https://nixos.org/">
|
||||
<img src="https://img.shields.io/badge/NixOS-23.05-informational.svg?style=for-the-badge&logo=nixos&color=F2CDCD&logoColor=D9E0EE&labelColor=302D41"></a>
|
||||
<a href="https://github.com/ryan4yin/nixos-and-flakes-book">
|
||||
<img src="https://img.shields.io/static/v1?label=Nix Flakes&message=learning&style=for-the-badge&logo=nixos&color=DDB6F2&logoColor=D9E0EE&labelColor=302D41"></a>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
This repository is home to the nix code that builds my systems.
|
||||
|
||||
|
||||
## TODO
|
||||
|
||||
- vscode extensions - [nix-vscode-extensions](https://github.com/nix-community/nix-vscode-extensions)
|
||||
- secret management - [sops-nix](https://github.com/Mic92/sops-nix)
|
||||
- switch from i3wm to hyprland
|
||||
- i3wm: old and stable, only support X11
|
||||
- sway: compatible with i3wm, support Wayland. do not support Nvidia GPU officially.
|
||||
- [hyprland](https://wiki.hyprland.org/Nix/Hyprland-on-NixOS/): project starts from 2022, support Wayland, envolving fast, good looking, support Nvidia GPU.
|
||||
|
||||
|
||||
## Why Nix?
|
||||
|
||||
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 forever. If someone else shares their configuration, anyone can make use of it.
|
||||
|
||||
**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)!**
|
||||
|
||||
## How to install Nix and Deploy this Flake?
|
||||
> 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.
|
||||
|
||||
After installed NixOS with `nix-command` & `flake` enabled, you can deploy this flake with the following command:
|
||||
## Components
|
||||
|
||||
| | NixOS(Wayland) | NixOS(Xorg) |
|
||||
| --------------------------- | :---------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- |
|
||||
| **Window Manager** | [Hyprland][Hyprland] | [i3][i3] |
|
||||
| **Terminal Emulator** | [Kitty][Kitty] | [Kitty][Kitty] |
|
||||
| **Bar** | [Waybar][Waybar] | [i3block][i3block] |
|
||||
| **Application Launcher** | [anyrun][anyrun] | [rofi][rofi] |
|
||||
| **Notification Daemon** | [Mako][Mako] | [Dunst][Dunst] |
|
||||
| **Display Manager** | [GDM][GDM] | [GDM][GDM] |
|
||||
| **Color Scheme** | [Catppuccin][Catppuccin] | [Catppuccin][Catppuccin] |
|
||||
| **network management tool** | [NetworkManager][NetworkManager] | [NetworkManager][NetworkManager] |
|
||||
| **Input method framework** | [Fcitx5][Fcitx5] | [Fcitx5][Fcitx5] |
|
||||
| **System resource monitor** | [Btop][Btop] | [Btop][Btop] |
|
||||
| **File Manager** | [ranger][ranger] + [thunar][thunar] | [ranger][ranger] + [thunar][thunar] |
|
||||
| **Shell** | [Nushell][Nushell] + [Starship][Starship] | [Nushell][Nushell] + [Starship][Starship] |
|
||||
| **Music Player** | [mpd][mpd], [ncmpcpp][ncmpcpp], [mpc][mpc], [Netease-cloud-music-gtk][netease-cloud-music-gtk] | [Netease-cloud-music-gtk][netease-cloud-music-gtk] |
|
||||
| **Media Player** | [mpv][mpv] | [mpv][mpv] |
|
||||
| **Text Editor** | [Neovim][Neovim] | [Neovim][Neovim] |
|
||||
| **Fonts** | [Nerd fonts][Nerd fonts] | [Nerd fonts][Nerd fonts] |
|
||||
| **Image Viewer** | [imv][imv] | [imv][imv] |
|
||||
| **Screenshot Software** | [grim][grim] | [flameshot](https://github.com/flameshot-org/flameshot) |
|
||||
| **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
|
||||
|
||||
## Hyprland + AstroNvim
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## I3 + AstroNvim
|
||||
|
||||

|
||||

|
||||
|
||||
## Neovim
|
||||
|
||||
See [./home/base/desktop/neovim](./home/base/desktop/neovim) for details.
|
||||
|
||||
## Hosts
|
||||
|
||||
See [./hosts](./hosts) for details.
|
||||
|
||||
## Secrets Management
|
||||
|
||||
See [./secrets](./secrets) for details.
|
||||
|
||||
## 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), [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.
|
||||
|
||||
For MacOS:
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch .#nixos-test
|
||||
# deploy the darwin configuration(harmonicia)
|
||||
make ha
|
||||
|
||||
# deploy with details
|
||||
make ha-debug
|
||||
```
|
||||
|
||||
For NixOS:
|
||||
|
||||
> Need to restart the machine when switching between `wayland` and `xorg`.
|
||||
|
||||
```bash
|
||||
# deploy one of the configuration based on the hostname
|
||||
sudo nixos-rebuild switch --flake .#ai_i3
|
||||
# sudo nixos-rebuild switch --flake .#ai_hyprland
|
||||
|
||||
# we can also deploy using `make`, which is defined in Makefile
|
||||
make i3 # deploy my pc with i3 window manager
|
||||
# make hypr # deploy my pc with hyprland compositor
|
||||
|
||||
# or we can deploy with details
|
||||
make i3-debug
|
||||
# make hypr-debug
|
||||
```
|
||||
|
||||
To deploy this flake from NixOS's official ISO image(purest installation method), please refer to [ryan4yin/nix-config/nixos-install](https://github.com/ryan4yin/nix-config/tree/nixos-install)
|
||||
|
||||
## How to create & managage VM from this flake?
|
||||
|
||||
use `aquamarine` as an example, we can create a virtual machine with the following command:
|
||||
|
||||
```shell
|
||||
# 1. generate a proxmox vma image file
|
||||
nom build .#aquamarine # `nom`(nix-output-monitor) can be replaced by the standard command `nix`
|
||||
|
||||
# 2. upload the genereated image to proxmox server's backup directory `/var/lib/vz/dump`
|
||||
# please replace the vma file name with the one you generated in step 1.
|
||||
scp result/vzdump-qemu-aquamarine-nixos-23.11.20230603.dd49825.vma.zst root@192.168.5.174:/var/lib/vz/dump
|
||||
|
||||
# 3. the image we uploaded will be listed in proxmox web ui's this page: [storage 'local'] -> [backups], we can restore a vm from it via the web ui now.
|
||||
```
|
||||
|
||||
Once the virtual machine `aquamarine` is created, we can deploy updates to it with the following commands:
|
||||
|
||||
```shell
|
||||
# 1. add the ssh key to ssh-agent
|
||||
ssh-add ~/.ssh/ai-idols
|
||||
|
||||
# 2. deploy the configuration to all the remote host with tag `@dist-build`
|
||||
# using the ssh key we added in step 1
|
||||
colmena apply --on '@dist-build' --show-trace
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
Other dotfiles that inspired me:
|
||||
|
||||
- Nix Flakes
|
||||
- [NixOS-CN/NixOS-CN-telegram](https://github.com/NixOS-CN/NixOS-CN-telegram)
|
||||
- [notusknot/dotfiles-nix](https://github.com/notusknot/dotfiles-nix)
|
||||
- [xddxdd/nixos-config](https://github.com/xddxdd/nixos-config)
|
||||
- [bobbbay/dotfiles](https://github.com/bobbbay/dotfiles)
|
||||
- [gytis-ivaskevicius/nixfiles](https://github.com/gytis-ivaskevicius/nixfiles)
|
||||
- [davidtwco/veritas](https://github.com/davidtwco/veritas)
|
||||
- [gvolpe/nix-config](https://github.com/gvolpe/nix-config)
|
||||
- [Ruixi-rebirth/flakes](https://github.com/Ruixi-rebirth/flakes)
|
||||
- [fufexan/dotfiles](https://github.com/fufexan/dotfiles): gtk theme, xdg, git, media, anyrun, etc.
|
||||
- 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
|
||||
- [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)
|
||||
- Neovim/AstroNvim
|
||||
- [maxbrunet/dotfiles](https://github.com/maxbrunet/dotfiles): astronvim with nix flakes.
|
||||
- Misc
|
||||
- [1amSimp1e/dots](https://github.com/1amSimp1e/dots)
|
||||
|
||||
[Hyprland]: https://github.com/hyprwm/Hyprland
|
||||
[i3]: https://github.com/i3/i3
|
||||
[Kitty]: https://github.com/kovidgoyal/kitty
|
||||
[Nushell]: https://github.com/nushell/nushell
|
||||
[Starship]: https://github.com/starship/starship
|
||||
[Waybar]: https://github.com/Alexays/Waybar
|
||||
[i3block]: https://github.com/vivien/i3blocks
|
||||
[rofi]: https://github.com/davatorium/rofi
|
||||
[anyrun]: https://github.com/Kirottu/anyrun
|
||||
[Dunst]: https://github.com/dunst-project/dunst
|
||||
[Fcitx5]: https://github.com/fcitx/fcitx5
|
||||
[Btop]: https://github.com/aristocratos/btop
|
||||
[mpv]: https://github.com/mpv-player/mpv
|
||||
[Neovim]: https://github.com/neovim/neovim
|
||||
[AstroNvim]: https://github.com/AstroNvim/AstroNvim
|
||||
[flameshot]: https://github.com/flameshot-org/flameshot
|
||||
[grim]: https://github.com/emersion/grim
|
||||
[imv]: https://sr.ht/~exec64/imv/
|
||||
[OBS]: https://obsproject.com
|
||||
[Mako]: https://github.com/emersion/mako
|
||||
[Nerd fonts]: https://github.com/ryanoasis/nerd-fonts
|
||||
[catppuccin]: https://github.com/catppuccin/catppuccin
|
||||
[mpd]: https://github.com/MusicPlayerDaemon/MPD
|
||||
[ncmpcpp]: https://github.com/ncmpcpp/ncmpcpp
|
||||
[mpc]: https://github.com/MusicPlayerDaemon/mpc
|
||||
[Netease-cloud-music-gtk]: https://github.com/gmg137/netease-cloud-music-gtk
|
||||
[NetworkManager]: https://wiki.gnome.org/Projects/NetworkManager
|
||||
[wl-clipboard]: https://github.com/bugaevc/wl-clipboard
|
||||
[GDM]: https://wiki.archlinux.org/title/GDM
|
||||
[thunar]: https://gitlab.xfce.org/xfce/thunar
|
||||
[ranger]: https://github.com/ranger/ranger
|
||||
[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: 249 KiB |
|
After Width: | Height: | Size: 450 KiB |
|
After Width: | Height: | Size: 320 KiB |
|
After Width: | Height: | Size: 359 KiB |
|
After Width: | Height: | Size: 382 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 243 KiB |
|
After Width: | Height: | Size: 232 KiB |
|
After Width: | Height: | Size: 841 KiB |
|
After Width: | Height: | Size: 362 KiB |
|
After Width: | Height: | Size: 350 KiB |
@@ -1,115 +1,429 @@
|
||||
{
|
||||
description = "NixOS configuration of Ryan Yin";
|
||||
description = "NixOS & macOS configuration of Ryan Yin";
|
||||
|
||||
# flake 为了确保够纯,它不依赖系统自身的 /etc/nix/nix.conf,而是在 flake.nix 中通过 nixConfig 设置
|
||||
# 但是为了确保安全性,flake 默认仅允许直接设置少数 nixConfig 参数,其他参数都需要在执行 nix 命令时指定 `--accept-flake-config`,否则会被忽略
|
||||
# <https://nixos.org/manual/nix/stable/command-ref/conf-file.html>
|
||||
# 如果有些包国内镜像下载不到,它仍然会走国外,这时候就得靠旁路由来解决了。
|
||||
# 临时修改默认网关为旁路由: sudo ip route add default via 192.168.5.201
|
||||
# sudo ip route del default via 192.168.5.201
|
||||
nixConfig = {
|
||||
experimental-features = [ "nix-command" "flakes" ];
|
||||
substituters = [
|
||||
# replace official cache with a mirror located in China
|
||||
"https://mirrors.bfsu.edu.cn/nix-channels/store"
|
||||
"https://cache.nixos.org/"
|
||||
];
|
||||
##################################################################################################################
|
||||
#
|
||||
# Want to know Nix in details? Looking for a beginner-friendly tutorial?
|
||||
# Check out https://github.com/ryan4yin/nixos-and-flakes-book !
|
||||
#
|
||||
##################################################################################################################
|
||||
|
||||
# nix community's cache server
|
||||
extra-substituters = [
|
||||
"https://nix-community.cachix.org"
|
||||
];
|
||||
extra-trusted-public-keys = [
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
];
|
||||
# The `outputs` function will return all the build results of the flake.
|
||||
# A flake can have many use cases and different types of outputs,
|
||||
# parameters in `outputs` are defined in `inputs` and can be referenced by their names.
|
||||
# However, `self` is an exception, this special parameter points to the `outputs` itself (self-reference)
|
||||
# The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function.
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-unstable,
|
||||
nix-darwin,
|
||||
home-manager,
|
||||
nixos-generators,
|
||||
nixos-licheepi4a,
|
||||
nixos-rk3588,
|
||||
...
|
||||
}: let
|
||||
username = "ryan";
|
||||
userfullname = "Ryan Yin";
|
||||
useremail = "xiaoyin_c@qq.com";
|
||||
|
||||
x64_system = "x86_64-linux";
|
||||
x64_darwin = "x86_64-darwin";
|
||||
riscv64_system = "riscv64-linux";
|
||||
aarch64_system = "aarch64-linux";
|
||||
allSystems = [x64_system x64_darwin riscv64_system aarch64_system];
|
||||
|
||||
nixosSystem = import ./lib/nixosSystem.nix;
|
||||
macosSystem = import ./lib/macosSystem.nix;
|
||||
colmenaSystem = import ./lib/colmenaSystem.nix;
|
||||
|
||||
# 星野 アイ, 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;
|
||||
};
|
||||
idol_aquamarine_tags = ["dist-build" "aqua"];
|
||||
|
||||
# 星野 瑠美衣, Hoshino Rubii
|
||||
idol_ruby_modules = {
|
||||
nixos-modules = [
|
||||
./hosts/idols/ruby
|
||||
];
|
||||
home-module = import ./home/linux/server.nix;
|
||||
};
|
||||
idol_ruby_tags = ["dist-build" "ruby"];
|
||||
|
||||
# 有馬 かな, Arima Kana
|
||||
idol_kana_modules = {
|
||||
nixos-modules = [
|
||||
./hosts/idols/kana
|
||||
];
|
||||
home-module = import ./home/linux/server.nix;
|
||||
};
|
||||
idol_kana_tags = ["dist-build" "kana"];
|
||||
|
||||
# 森友 望未, Moritomo Nozomi
|
||||
rolling_nozomi_modules = {
|
||||
nixos-modules = [
|
||||
./hosts/rolling_girls/nozomi
|
||||
];
|
||||
# home-module = import ./home/linux/server-riscv64.nix;
|
||||
};
|
||||
rolling_nozomi_tags = ["riscv" "nozomi"];
|
||||
|
||||
# 小坂 結季奈, Kosaka Yukina
|
||||
rolling_yukina_modules = {
|
||||
nixos-modules = [
|
||||
./hosts/rolling_girls/yukina
|
||||
];
|
||||
# home-module = import ./home/linux/server-riscv64.nix;
|
||||
};
|
||||
rolling_yukina_tags = ["riscv" "yukina"];
|
||||
|
||||
# 大木 鈴, Ōki Suzu
|
||||
_12kingdoms_suzu_modules = {
|
||||
nixos-modules = [
|
||||
./hosts/12kingdoms/suzu
|
||||
];
|
||||
# home-module = import ./home/linux/server.nix;
|
||||
};
|
||||
_12kingdoms_suzu_tags = ["aarch" "suzu"];
|
||||
|
||||
x64_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;
|
||||
in {
|
||||
nixosConfigurations = let
|
||||
base_args = {
|
||||
inherit home-manager nixos-generators;
|
||||
nixpkgs = nixpkgs; # or nixpkgs-unstable
|
||||
system = x64_system;
|
||||
specialArgs = x64_specialArgs;
|
||||
};
|
||||
in {
|
||||
# ai with i3 window manager
|
||||
ai_i3 = nixosSystem (idol_ai_modules_i3 // base_args);
|
||||
# ai with hyprland compositor
|
||||
ai_hyprland = nixosSystem (idol_ai_modules_hyprland // base_args);
|
||||
|
||||
# three virtual machines without desktop environment.
|
||||
aquamarine = nixosSystem (idol_aquamarine_modules // base_args);
|
||||
ruby = nixosSystem (idol_ruby_modules // base_args);
|
||||
kana = nixosSystem (idol_kana_modules // base_args);
|
||||
};
|
||||
|
||||
# colmena - remote deployment via SSH
|
||||
colmena = let
|
||||
# x86_64 related
|
||||
x64_base_args = {
|
||||
inherit home-manager;
|
||||
nixpkgs = nixpkgs; # or nixpkgs-unstable
|
||||
specialArgs = x64_specialArgs;
|
||||
};
|
||||
|
||||
# riscv64 related
|
||||
# using the same nixpkgs as nixos-licheepi4a to utilize the cross-compilation cache.
|
||||
lpi4a_pkgs = import nixos-licheepi4a.inputs.nixpkgs {system = x64_system;};
|
||||
lpi4a_specialArgs =
|
||||
{
|
||||
inherit username userfullname useremail;
|
||||
pkgsKernel = nixos-licheepi4a.packages.${x64_system}.pkgsKernelCross;
|
||||
}
|
||||
// inputs;
|
||||
lpi4a_base_args = {
|
||||
inherit home-manager;
|
||||
nixpkgs = nixos-licheepi4a.inputs.nixpkgs; # or nixpkgs-unstable
|
||||
specialArgs = lpi4a_specialArgs;
|
||||
targetUser = "root";
|
||||
};
|
||||
|
||||
# aarch64 related
|
||||
# using the same nixpkgs as nixos-rk3588 to utilize the cross-compilation cache.
|
||||
rk3588_pkgs = import nixos-rk3588.inputs.nixpkgs {system = x64_system;};
|
||||
rk3588_specialArgs =
|
||||
{
|
||||
inherit username userfullname useremail;
|
||||
}
|
||||
// nixos-rk3588.inputs;
|
||||
rk3588_base_args = {
|
||||
inherit home-manager;
|
||||
nixpkgs = nixos-rk3588.inputs.nixpkgs; # or nixpkgs-unstable
|
||||
specialArgs = rk3588_specialArgs;
|
||||
targetUser = "root";
|
||||
};
|
||||
in {
|
||||
meta = {
|
||||
nixpkgs = import nixpkgs {system = x64_system;};
|
||||
specialArgs = x64_specialArgs;
|
||||
|
||||
nodeSpecialArgs = {
|
||||
# riscv64 SBCs
|
||||
nozomi = lpi4a_specialArgs;
|
||||
yukina = lpi4a_specialArgs;
|
||||
|
||||
# aarch64 SBCs
|
||||
suzu = rk3588_specialArgs;
|
||||
};
|
||||
nodeNixpkgs = {
|
||||
nozomi = lpi4a_pkgs;
|
||||
yukina = lpi4a_pkgs;
|
||||
|
||||
# aarch64 SBCs
|
||||
suzu = rk3588_pkgs;
|
||||
};
|
||||
};
|
||||
|
||||
# proxmox virtual machines(x86_64)
|
||||
aquamarine = colmenaSystem (idol_aquamarine_modules // x64_base_args // {host_tags = idol_aquamarine_tags;});
|
||||
ruby = colmenaSystem (idol_ruby_modules // x64_base_args // {host_tags = idol_ruby_tags;});
|
||||
kana = colmenaSystem (idol_kana_modules // x64_base_args // {host_tags = idol_kana_tags;});
|
||||
|
||||
# riscv64 SBCs
|
||||
nozomi = colmenaSystem (rolling_nozomi_modules // lpi4a_base_args // {host_tags = rolling_nozomi_tags;});
|
||||
yukina = colmenaSystem (rolling_yukina_modules // lpi4a_base_args // {host_tags = rolling_yukina_tags;});
|
||||
|
||||
# aarch64 SBCs
|
||||
suzu = colmenaSystem (_12kingdoms_suzu_modules // rk3588_base_args // {host_tags = _12kingdoms_suzu_tags;});
|
||||
};
|
||||
|
||||
# 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"
|
||||
] (
|
||||
# generate iso image for hosts with desktop environment
|
||||
host:
|
||||
self.nixosConfigurations.${host}.config.formats.iso
|
||||
)
|
||||
// nixpkgs.lib.genAttrs [
|
||||
"aquamarine"
|
||||
"ruby"
|
||||
"kana"
|
||||
] (
|
||||
# generate proxmox image for virtual machines without desktop environment
|
||||
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 nixpkgs;
|
||||
};
|
||||
in {
|
||||
harmonica = macosSystem (base_args
|
||||
// {
|
||||
darwin-modules = [
|
||||
./hosts/harmonica
|
||||
];
|
||||
home-module = import ./home/darwin;
|
||||
});
|
||||
};
|
||||
|
||||
# format the nix code in this flake
|
||||
# alejandra is a nix formatter with a beautiful output
|
||||
formatter = nixpkgs.lib.genAttrs allSystems (
|
||||
system:
|
||||
nixpkgs.legacyPackages.${system}.alejandra
|
||||
);
|
||||
};
|
||||
|
||||
# 这是 flake.nix 的标准格式,inputs 是 flake 的依赖,outputs 是 flake 的输出
|
||||
# inputs 中的每一项都被拉取、构建后,被作为参数传递给 outputs 函数
|
||||
# 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.
|
||||
inputs = {
|
||||
# flake inputs 有很多种引用方式,应用最广泛的是 github 的引用方式
|
||||
# There are many ways to reference flake inputs. The most widely used is github:owner/name/reference,
|
||||
# which represents the GitHub repository URL + branch/commit-id/tag.
|
||||
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # 使用 nixos-unstable 分支
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
# follows 是 inputs 中的继承语法
|
||||
# 这里使 home-manager 的 nixpkgs 这个 inputs 与当前 flake 的 inputs.nixpkgs 保持一致,避免依赖的 nixpkgs 版本不一致导致问题
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
# Official NixOS package source, using nixos's stable branch by default
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
# nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
# vscode 插件库
|
||||
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
|
||||
};
|
||||
# for macos
|
||||
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.11-darwin";
|
||||
nix-darwin = {
|
||||
url = "github:lnl7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||
};
|
||||
|
||||
# outputs 的参数都是 inputs 中定义的依赖项,可以通过它们的名称来引用。
|
||||
# 不过 self 是个例外,这个特殊参数指向 outputs 自身(自引用),以及 flake 根目录
|
||||
# 这里的 @ 语法将函数的参数 attribute set 取了个别名,方便在内部使用
|
||||
outputs = inputs@{
|
||||
self,
|
||||
nixpkgs,
|
||||
home-manager,
|
||||
nix-vscode-extensions,
|
||||
...
|
||||
}: {
|
||||
# 名为 nixosConfigurations 的 outputs 会在执行 `nixos-rebuild switch --flake .` 时被使用
|
||||
# 默认情况下会使用与主机 hostname 同名的 nixosConfigurations,但是也可以通过 `--flake .#<name>` 来指定
|
||||
nixosConfigurations = {
|
||||
# hostname 为 nixos-test 的主机会使用这个配置
|
||||
# 这里使用了 nixpkgs.lib.nixosSystem 函数来构建配置,后面的 attributes set 是它的参数
|
||||
# 在 nixos 上使用此命令部署配置:`nixos-rebuild switch --flake .#nixos-test`
|
||||
nixos-test = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
# home-manager, used for managing user configuration
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-23.11";
|
||||
# url = "github:nix-community/home-manager/master";
|
||||
|
||||
# modules 中每个参数,都是一个 NixOS Module <https://nixos.org/manual/nixos/stable/index.html#sec-modularity>
|
||||
# NixOS Module 可以是一个 attribute set,也可以是一个返回 attribute set 的函数
|
||||
# 如果是函数,那么它的参数就是当前的 NixOS Module 的参数.
|
||||
# 根据 Nix Wiki 对 NixOS modules 的描述,NixOS modules 函数的参数可以有这四个(详见本仓库中的 modules 文件):
|
||||
#
|
||||
# config: The configuration of the entire system
|
||||
# options: All option declarations refined with all definition and declaration references.
|
||||
# pkgs: The attribute set extracted from the Nix package collection and enhanced with the nixpkgs.config option.
|
||||
# modulesPath: The location of the module directory of NixOS.
|
||||
#
|
||||
# nix flake 的 modules 系统可将配置模块化,提升配置的可维护性
|
||||
# 默认只能传上面这四个参数,如果需要传其他参数,必须使用 specialArgs
|
||||
modules = [
|
||||
./hosts/nixos-test
|
||||
# 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,
|
||||
# to avoid problems caused by different versions of nixpkgs dependencies.
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# home-manager 作为 nixos 的一个 module
|
||||
# 这样在 nixos-rebuild switch 时,home-manager 也会被自动部署,不需要额外执行 home-manager switch 命令
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
lanzaboote = {
|
||||
url = "github:nix-community/lanzaboote/v0.3.0";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
||||
home-manager.extraSpecialArgs = inputs;
|
||||
home-manager.users.ryan = import ./home;
|
||||
}
|
||||
];
|
||||
};
|
||||
impermanence.url = "github:nix-community/impermanence";
|
||||
|
||||
msi-rtx4090 = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
# modern window compositor
|
||||
hyprland.url = "github:hyprwm/Hyprland/v0.32.3";
|
||||
# community wayland nixpkgs
|
||||
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
||||
# anyrun - a wayland launcher
|
||||
anyrun = {
|
||||
url = "github:Kirottu/anyrun";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
modules = [
|
||||
./hosts/msi-rtx4090
|
||||
# generate iso/qcow2/docker/... image from nixos configuration
|
||||
nixos-generators = {
|
||||
url = "github:nix-community/nixos-generators";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# home-manager 作为 nixos 的一个 module
|
||||
# 这样在 nixos-rebuild switch 时,home-manager 也会被自动部署,不需要额外执行 home-manager switch 命令
|
||||
home-manager.nixosModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
# secrets management, lock with git commit at 2023/7/15
|
||||
agenix.url = "github:ryantm/agenix/0d8c5325fc81daf00532e3e26c6752f7bcde1143";
|
||||
|
||||
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
||||
home-manager.extraSpecialArgs = inputs;
|
||||
home-manager.users.ryan = import ./home;
|
||||
}
|
||||
];
|
||||
};
|
||||
######################## Some non-flake repositories #########################################
|
||||
|
||||
# AstroNvim is an aesthetic and feature-rich neovim config.
|
||||
astronvim = {
|
||||
url = "github:AstroNvim/AstroNvim/v3.39.0";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# 如果你在 x86_64-linux 平台上执行 nix build,那么默认会使用这个配置,或者也能通过 `.#<name>` 参数来指定非 default 的配置
|
||||
# packages.x86_64-linux.default =
|
||||
# useful nushell scripts, such as auto_completion
|
||||
nushell-scripts = {
|
||||
url = "github:nushell/nu_scripts/main";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
######################## My own repositories #########################################
|
||||
|
||||
# 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
|
||||
mysecrets = {
|
||||
url = "git+ssh://git@github.com/ryan4yin/nix-secrets.git?shallow=1";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
# my wallpapers
|
||||
wallpapers = {
|
||||
url = "github:ryan4yin/wallpapers";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
nur-ryan4yin = {
|
||||
url = "github:ryan4yin/nur-packages";
|
||||
# inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# riscv64 SBCs
|
||||
nixos-licheepi4a.url = "github:ryan4yin/nixos-licheepi4a";
|
||||
# nixos-jh7110.url = "github:ryan4yin/nixos-jh7110";
|
||||
|
||||
# aarch64 SBCs
|
||||
nixos-rk3588.url = "github:ryan4yin/nixos-rk3588";
|
||||
|
||||
######################## Color Schemes #########################################
|
||||
|
||||
# color scheme - catppuccin
|
||||
catppuccin-btop = {
|
||||
url = "github:catppuccin/btop";
|
||||
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;
|
||||
};
|
||||
cattppuccin-k9s = {
|
||||
url = "github:catppuccin/k9s";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
# the nixConfig here only affects the flake itself, not the system configuration!
|
||||
nixConfig = {
|
||||
# substituers will be appended to the default substituters when fetching packages
|
||||
extra-substituters = [
|
||||
# my own cache server
|
||||
"https://ryan4yin.cachix.org"
|
||||
"https://anyrun.cachix.org"
|
||||
"https://hyprland.cachix.org"
|
||||
"https://nix-community.cachix.org"
|
||||
"https://nixpkgs-wayland.cachix.org"
|
||||
];
|
||||
extra-trusted-public-keys = [
|
||||
"ryan4yin.cachix.org-1:Gbk27ZU5AYpGS9i3ssoLlwdvMIh0NxG0w8it/cv9kbU="
|
||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
||||
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
fetchgit,
|
||||
}:
|
||||
stdenvNoCC.mkDerivation rec {
|
||||
pname = "icomoon-feather-font";
|
||||
version = "2023-05-06";
|
||||
|
||||
# 参考 https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=ttf-icomoon-feather
|
||||
src = fetchgit {
|
||||
url = "https://github.com/adi1090x/polybar-themes.git";
|
||||
rev = "47b66337a92a1afd2240ed7094ffcb039cc686cf"; # git commit id
|
||||
sparseCheckout = ["fonts/feather.ttf"]; # only fetch the feather.ttf file
|
||||
|
||||
# the sha256 is used to verify the integrity of the downloaded source, and alse cache the build result.
|
||||
# so if you copy other package src's sha256, you will get a cached build result of that package, and all configs in this file will be ignored.
|
||||
# specify sha256 to empty and build it, then an error will indicate the correct sha256
|
||||
sha256 = "sha256-R+UpUFkXDrxKcX7ljLara+1B1rOMdKGZiLQq1/ojgP4=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm644 fonts/feather.ttf -t $out/share/fonts/truetype/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/feathericons/feather";
|
||||
description = "Icomoon feather font";
|
||||
version = version;
|
||||
longDescription = ''
|
||||
Feather is a collection of simply beautiful open source icons.
|
||||
Each icon is designed on a 24x24 grid with an emphasis on simplicity, consistency, and flexibility.
|
||||
'';
|
||||
license = licenses.mit;
|
||||
maintainers = [maintainers.ryan4yin];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
# Home Manager's Submodules
|
||||
|
||||
1. `base`: The base module that is suitable for both Linux and macOS.
|
||||
2. `linux`: Linux-specific configuration.
|
||||
3. `darwin`: macOS-specific configuration.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# Home Manager's Base Submodules
|
||||
|
||||
2. `server`: Configuration which is suitable for both servers and desktops.
|
||||
1. `desktop`: Configuration for desktop environments, such as Hyprland, I3, etc.
|
||||
1. it import `server` as its submodule.
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
# general tools
|
||||
pulumi
|
||||
pulumictl
|
||||
# istioctl
|
||||
|
||||
# aws
|
||||
awscli2
|
||||
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,6 @@
|
||||
{ ... }: {
|
||||
imports = [
|
||||
./container.nix
|
||||
./kubernetes.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
cattppuccin-k9s,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
kubectl
|
||||
kubernetes-helm
|
||||
];
|
||||
|
||||
programs = {
|
||||
k9s = {
|
||||
enable = true;
|
||||
skin =
|
||||
let
|
||||
skin_file = "${cattppuccin-k9s}/dist/mocha.yml"; # theme - cattppuccin 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;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{...}: {
|
||||
imports = [
|
||||
../server
|
||||
|
||||
./cloud
|
||||
./container
|
||||
./neovim
|
||||
./terminal
|
||||
|
||||
./development.nix
|
||||
./helix.nix
|
||||
./media.nix
|
||||
./shell.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
{
|
||||
pkgs,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}: {
|
||||
#############################################################
|
||||
#
|
||||
# Basic settings for development environment
|
||||
#
|
||||
# Please avoid to install language specific packages here(globally),
|
||||
# instead, install them:
|
||||
# 1. per IDE, such as `programs.neovim.extraPackages`
|
||||
# 2. per-project, using https://github.com/the-nix-way/dev-templates
|
||||
#
|
||||
#############################################################
|
||||
|
||||
home.packages = with pkgs; [
|
||||
(python3.withPackages (
|
||||
ps:
|
||||
with ps; [
|
||||
ipython
|
||||
pandas
|
||||
requests
|
||||
pyquery
|
||||
pyyaml
|
||||
]
|
||||
))
|
||||
|
||||
cargo # rust package manager
|
||||
go
|
||||
jdk17
|
||||
guile # scheme language
|
||||
|
||||
# db related
|
||||
dbeaver
|
||||
mycli
|
||||
pgcli
|
||||
mongosh
|
||||
sqlite
|
||||
|
||||
# embedded development
|
||||
minicom
|
||||
|
||||
# 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
|
||||
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 = {
|
||||
direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
|
||||
enableZshIntegration = true;
|
||||
enableBashIntegration = true;
|
||||
enableNushellIntegration = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
{ pkgs, catppuccin-helix, ... }:
|
||||
|
||||
{
|
||||
# https://github.com/catppuccin/helix
|
||||
xdg.configFile."helix/themes".source = "${catppuccin-helix}/themes/default";
|
||||
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
package = pkgs.helix;
|
||||
settings = {
|
||||
theme = "catppuccin_mocha";
|
||||
editor = {
|
||||
line-number = "relative";
|
||||
cursorline = true;
|
||||
color-modes = true;
|
||||
lsp.display-messages = true;
|
||||
cursor-shape = {
|
||||
insert = "bar";
|
||||
normal = "block";
|
||||
select = "underline";
|
||||
};
|
||||
indent-guides.render = true;
|
||||
};
|
||||
keys.normal = {
|
||||
space.space = "file_picker";
|
||||
space.w = ":w";
|
||||
space.q = ":q";
|
||||
esc = [ "collapse_selection" "keep_primary_selection" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
# processing audio/video
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
ffmpeg-full
|
||||
|
||||
# images
|
||||
viu # Terminal image viewer with native support for iTerm and Kitty
|
||||
imagemagick
|
||||
graphviz
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
# AstroNvim Configuration and Shortcuts
|
||||
|
||||
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
|
||||
|
||||

|
||||

|
||||
|
||||
## 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
|
||||
@@ -0,0 +1,459 @@
|
||||
return {
|
||||
colorscheme = "catppuccin",
|
||||
|
||||
options = {
|
||||
opt = {
|
||||
relativenumber = true, -- Show relative numberline
|
||||
signcolumn = "auto", -- Show sign column when used only
|
||||
spell = false, -- Spell checking
|
||||
swapfile = false, -- Swapfile
|
||||
smartindent = false, -- fix https://github.com/ryan4yin/nix-config/issues/4
|
||||
},
|
||||
},
|
||||
|
||||
plugins = {
|
||||
"AstroNvim/astrocommunity",
|
||||
-- colorscheme - catppuccin
|
||||
{ import = "astrocommunity.colorscheme.catppuccin" },
|
||||
-- Highly experimental plugin that completely replaces
|
||||
-- the UI for messages, cmdline and the popupmenu.
|
||||
{ import = "astrocommunity.utility.noice-nvim" },
|
||||
-- Fully featured & enhanced replacement for copilot.vim
|
||||
-- <Tab> work with both auto completion in cmp and copilot
|
||||
{ import = "astrocommunity.media.vim-wakatime" },
|
||||
{ import = "astrocommunity.motion.leap-nvim" },
|
||||
{ import = "astrocommunity.motion.flit-nvim" },
|
||||
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
|
||||
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
|
||||
-- Language Support
|
||||
---- Frontend & NodeJS
|
||||
{ import = "astrocommunity.pack.typescript-all-in-one" },
|
||||
{ import = "astrocommunity.pack.tailwindcss" },
|
||||
{ import = "astrocommunity.pack.html-css" },
|
||||
{ import = "astrocommunity.pack.prisma" },
|
||||
{ import = "astrocommunity.pack.vue" },
|
||||
---- Configuration Language
|
||||
{ import = "astrocommunity.pack.markdown" },
|
||||
{ import = "astrocommunity.pack.json" },
|
||||
{ import = "astrocommunity.pack.yaml" },
|
||||
{ import = "astrocommunity.pack.toml" },
|
||||
---- Backend
|
||||
{ import = "astrocommunity.pack.lua" },
|
||||
{ import = "astrocommunity.pack.go" },
|
||||
{ import = "astrocommunity.pack.rust" },
|
||||
{ import = "astrocommunity.pack.python" },
|
||||
{ import = "astrocommunity.pack.java" },
|
||||
-- { import = "astrocommunity.pack.nix" }, -- manually add config for nix, comment this one.
|
||||
{ import = "astrocommunity.pack.proto" },
|
||||
---- Operation & Cloud Native
|
||||
{ import = "astrocommunity.pack.terraform" },
|
||||
{ import = "astrocommunity.pack.bash" },
|
||||
{ import = "astrocommunity.pack.cmake" },
|
||||
{ import = "astrocommunity.pack.cpp" },
|
||||
{ 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
|
||||
{ import = "astrocommunity.completion.copilot-lua-cmp" },
|
||||
-- Custom copilot-lua to enable filtypes: markdown
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
opts = function(_, opts)
|
||||
opts.filetypes = {
|
||||
yaml = true,
|
||||
markdown = true,
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"0x00-ketsu/autosave.nvim",
|
||||
-- lazy-loading on events
|
||||
event = { "InsertLeave", "TextChanged" },
|
||||
opts = function(_, opts)
|
||||
opts.prompt_style = "notify" -- or stdout
|
||||
end,
|
||||
},
|
||||
|
||||
-- markdown preview
|
||||
{
|
||||
"0x00-ketsu/markdown-preview.nvim",
|
||||
ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" },
|
||||
config = function()
|
||||
require("markdown-preview").setup({
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the setup section below
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- 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)
|
||||
{
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
opts = {
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = true, -- visible by default
|
||||
hide_dotfiles = false,
|
||||
hide_gitignored = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- The plugin offers the alibity to refactor code.
|
||||
{
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ "nvim-treesitter/nvim-treesitter" },
|
||||
},
|
||||
},
|
||||
-- The plugin offers the abilibty to search and replace.
|
||||
{
|
||||
"nvim-pack/nvim-spectre",
|
||||
dependencies = {
|
||||
{ "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
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
local utils = require("astronvim.utils")
|
||||
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, {
|
||||
-- neovim
|
||||
"vim",
|
||||
"lua",
|
||||
-- operation & cloud native
|
||||
"dockerfile",
|
||||
"hcl",
|
||||
"jsonnet",
|
||||
"regex",
|
||||
"terraform",
|
||||
"nix",
|
||||
})
|
||||
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
|
||||
-- LSP installations
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
-- overwrite ensure_installed to install lsp via home manager(except emmet_ls)
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = {
|
||||
"emmet_ls", -- not exist in nixpkgs, so install it via mason
|
||||
}
|
||||
end,
|
||||
},
|
||||
-- Formatters/Linter installation
|
||||
{
|
||||
"jay-babu/mason-null-ls.nvim",
|
||||
-- ensure_installed nothing
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = nil
|
||||
opts.automatic_installation = false
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
opts = function(_, opts)
|
||||
local null_ls = require("null-ls")
|
||||
local code_actions = null_ls.builtins.code_actions
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local hover = null_ls.builtins.hover
|
||||
local completion = null_ls.builtins.completion
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
|
||||
if type(opts.sources) == "table" then
|
||||
vim.list_extend(opts.sources, {
|
||||
-- Common Code Actions
|
||||
code_actions.gitsigns,
|
||||
-- common refactoring actions based off the Refactoring book by Martin Fowler
|
||||
code_actions.refactoring,
|
||||
code_actions.gomodifytags, -- Go - modify struct field tags
|
||||
code_actions.impl, -- Go - generate interface method stubs
|
||||
code_actions.shellcheck,
|
||||
code_actions.proselint, -- English prose linter
|
||||
code_actions.statix, -- Lints and suggestions for Nix.
|
||||
|
||||
-- Diagnostic
|
||||
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
|
||||
diagnostics.buf, -- check text in current buffer
|
||||
diagnostics.checkmake, -- check Makefiles
|
||||
diagnostics.deadnix, -- Scan Nix files for dead code.
|
||||
|
||||
-- Formatting
|
||||
formatting.prettier, -- js/ts/vue/css/html/json/... formatter
|
||||
diagnostics.hadolint, -- Dockerfile linter
|
||||
formatting.black, -- Python formatter
|
||||
formatting.ruff, -- extremely fast Python linter
|
||||
formatting.goimports, -- Go formatter
|
||||
formatting.shfmt, -- Shell formatter
|
||||
formatting.rustfmt, -- Rust formatter
|
||||
formatting.taplo, -- TOML formatteautoindentr
|
||||
formatting.terraform_fmt, -- Terraform formatter
|
||||
formatting.stylua, -- Lua formatter
|
||||
formatting.alejandra, -- Nix formatter
|
||||
formatting.sqlfluff.with({ -- SQL formatter
|
||||
extra_args = { "--dialect", "postgres" }, -- change to your dialect
|
||||
}),
|
||||
formatting.nginx_beautifier, -- Nginx formatter
|
||||
null_ls.builtins.formatting.verible_verilog_format, -- Verilog formatter
|
||||
})
|
||||
end
|
||||
end,
|
||||
},
|
||||
-- Debugger installation
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
-- overrides `require("mason-nvim-dap").setup(...)`
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = nil
|
||||
opts.automatic_installation = false
|
||||
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
|
||||
lazy = {
|
||||
defaults = { lazy = true },
|
||||
performance = {
|
||||
rtp = {
|
||||
-- customize default disabled vim plugins
|
||||
disabled_plugins = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||
lsp = {
|
||||
config = {
|
||||
-- the offset_enconding of clangd will confilicts whit null-ls
|
||||
-- so we need to manually set it to utf-8
|
||||
clangd = {
|
||||
capabilities = {
|
||||
offsetEncoding = "utf-8",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- enable servers that installed by home-manager instead of mason
|
||||
servers = {
|
||||
---- Frontend & NodeJS
|
||||
"tsserver", -- typescript/javascript language server
|
||||
"tailwindcss", -- tailwindcss language server
|
||||
"html", -- html language server
|
||||
"cssls", -- css language server
|
||||
"prismals", -- prisma language server
|
||||
"volar", -- vue language server
|
||||
---- Configuration Language
|
||||
"marksman", -- markdown ls
|
||||
"jsonls", -- json language server
|
||||
"yamlls", -- yaml language server
|
||||
"taplo", -- toml language server
|
||||
---- Backend
|
||||
"lua_ls", -- lua
|
||||
"gopls", -- go
|
||||
"rust_analyzer", -- rust
|
||||
"pyright", -- python
|
||||
"ruff_lsp", -- extremely fast Python linter and code transformation
|
||||
"jdtls", -- java
|
||||
"nil_ls", -- nix language server
|
||||
"bufls", -- protocol buffer language server
|
||||
"zls", -- zig language server
|
||||
---- HDL
|
||||
"verible", -- verilog language server
|
||||
---- Operation & Cloud Nativautoindente
|
||||
"bashls", -- bash
|
||||
"cmake", -- cmake language server
|
||||
"clangd", -- c/c++
|
||||
"dockerls", -- dockerfile
|
||||
"jsonnet_ls", -- jsonnet language server
|
||||
"terraformls", -- terraform hcl
|
||||
},
|
||||
formatting = {
|
||||
disabled = {},
|
||||
format_on_save = {
|
||||
enabled = true,
|
||||
allow_filetypes = {
|
||||
"go",
|
||||
"jsonnet",
|
||||
"rust",
|
||||
"terraform",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
-- Mapping data with "desc" stored directly by vim.keymap.set().
|
||||
--
|
||||
-- Please use this mappings table to set keyboard mapping since this is the
|
||||
-- lower level configuration and more robust one. (which-key will
|
||||
-- automatically pick-up stored data by this setting.)
|
||||
local utils = require "astronvim.utils"
|
||||
|
||||
require("telescope").load_extension("refactoring")
|
||||
require("telescope").load_extension("yank_history")
|
||||
require("telescope").load_extension("undo")
|
||||
|
||||
return {
|
||||
-- normal mode
|
||||
n = {
|
||||
-- second key is the lefthand side of the map
|
||||
-- mappings seen under group name "Buffer"
|
||||
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
||||
-- quick save
|
||||
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
||||
|
||||
-- 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" },
|
||||
},
|
||||
-- Visual mode
|
||||
v = {
|
||||
-- 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" },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
{
|
||||
pkgs,
|
||||
astronvim,
|
||||
...
|
||||
}:
|
||||
###############################################################################
|
||||
#
|
||||
# AstroNvim's configuration and all its dependencies(lsp, formatter, etc.)
|
||||
#
|
||||
#e#############################################################################
|
||||
{
|
||||
xdg.configFile = {
|
||||
# astronvim's config
|
||||
"nvim".source = astronvim;
|
||||
|
||||
# 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
|
||||
"astronvim/lua/user".source = ./astronvim_user;
|
||||
};
|
||||
|
||||
nixpkgs.config = {
|
||||
programs.npm.npmrc = ''
|
||||
prefix = ''${HOME}/.npm-global
|
||||
'';
|
||||
};
|
||||
|
||||
programs = {
|
||||
neovim = {
|
||||
enable = true;
|
||||
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
# currently we use lazy.nvim as neovim's package manager, so comment this one.
|
||||
# plugins = with pkgs.vimPlugins; [
|
||||
# # search all the plugins using https://search.nixos.org/packages
|
||||
# ];
|
||||
|
||||
# Extra packages only available to nvim(won't pollute the global home environment)
|
||||
extraPackages = with pkgs;
|
||||
[
|
||||
#-- c/c++
|
||||
cmake
|
||||
cmake-language-server
|
||||
gnumake
|
||||
checkmake
|
||||
gcc # c/c++ compiler, required by nvim-treesitter!
|
||||
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
|
||||
gdb
|
||||
lldb
|
||||
|
||||
#-- python
|
||||
nodePackages.pyright # python language server
|
||||
python3Packages.black # python formatter
|
||||
python3Packages.ruff-lsp
|
||||
(python3.withPackages (
|
||||
ps:
|
||||
with ps; [
|
||||
pynvim # Python client and plugin host for Nvim
|
||||
|
||||
ipython
|
||||
pandas
|
||||
requests
|
||||
pyquery
|
||||
pyyaml
|
||||
]
|
||||
))
|
||||
|
||||
#-- rust
|
||||
rust-analyzer
|
||||
cargo # rust package manager
|
||||
rustfmt
|
||||
|
||||
#-- zig
|
||||
zls
|
||||
|
||||
#-- nix
|
||||
nil
|
||||
rnix-lsp
|
||||
# nixd
|
||||
statix # Lints and suggestions for the nix programming language
|
||||
deadnix # Find and remove unused code in .nix source files
|
||||
alejandra # Nix Code Formatter
|
||||
|
||||
#-- golang
|
||||
go
|
||||
gomodifytags
|
||||
iferr # generate error handling code for go
|
||||
impl # generate function implementation for go
|
||||
gotools # contains tools like: godoc, goimports, etc.
|
||||
gopls # go language server
|
||||
delve # go debugger
|
||||
|
||||
# -- java
|
||||
jdk17
|
||||
gradle
|
||||
maven
|
||||
spring-boot-cli
|
||||
|
||||
#-- lua
|
||||
stylua
|
||||
lua-language-server
|
||||
|
||||
#-- bash
|
||||
nodePackages.bash-language-server
|
||||
shellcheck
|
||||
shfmt
|
||||
|
||||
#-- javascript/typescript --#
|
||||
nodePackages.nodejs
|
||||
nodePackages.typescript
|
||||
nodePackages.typescript-language-server
|
||||
# HTML/CSS/JSON/ESLint language servers extracted from vscode
|
||||
nodePackages.vscode-langservers-extracted
|
||||
nodePackages."@tailwindcss/language-server"
|
||||
|
||||
#-- CloudNative
|
||||
nodePackages.dockerfile-language-server-nodejs
|
||||
# terraform # install via brew on macOS
|
||||
terraform-ls
|
||||
jsonnet
|
||||
jsonnet-language-server
|
||||
hadolint # Dockerfile linter
|
||||
|
||||
#-- Others
|
||||
taplo # TOML language server / formatter / validator
|
||||
nodePackages.yaml-language-server
|
||||
sqlfluff # SQL linter
|
||||
actionlint # GitHub Actions linter
|
||||
buf # protoc plugin for linting and formatting
|
||||
proselint # English prose linter
|
||||
guile # scheme language
|
||||
|
||||
#-- Misc
|
||||
tree-sitter # common language parser/highlighter
|
||||
nodePackages.prettier # common code formatter
|
||||
marksman # language server for markdown
|
||||
glow # markdown previewer
|
||||
fzf
|
||||
|
||||
#-- Optional Requirements:
|
||||
gdu # disk usage analyzer, required by AstroNvim
|
||||
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
||||
]
|
||||
++ (
|
||||
if pkgs.stdenv.isDarwin
|
||||
then []
|
||||
else [
|
||||
#-- verilog / systemverilog
|
||||
verible
|
||||
]
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{ nushell-scripts, ...}: {
|
||||
programs.bash = {
|
||||
# load the alias file for work
|
||||
bashrcExtra = ''
|
||||
alias_for_work=/etc/agenix/alias-for-work.bash
|
||||
if [ -f $alias_for_work ]; then
|
||||
. $alias_for_work
|
||||
else
|
||||
echo "No alias file found for work"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
programs.nushell = {
|
||||
# load the alias file for work
|
||||
# the file must exist, otherwise nushell will complain about it!
|
||||
#
|
||||
# currently, nushell does not support conditional sourcing of files
|
||||
# https://github.com/nushell/nushell/issues/8214
|
||||
extraConfig = ''
|
||||
source /etc/agenix/alias-for-work.nushell
|
||||
use ${nushell-scripts}/custom-completions/git/git-completions.nu *
|
||||
use ${nushell-scripts}/custom-completions/glow/glow-completions.nu *
|
||||
use ${nushell-scripts}/custom-completions/make/make-completions.nu *
|
||||
use ${nushell-scripts}/custom-completions/nix/nix-completions.nu *
|
||||
use ${nushell-scripts}/custom-completions/man/man-completions.nu *
|
||||
use ${nushell-scripts}/custom-completions/cargo/cargo-completions.nu *
|
||||
use ${nushell-scripts}/custom-completions/zellij/zellij-completions.nu *
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
{pkgs, catppuccin-alacritty, ...}:
|
||||
###########################################################
|
||||
#
|
||||
# Alacritty Configuration
|
||||
#
|
||||
# Useful Hot Keys for macOS:
|
||||
# 1. Multi-Window: `command + N`
|
||||
# 2. Increase Font Size: `command + =` | `command + +`
|
||||
# 3. Decrease Font Size: `command + -` | `command + _`
|
||||
# 4. Search Text: `command + F`
|
||||
# 5. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
||||
#
|
||||
# Useful Hot Keys for Linux:
|
||||
# 1. Increase Font Size: `ctrl + shift + =` | `ctrl + shift + +`
|
||||
# 2. Decrease Font Size: `ctrl + shift + -` | `ctrl + shift + _`
|
||||
# 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.
|
||||
#
|
||||
###########################################################
|
||||
{
|
||||
xdg.configFile."alacritty/theme_catppuccin.yml".source = "${catppuccin-alacritty}/catppuccin-mocha.yml";
|
||||
programs.alacritty = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
xdg.configFile."alacritty/alacritty.yml".text =
|
||||
''
|
||||
import:
|
||||
# all alacritty themes can be found at
|
||||
# https://github.com/alacritty/alacritty-theme
|
||||
- ~/.config/alacritty/theme_catppuccin.yml
|
||||
|
||||
window:
|
||||
# Background opacity
|
||||
#
|
||||
# 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.
|
||||
opacity: 0.93
|
||||
|
||||
# Startup Mode (changes require restart)
|
||||
#
|
||||
# Values for `startup_mode`:
|
||||
# - Windowed
|
||||
# - Maximized
|
||||
# - Fullscreen
|
||||
#
|
||||
# Values for `startup_mode` (macOS only):
|
||||
# - SimpleFullscreen
|
||||
startup_mode: Maximized
|
||||
|
||||
# Allow terminal applications to change Alacritty's window title.
|
||||
dynamic_title: true
|
||||
|
||||
# Make `Option` key behave as `Alt` (macOS only):
|
||||
# - OnlyLeft
|
||||
# - OnlyRight
|
||||
# - Both
|
||||
# - None (default)
|
||||
option_as_alt: Both
|
||||
|
||||
scrolling:
|
||||
# Maximum number of lines in the scrollback buffer.
|
||||
# Specifying '0' will disable scrolling.
|
||||
history: 10000
|
||||
|
||||
# Scrolling distance multiplier.
|
||||
#multiplier: 3
|
||||
|
||||
# Font configuration
|
||||
font:
|
||||
# Normal (roman) font face
|
||||
bold:
|
||||
family: JetBrainsMono Nerd Font
|
||||
italic:
|
||||
family: JetBrainsMono Nerd Font
|
||||
normal:
|
||||
family: JetBrainsMono Nerd Font
|
||||
bold_italic:
|
||||
# Font family
|
||||
#
|
||||
# If the bold italic family is not specified, it will fall back to the
|
||||
# value specified for the normal 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
|
||||
then ''
|
||||
# Point size
|
||||
size: 14
|
||||
''
|
||||
else ''
|
||||
# holder identation
|
||||
# Point size
|
||||
size: 13
|
||||
''
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{...}: {
|
||||
imports = [
|
||||
./alacritty.nix
|
||||
./kitty.nix
|
||||
./wezterm.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
###########################################################
|
||||
#
|
||||
# Kitty Configuration
|
||||
#
|
||||
# Useful Hot Keys for macOS:
|
||||
# 1. New Tab: `command + t`
|
||||
# 2. Close Tab: `command + w`
|
||||
# 3. Switch Tab: `shift + command + [` | `shift + command + ]`
|
||||
# 4. Increase Font Size: `command + =` | `command + +`
|
||||
# 5. Decrease Font Size: `command + -` | `command + _`
|
||||
# 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:
|
||||
# 1. New Tab: `ctrl + shift + t`
|
||||
# 2. Close Tab: `ctrl + shift + q`
|
||||
# 3. Switch Tab: `ctrl + shift + right` | `ctrl + shift + left`
|
||||
# 4. Increase Font Size: `ctrl + shift + =` | `ctrl + shift + +`
|
||||
# 5. Decrease Font Size: `ctrl + shift + -` | `ctrl + shift + _`
|
||||
# 6. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
||||
#
|
||||
###########################################################
|
||||
{
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
# 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 = {
|
||||
name = "JetBrainsMono Nerd Font";
|
||||
# use different font size on macOS
|
||||
size =
|
||||
if pkgs.stdenv.isDarwin
|
||||
then 14
|
||||
else 13;
|
||||
};
|
||||
|
||||
keybindings = {
|
||||
"ctrl+shift+m" = "toggle_maximized";
|
||||
};
|
||||
|
||||
settings = {
|
||||
background_opacity = "0.93";
|
||||
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
||||
scrollback_lines = 10000;
|
||||
enable_audio_bell = false;
|
||||
tab_bar_edge = "top"; # tab bar on top
|
||||
# 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`
|
||||
shell = "${pkgs.bash}/bin/bash --login -c 'nu --login --interactive'";
|
||||
};
|
||||
|
||||
# macOS specific settings
|
||||
darwinLaunchOptions = ["--start-as=maximized"];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
{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,16 @@
|
||||
{...}: {
|
||||
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()))'";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{ catppuccin-bat, ...}: {
|
||||
# a cat(1) clone with syntax highlighting and Git integration.
|
||||
programs.bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
pager = "less -FR";
|
||||
theme = "catppuccin-mocha";
|
||||
};
|
||||
themes = {
|
||||
# https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme
|
||||
catppuccin-mocha = {
|
||||
src = catppuccin-bat;
|
||||
file = "Catppuccin-mocha.tmTheme";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{ 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
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
{pkgs, ...}: {
|
||||
home.packages = with pkgs; [
|
||||
neofetch
|
||||
ranger # terminal file manager(batteries included, with image preview support)
|
||||
|
||||
# archives
|
||||
zip
|
||||
xz
|
||||
unzip
|
||||
p7zip
|
||||
|
||||
# networking tools
|
||||
mtr # A network diagnostic tool
|
||||
iperf3
|
||||
dnsutils # `dig` + `nslookup`
|
||||
ldns # replacement of `dig`, it provide the command `drill`
|
||||
aria2 # A lightweight multi-protocol & multi-source command-line download utility
|
||||
socat # replacement of openbsd-netcat
|
||||
nmap # A utility for network discovery and security auditing
|
||||
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
|
||||
tldr
|
||||
cowsay
|
||||
file
|
||||
which
|
||||
tree
|
||||
gnutar
|
||||
zstd
|
||||
caddy
|
||||
gnupg
|
||||
|
||||
# nix related
|
||||
#
|
||||
# it provides the command `nom` works just like `nix
|
||||
# with more details log output
|
||||
nix-output-monitor
|
||||
nodePackages.node2nix
|
||||
|
||||
# productivity
|
||||
hugo # static site generator
|
||||
glow # markdown previewer in terminal
|
||||
];
|
||||
|
||||
programs = {
|
||||
# modern vim
|
||||
neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
vimAlias = true;
|
||||
};
|
||||
|
||||
# A modern replacement for ‘ls’
|
||||
# useful in bash/zsh prompt, not in nushell.
|
||||
eza = {
|
||||
enable = true;
|
||||
enableAliases = true;
|
||||
git = true;
|
||||
icons = true;
|
||||
};
|
||||
|
||||
# A command-line fuzzy finder
|
||||
fzf = {
|
||||
enable = true;
|
||||
# https://github.com/catppuccin/fzf
|
||||
# catppuccin-mocha
|
||||
colors = {
|
||||
"bg+" = "#313244";
|
||||
"bg" = "#1e1e2e";
|
||||
"spinner" = "#f5e0dc";
|
||||
"hl" = "#f38ba8";
|
||||
"fg" = "#cdd6f4";
|
||||
"header" = "#f38ba8";
|
||||
"info" = "#cba6f7";
|
||||
"pointer" = "#f5e0dc";
|
||||
"marker" = "#f5e0dc";
|
||||
"fg+" = "#cdd6f4";
|
||||
"prompt" = "#cba6f7";
|
||||
"hl+" = "#f38ba8";
|
||||
};
|
||||
};
|
||||
|
||||
# skim provides a single executable: sk.
|
||||
# Basically anywhere you would want to use grep, try sk instead.
|
||||
skim = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{...}: {
|
||||
imports = [
|
||||
./nushell
|
||||
./tmux
|
||||
./zellij
|
||||
|
||||
./bash.nix
|
||||
./bat.nix
|
||||
./btop.nix
|
||||
./core.nix
|
||||
./git.nix
|
||||
./starship.nix
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
|
||||
userfullname,
|
||||
useremail,
|
||||
...
|
||||
}: {
|
||||
# `programs.git` will generate the config file: ~/.config/git/config
|
||||
# to make git use this config file, `~/.gitconfig` should not exist!
|
||||
#
|
||||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
|
||||
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
||||
rm -f ~/.gitconfig
|
||||
'';
|
||||
|
||||
home.packages = with pkgs; [
|
||||
];
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
lfs.enable = true;
|
||||
|
||||
userName = userfullname;
|
||||
userEmail = useremail;
|
||||
|
||||
includes = [
|
||||
{
|
||||
# use diffrent email & name for work
|
||||
path = "~/work/.gitconfig";
|
||||
condition = "gitdir:~/work/";
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
push.autoSetupRemote = true;
|
||||
pull.rebase = true;
|
||||
|
||||
# replace https with ssh
|
||||
url = {
|
||||
"ssh://git@github.com/ryan4yin" = {
|
||||
insteadOf = "https://github.com/ryan4yin";
|
||||
};
|
||||
# "ssh://git@gitlab.com/" = {
|
||||
# insteadOf = "https://gitlab.com/";
|
||||
# };
|
||||
# "ssh://git@bitbucket.com/" = {
|
||||
# insteadOf = "https://bitbucket.com/";
|
||||
# };
|
||||
};
|
||||
};
|
||||
|
||||
# signing = {
|
||||
# key = "xxx";
|
||||
# signByDefault = true;
|
||||
# };
|
||||
|
||||
# A syntax-highlighting pager in Rust(2019 ~ Now)
|
||||
delta = {
|
||||
enable = true;
|
||||
options = {
|
||||
diff-so-fancy = true;
|
||||
line-numbers = true;
|
||||
true-color = "always";
|
||||
# features => named groups of settings, used to keep related settings organized
|
||||
# features = "";
|
||||
};
|
||||
};
|
||||
|
||||
aliases = {
|
||||
# common aliases
|
||||
br = "branch";
|
||||
co = "checkout";
|
||||
st = "status";
|
||||
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";
|
||||
cm = "commit -m"; # commit via `git cm <message>`
|
||||
ca = "commit -am"; # commit all changes via `git ca <message>`
|
||||
dc = "diff --cached";
|
||||
|
||||
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
|
||||
update = "submodule update --init --recursive";
|
||||
foreach = "submodule foreach";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
# Nushell Config File
|
||||
#
|
||||
# version = 0.81.1
|
||||
|
||||
# let's define some colors
|
||||
|
||||
# https://github.com/catppuccin/i3/blob/main/themes/catppuccin-mocha
|
||||
let rosewater = "#f5e0dc"
|
||||
let flamingo = "#f2cdcd"
|
||||
let pink = "#f5c2e7"
|
||||
let mauve = "#cba6f7"
|
||||
let red = "#f38ba8"
|
||||
let maroon = "#eba0ac"
|
||||
let peach = "#fab387"
|
||||
let green = "#a6e3a1"
|
||||
let teal = "#94e2d5"
|
||||
let sky = "#89dceb"
|
||||
let sapphire = "#74c7ec"
|
||||
let blue = "#89b4fa"
|
||||
let lavender = "#b4befe"
|
||||
let text = "#cdd6f4"
|
||||
let subtext1 = "#bac2de"
|
||||
let subtext0 = "#a6adc8"
|
||||
let overlay2 = "#9399b2"
|
||||
let overlay1 = "#7f849c"
|
||||
let overlay0 = "#6c7086"
|
||||
let surface2 = "#585b70"
|
||||
let surface1 = "#45475a"
|
||||
let surface0 = "#313244"
|
||||
let base = "#1e1e2e"
|
||||
let mantle = "#181825"
|
||||
let crust = "#11111b"
|
||||
|
||||
# we're creating a theme here that uses the colors we defined above.
|
||||
|
||||
let catppuccin_theme = {
|
||||
separator: $overlay2
|
||||
leading_trailing_space_bg: $surface2
|
||||
header: $red
|
||||
date: $pink
|
||||
filesize: $green
|
||||
row_index: $text
|
||||
bool: $peach
|
||||
int: $red
|
||||
duration: $sky
|
||||
range: $sapphire
|
||||
float: $lavender
|
||||
string: $text
|
||||
nothing: $overlay1
|
||||
binary: $subtext1
|
||||
cellpath: $subtext0
|
||||
hints: dark_gray
|
||||
|
||||
shape_garbage: { fg: $overlay2 bg: $red attr: b}
|
||||
shape_bool: $maroon
|
||||
shape_int: { fg: $pink attr: b}
|
||||
shape_float: { fg: $pink attr: b}
|
||||
shape_range: { fg: $overlay0 attr: b}
|
||||
shape_internalcall: { fg: $maroon attr: b}
|
||||
shape_external: $mauve
|
||||
shape_externalarg: { fg: $red attr: b}
|
||||
shape_literal: $flamingo
|
||||
shape_operator: $rosewater
|
||||
shape_signature: { fg: $red attr: b}
|
||||
shape_string: $red
|
||||
shape_filepath: $peach
|
||||
shape_globpattern: { fg: $teal attr: b}
|
||||
shape_variable: $pink
|
||||
shape_flag: { fg: $mauve attr: b}
|
||||
shape_custom: {attr: b}
|
||||
}
|
||||
|
||||
# The default config record. This is where much of your global configuration is setup.
|
||||
$env.config = {
|
||||
color_config: $catppuccin_theme # <-- this is the theme
|
||||
use_ansi_coloring: true
|
||||
|
||||
# true or false to enable or disable the welcome banner at startup
|
||||
show_banner: false
|
||||
|
||||
table: {
|
||||
mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
|
||||
index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column
|
||||
show_empty: true # show 'empty list' and 'empty record' placeholders for command output
|
||||
trim: {
|
||||
methodology: wrapping # wrapping or truncating
|
||||
wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology
|
||||
truncating_suffix: "..." # A suffix used by the 'truncating' methodology
|
||||
}
|
||||
}
|
||||
|
||||
completions: {
|
||||
case_sensitive: false # set to true to enable case-sensitive completions
|
||||
quick: true # set this to false to prevent auto-selecting completions when only one remains
|
||||
partial: true # set this to false to prevent partial filling of the prompt
|
||||
algorithm: "prefix" # prefix or fuzzy
|
||||
external: {
|
||||
enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow
|
||||
max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options
|
||||
completer: null # check 'carapace_completer' above as an example
|
||||
}
|
||||
}
|
||||
filesize: {
|
||||
metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard)
|
||||
format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
|
||||
}
|
||||
cursor_shape: {
|
||||
emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line (line is the default)
|
||||
vi_insert: block # block, underscore, line , blink_block, blink_underscore, blink_line (block is the default)
|
||||
vi_normal: underscore # block, underscore, line, blink_block, blink_underscore, blink_line (underscore is the default)
|
||||
}
|
||||
use_grid_icons: true
|
||||
footer_mode: "25" # always, never, number_of_rows, auto
|
||||
float_precision: 2 # the precision for displaying floats in tables
|
||||
# buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
|
||||
bracketed_paste: true # enable bracketed paste, currently useless on windows
|
||||
edit_mode: emacs # emacs, vi
|
||||
shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue
|
||||
render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt.
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{ config, ...}: {
|
||||
programs.nushell = {
|
||||
enable = true;
|
||||
configFile.source = ./config.nu;
|
||||
|
||||
# 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()))'";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{ catppuccin-starship, ...}: {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
|
||||
enableBashIntegration = true;
|
||||
enableZshIntegration = true;
|
||||
enableNushellIntegration = true;
|
||||
|
||||
settings = {
|
||||
character = {
|
||||
success_symbol = "[›](bold green)";
|
||||
error_symbol = "[›](bold red)";
|
||||
};
|
||||
aws = {
|
||||
symbol = "🅰 ";
|
||||
};
|
||||
gcloud = {
|
||||
# do not show the account/project's info
|
||||
# to avoid the leak of sensitive information when sharing the terminal
|
||||
format = "on [$symbol$active(\($region\))]($style) ";
|
||||
symbol = "🅶 ️";
|
||||
};
|
||||
|
||||
palette = "catppuccin_mocha";
|
||||
} // builtins.fromTOML (builtins.readFile "${catppuccin-starship}/palettes/mocha.toml");
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
{pkgs, ...}: {
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
shell = "${pkgs.nushell}/bin/nu";
|
||||
|
||||
# Resize the window to the size of the smallest session for which it is the current window.
|
||||
#
|
||||
aggressiveResize = true;
|
||||
|
||||
# https://github.com/tmux-plugins/tmux-sensible
|
||||
# tmux-sensible overwrites default tmux shortcuts, makes them more sane.
|
||||
sensibleOnTop = true;
|
||||
|
||||
# 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
|
||||
|
||||
baseIndex = 1; # start index from 1
|
||||
escapeTime = 0; # do not wait for escape key
|
||||
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
{
|
||||
# theme
|
||||
# https://github.com/catppuccin/tmux
|
||||
plugin = catppuccin;
|
||||
extraConfig = ''
|
||||
set -g @catppuccin_flavour 'mocha' # or frappe, macchiato, mocha
|
||||
set -g @catppuccin_window_status_enable "yes"
|
||||
'';
|
||||
}
|
||||
|
||||
# https://github.com/tmux-plugins/tmux-yank
|
||||
# Enables copying to system clipboard.
|
||||
yank
|
||||
|
||||
{
|
||||
# https://github.com/tmux-plugins/tmux-resurrect
|
||||
# Manually persists tmux environment across system restarts.
|
||||
# prefix + Ctrl-s - save
|
||||
# prefix + Ctrl-r - restore
|
||||
#
|
||||
plugin = resurrect;
|
||||
# Restore Neovim sessions
|
||||
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
||||
}
|
||||
|
||||
# set -g @plugin 'tmux-plugins/tmux-cpu'
|
||||
{
|
||||
plugin = cpu;
|
||||
extraConfig = ''
|
||||
set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M '
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,355 @@
|
||||
// If you'd like to override the default keybindings completely, be sure to change "keybinds" to "keybinds clear-defaults=true"
|
||||
keybinds {
|
||||
normal {
|
||||
// uncomment this and adjust key if using copy_on_select=false
|
||||
// bind "Alt c" { Copy; }
|
||||
}
|
||||
locked {
|
||||
bind "Ctrl g" { SwitchToMode "Normal"; }
|
||||
}
|
||||
resize {
|
||||
bind "Ctrl n" { SwitchToMode "Normal"; }
|
||||
bind "h" "Left" { Resize "Increase Left"; }
|
||||
bind "j" "Down" { Resize "Increase Down"; }
|
||||
bind "k" "Up" { Resize "Increase Up"; }
|
||||
bind "l" "Right" { Resize "Increase Right"; }
|
||||
bind "H" { Resize "Decrease Left"; }
|
||||
bind "J" { Resize "Decrease Down"; }
|
||||
bind "K" { Resize "Decrease Up"; }
|
||||
bind "L" { Resize "Decrease Right"; }
|
||||
bind "=" "+" { Resize "Increase"; }
|
||||
bind "-" { Resize "Decrease"; }
|
||||
}
|
||||
pane {
|
||||
bind "Ctrl p" { SwitchToMode "Normal"; }
|
||||
bind "h" "Left" { MoveFocus "Left"; }
|
||||
bind "l" "Right" { MoveFocus "Right"; }
|
||||
bind "j" "Down" { MoveFocus "Down"; }
|
||||
bind "k" "Up" { MoveFocus "Up"; }
|
||||
bind "p" { SwitchFocus; }
|
||||
bind "n" { NewPane; SwitchToMode "Normal"; }
|
||||
bind "d" { NewPane "Down"; SwitchToMode "Normal"; }
|
||||
bind "r" { NewPane "Right"; SwitchToMode "Normal"; }
|
||||
bind "x" { CloseFocus; SwitchToMode "Normal"; }
|
||||
bind "f" { ToggleFocusFullscreen; SwitchToMode "Normal"; }
|
||||
bind "z" { TogglePaneFrames; SwitchToMode "Normal"; }
|
||||
bind "w" { ToggleFloatingPanes; SwitchToMode "Normal"; }
|
||||
bind "e" { TogglePaneEmbedOrFloating; SwitchToMode "Normal"; }
|
||||
bind "c" { SwitchToMode "RenamePane"; PaneNameInput 0;}
|
||||
}
|
||||
move {
|
||||
bind "Ctrl h" { SwitchToMode "Normal"; }
|
||||
bind "n" "Tab" { MovePane; }
|
||||
bind "p" { MovePaneBackwards; }
|
||||
bind "h" "Left" { MovePane "Left"; }
|
||||
bind "j" "Down" { MovePane "Down"; }
|
||||
bind "k" "Up" { MovePane "Up"; }
|
||||
bind "l" "Right" { MovePane "Right"; }
|
||||
}
|
||||
tab {
|
||||
bind "Ctrl t" { SwitchToMode "Normal"; }
|
||||
bind "r" { SwitchToMode "RenameTab"; TabNameInput 0; }
|
||||
bind "h" "Left" "Up" "k" { GoToPreviousTab; }
|
||||
bind "l" "Right" "Down" "j" { GoToNextTab; }
|
||||
bind "n" { NewTab; SwitchToMode "Normal"; }
|
||||
bind "x" { CloseTab; SwitchToMode "Normal"; }
|
||||
bind "s" { ToggleActiveSyncTab; SwitchToMode "Normal"; }
|
||||
bind "1" { GoToTab 1; SwitchToMode "Normal"; }
|
||||
bind "2" { GoToTab 2; SwitchToMode "Normal"; }
|
||||
bind "3" { GoToTab 3; SwitchToMode "Normal"; }
|
||||
bind "4" { GoToTab 4; SwitchToMode "Normal"; }
|
||||
bind "5" { GoToTab 5; SwitchToMode "Normal"; }
|
||||
bind "6" { GoToTab 6; SwitchToMode "Normal"; }
|
||||
bind "7" { GoToTab 7; SwitchToMode "Normal"; }
|
||||
bind "8" { GoToTab 8; SwitchToMode "Normal"; }
|
||||
bind "9" { GoToTab 9; SwitchToMode "Normal"; }
|
||||
bind "Tab" { ToggleTab; }
|
||||
}
|
||||
scroll {
|
||||
bind "Ctrl s" { SwitchToMode "Normal"; }
|
||||
bind "e" { EditScrollback; SwitchToMode "Normal"; }
|
||||
bind "s" { SwitchToMode "EnterSearch"; SearchInput 0; }
|
||||
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; }
|
||||
bind "j" "Down" { ScrollDown; }
|
||||
bind "k" "Up" { ScrollUp; }
|
||||
bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; }
|
||||
bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; }
|
||||
bind "d" { HalfPageScrollDown; }
|
||||
bind "u" { HalfPageScrollUp; }
|
||||
// uncomment this and adjust key if using copy_on_select=false
|
||||
// bind "Alt c" { Copy; }
|
||||
}
|
||||
search {
|
||||
bind "Ctrl s" { SwitchToMode "Normal"; }
|
||||
bind "Ctrl c" { ScrollToBottom; SwitchToMode "Normal"; }
|
||||
bind "j" "Down" { ScrollDown; }
|
||||
bind "k" "Up" { ScrollUp; }
|
||||
bind "Ctrl f" "PageDown" "Right" "l" { PageScrollDown; }
|
||||
bind "Ctrl b" "PageUp" "Left" "h" { PageScrollUp; }
|
||||
bind "d" { HalfPageScrollDown; }
|
||||
bind "u" { HalfPageScrollUp; }
|
||||
bind "n" { Search "down"; }
|
||||
bind "p" { Search "up"; }
|
||||
bind "c" { SearchToggleOption "CaseSensitivity"; }
|
||||
bind "w" { SearchToggleOption "Wrap"; }
|
||||
bind "o" { SearchToggleOption "WholeWord"; }
|
||||
}
|
||||
entersearch {
|
||||
bind "Ctrl c" "Esc" { SwitchToMode "Scroll"; }
|
||||
bind "Enter" { SwitchToMode "Search"; }
|
||||
}
|
||||
renametab {
|
||||
bind "Ctrl c" { SwitchToMode "Normal"; }
|
||||
bind "Esc" { UndoRenameTab; SwitchToMode "Tab"; }
|
||||
}
|
||||
renamepane {
|
||||
bind "Ctrl c" { SwitchToMode "Normal"; }
|
||||
bind "Esc" { UndoRenamePane; SwitchToMode "Pane"; }
|
||||
}
|
||||
session {
|
||||
bind "Ctrl o" { SwitchToMode "Normal"; }
|
||||
bind "Ctrl s" { SwitchToMode "Scroll"; }
|
||||
bind "d" { Detach; }
|
||||
}
|
||||
tmux {
|
||||
bind "[" { SwitchToMode "Scroll"; }
|
||||
bind "Ctrl b" { Write 2; SwitchToMode "Normal"; }
|
||||
bind "\"" { NewPane "Down"; SwitchToMode "Normal"; }
|
||||
bind "%" { NewPane "Right"; SwitchToMode "Normal"; }
|
||||
bind "z" { ToggleFocusFullscreen; SwitchToMode "Normal"; }
|
||||
bind "c" { NewTab; SwitchToMode "Normal"; }
|
||||
bind "," { SwitchToMode "RenameTab"; }
|
||||
bind "p" { GoToPreviousTab; SwitchToMode "Normal"; }
|
||||
bind "n" { GoToNextTab; SwitchToMode "Normal"; }
|
||||
bind "Left" { MoveFocus "Left"; SwitchToMode "Normal"; }
|
||||
bind "Right" { MoveFocus "Right"; SwitchToMode "Normal"; }
|
||||
bind "Down" { MoveFocus "Down"; SwitchToMode "Normal"; }
|
||||
bind "Up" { MoveFocus "Up"; SwitchToMode "Normal"; }
|
||||
bind "h" { MoveFocus "Left"; SwitchToMode "Normal"; }
|
||||
bind "l" { MoveFocus "Right"; SwitchToMode "Normal"; }
|
||||
bind "j" { MoveFocus "Down"; SwitchToMode "Normal"; }
|
||||
bind "k" { MoveFocus "Up"; SwitchToMode "Normal"; }
|
||||
bind "o" { FocusNextPane; }
|
||||
bind "d" { Detach; }
|
||||
bind "Space" { NextSwapLayout; }
|
||||
bind "x" { CloseFocus; SwitchToMode "Normal"; }
|
||||
}
|
||||
shared_except "locked" {
|
||||
bind "Ctrl g" { SwitchToMode "Locked"; }
|
||||
bind "Ctrl q" { Quit; }
|
||||
bind "Alt n" { NewPane; }
|
||||
bind "Alt h" "Alt Left" { MoveFocusOrTab "Left"; }
|
||||
bind "Alt l" "Alt Right" { MoveFocusOrTab "Right"; }
|
||||
bind "Alt j" "Alt Down" { MoveFocus "Down"; }
|
||||
bind "Alt k" "Alt Up" { MoveFocus "Up"; }
|
||||
bind "Alt =" "Alt +" { Resize "Increase"; }
|
||||
bind "Alt -" { Resize "Decrease"; }
|
||||
bind "Alt [" { PreviousSwapLayout; }
|
||||
bind "Alt ]" { NextSwapLayout; }
|
||||
}
|
||||
shared_except "normal" "locked" {
|
||||
bind "Enter" "Esc" { SwitchToMode "Normal"; }
|
||||
}
|
||||
shared_except "pane" "locked" {
|
||||
bind "Ctrl p" { SwitchToMode "Pane"; }
|
||||
}
|
||||
shared_except "resize" "locked" {
|
||||
bind "Ctrl n" { SwitchToMode "Resize"; }
|
||||
}
|
||||
shared_except "scroll" "locked" {
|
||||
bind "Ctrl s" { SwitchToMode "Scroll"; }
|
||||
}
|
||||
shared_except "session" "locked" {
|
||||
bind "Ctrl o" { SwitchToMode "Session"; }
|
||||
}
|
||||
shared_except "tab" "locked" {
|
||||
bind "Ctrl t" { SwitchToMode "Tab"; }
|
||||
}
|
||||
shared_except "move" "locked" {
|
||||
bind "Ctrl h" { SwitchToMode "Move"; }
|
||||
}
|
||||
shared_except "tmux" "locked" {
|
||||
bind "Ctrl b" { SwitchToMode "Tmux"; }
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
tab-bar { path "tab-bar"; }
|
||||
status-bar { path "status-bar"; }
|
||||
strider { path "strider"; }
|
||||
compact-bar { path "compact-bar"; }
|
||||
}
|
||||
|
||||
// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP
|
||||
// eg. when terminal window with an active zellij session is closed
|
||||
// Options:
|
||||
// - detach (Default)
|
||||
// - quit
|
||||
//
|
||||
// on_force_close "quit"
|
||||
|
||||
// Send a request for a simplified ui (without arrow fonts) to plugins
|
||||
// Options:
|
||||
// - true
|
||||
// - false (Default)
|
||||
//
|
||||
// simplified_ui true
|
||||
|
||||
// Choose the path to the default shell that zellij will use for opening new panes
|
||||
// Default: $SHELL
|
||||
// Change to nushell
|
||||
//
|
||||
default_shell "nu"
|
||||
|
||||
// Toggle between having pane frames around the panes
|
||||
// Options:
|
||||
// - true (default)
|
||||
// - false
|
||||
//
|
||||
// pane_frames true
|
||||
|
||||
// Toggle between having Zellij lay out panes according to a predefined set of layouts whenever possible
|
||||
// Options:
|
||||
// - true (default)
|
||||
// - false
|
||||
//
|
||||
// auto_layout true
|
||||
|
||||
// Define color themes for Zellij
|
||||
// For more examples, see: https://github.com/zellij-org/zellij/tree/main/example/themes
|
||||
// Once these themes are defined, one of them should to be selected in the "theme" section of this file
|
||||
//
|
||||
themes {
|
||||
// https://github.com/zellij-org/zellij/blob/main/zellij-utils/assets/themes/catppuccin.kdl
|
||||
catppuccin-latte {
|
||||
bg "#acb0be" // Surface2
|
||||
fg "#acb0be" // Surface2
|
||||
red "#d20f39"
|
||||
green "#40a02b"
|
||||
blue "#1e66f5"
|
||||
yellow "#df8e1d"
|
||||
magenta "#ea76cb" // Pink
|
||||
orange "#fe640b" // Peach
|
||||
cyan "#04a5e5" // Sky
|
||||
black "#dce0e8" // Crust
|
||||
white "#4c4f69" // Text
|
||||
}
|
||||
|
||||
catppuccin-frappe {
|
||||
bg "#626880" // Surface2
|
||||
fg "#c6d0f5"
|
||||
red "#e78284"
|
||||
green "#a6d189"
|
||||
blue "#8caaee"
|
||||
yellow "#e5c890"
|
||||
magenta "#f4b8e4" // Pink
|
||||
orange "#ef9f76" // Peach
|
||||
cyan "#99d1db" // Sky
|
||||
black "#292c3c" // Mantle
|
||||
white "#c6d0f5"
|
||||
}
|
||||
|
||||
catppuccin-macchiato {
|
||||
bg "#5b6078" // Surface2
|
||||
fg "#cad3f5"
|
||||
red "#ed8796"
|
||||
green "#a6da95"
|
||||
blue "#8aadf4"
|
||||
yellow "#eed49f"
|
||||
magenta "#f5bde6" // Pink
|
||||
orange "#f5a97f" // Peach
|
||||
cyan "#91d7e3" // Sky
|
||||
black "#1e2030" // Mantle
|
||||
white "#cad3f5"
|
||||
}
|
||||
|
||||
catppuccin-mocha {
|
||||
bg "#585b70" // Surface2
|
||||
fg "#cdd6f4"
|
||||
red "#f38ba8"
|
||||
green "#a6e3a1"
|
||||
blue "#89b4fa"
|
||||
yellow "#f9e2af"
|
||||
magenta "#f5c2e7" // Pink
|
||||
orange "#fab387" // Peach
|
||||
cyan "#89dceb" // Sky
|
||||
black "#181825" // Mantle
|
||||
white "#cdd6f4"
|
||||
}
|
||||
}
|
||||
|
||||
// Choose the theme that is specified in the themes section.
|
||||
// Default: default
|
||||
//
|
||||
theme "catppuccin-mocha"
|
||||
|
||||
// The name of the default layout to load on startup
|
||||
// Default: "default"
|
||||
//
|
||||
// default_layout "compact"
|
||||
|
||||
// Choose the mode that zellij uses when starting up.
|
||||
// Default: normal
|
||||
//
|
||||
// default_mode "locked"
|
||||
|
||||
// Toggle enabling the mouse mode.
|
||||
// On certain configurations, or terminals this could
|
||||
// potentially interfere with copying text.
|
||||
// Options:
|
||||
// - true (default)
|
||||
// - false
|
||||
//
|
||||
// mouse_mode false
|
||||
|
||||
// Configure the scroll back buffer size
|
||||
// This is the number of lines zellij stores for each pane in the scroll back
|
||||
// buffer. Excess number of lines are discarded in a FIFO fashion.
|
||||
// Valid values: positive integers
|
||||
// Default value: 10000
|
||||
//
|
||||
// scroll_buffer_size 10000
|
||||
|
||||
// Provide a command to execute when copying text. The text will be piped to
|
||||
// the stdin of the program to perform the copy. This can be used with
|
||||
// terminal emulators which do not support the OSC 52 ANSI control sequence
|
||||
// that will be used by default if this option is not set.
|
||||
// Examples:
|
||||
//
|
||||
// copy_command "xclip -selection clipboard" // x11
|
||||
// copy_command "wl-copy" // wayland
|
||||
// copy_command "pbcopy" // osx
|
||||
|
||||
// Choose the destination for copied text
|
||||
// Allows using the primary selection buffer (on x11/wayland) instead of the system clipboard.
|
||||
// Does not apply when using copy_command.
|
||||
// Options:
|
||||
// - system (default)
|
||||
// - primary
|
||||
//
|
||||
// copy_clipboard "primary"
|
||||
|
||||
// Enable or disable automatic copy (and clear) of selection when releasing mouse
|
||||
// Default: true
|
||||
//
|
||||
// copy_on_select false
|
||||
|
||||
// Path to the default editor to use to edit pane scrollbuffer
|
||||
// Default: $EDITOR or $VISUAL
|
||||
//
|
||||
// scrollback_editor "/usr/bin/vim"
|
||||
|
||||
// When attaching to an existing session with other users,
|
||||
// should the session be mirrored (true)
|
||||
// or should each user have their own cursor (false)
|
||||
// Default: false
|
||||
//
|
||||
// mirror_session true
|
||||
|
||||
// The folder in which Zellij will look for layouts
|
||||
//
|
||||
// layout_dir "/path/to/my/layout_dir"
|
||||
|
||||
// The folder in which Zellij will look for themes
|
||||
//
|
||||
// theme_dir "/path/to/my/theme_dir"
|
||||
@@ -0,0 +1,7 @@
|
||||
{...}: {
|
||||
programs.zellij = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
home.file.".config/zellij/config.kdl".source = ./config.kdl;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
# Home Manager's Darwin Submodules
|
||||
|
||||
1. `core.nix`: some basic configuration.
|
||||
2. `nushell.nix`: nushell's configuration for darwin.
|
||||
3. `rime-squirrel.nix`: [rime-squirrel](https://github.com/rime/squirrel)'s configuration.
|
||||
4. `default.nix`: the entrypoint of darwin's configuration, it import all the submodules above.
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
{pkgs, ...}: {
|
||||
##########################################################################
|
||||
#
|
||||
# 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
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{ username, ... }: {
|
||||
imports = [
|
||||
../base/desktop
|
||||
|
||||
./proxychains
|
||||
|
||||
./core.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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
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
|
||||
home.file."Library/Rime" = {
|
||||
# my custom squirrel data (flypy input method)
|
||||
source = "${pkgs.flypy-squirrel}/share/rime-data";
|
||||
recursive = true;
|
||||
};
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
i18n.inputMethod = {
|
||||
enabled = "fcitx5";
|
||||
fcitx5.addons =
|
||||
let
|
||||
# 为了不使用默认的 rime-data,改用我自定义的小鹤音形数据,这里需要 override
|
||||
# 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix
|
||||
config.packageOverrides = pkgs: {
|
||||
fcitx5-rime = pkgs.fcitx5-rime.override {rimeDataPkgs = [
|
||||
# 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」
|
||||
# 我仅修改了 default.yaml 文件,将其中的半角括号改为了直角括号「 与 」。
|
||||
./rime-data-flypy
|
||||
];};
|
||||
};
|
||||
in
|
||||
with pkgs; [
|
||||
fcitx5-rime
|
||||
fcitx5-configtool
|
||||
fcitx5-chinese-addons
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -1,537 +0,0 @@
|
||||
# This file is a modified version based on default i3-config-wizard config
|
||||
# Maintainer: ryan4yin [xiaoyin_c@qq.com]
|
||||
|
||||
#######################
|
||||
# config starts here: #
|
||||
#######################
|
||||
|
||||
# Font for window titles. Will also be used by the bar unless a different font
|
||||
# is used in the bar {} block below.
|
||||
# This font is widely installed, provides lots of unicode glyphs, right-to-left
|
||||
# text rendering and scalability on retina/hidpi displays (thanks to pango).
|
||||
font pango: Noto Sans Regular 10
|
||||
|
||||
# set the mod key to the winkey:
|
||||
set $mod Mod4
|
||||
|
||||
#####################
|
||||
# workspace layout: #
|
||||
#####################
|
||||
|
||||
# default i3 tiling mode:
|
||||
workspace_layout default
|
||||
|
||||
# i3 stacking layout:
|
||||
# Each window will be fullscreen and tabbed top to bottom.
|
||||
#workspace_layout stacking
|
||||
|
||||
# i3 tabbed layout:
|
||||
# Each new window will open fullscreen as a tab (left to right)
|
||||
#workspace_layout tabbed
|
||||
|
||||
##############################
|
||||
# extra options for windows: #
|
||||
##############################
|
||||
|
||||
#border indicator on windows:
|
||||
new_window pixel 1
|
||||
|
||||
# thin borders
|
||||
# hide_edge_borders both
|
||||
|
||||
# Set inner/outer gaps
|
||||
gaps inner 6
|
||||
gaps outer 3
|
||||
|
||||
# show window title bars (not officially supported with i3gaps)
|
||||
#default_border normal
|
||||
|
||||
# window title alignment
|
||||
#title_align center
|
||||
|
||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||
floating_modifier $mod
|
||||
|
||||
# switch/iterate between workspaces
|
||||
bindsym $mod+Tab workspace next
|
||||
bindsym $mod+Shift+Tab workspace prev
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace $ws1
|
||||
bindsym $mod+2 workspace $ws2
|
||||
bindsym $mod+3 workspace $ws3
|
||||
bindsym $mod+4 workspace $ws4
|
||||
bindsym $mod+5 workspace $ws5
|
||||
bindsym $mod+6 workspace $ws6
|
||||
bindsym $mod+7 workspace $ws7
|
||||
bindsym $mod+8 workspace $ws8
|
||||
bindsym $mod+9 workspace $ws9
|
||||
bindsym $mod+0 workspace $ws10
|
||||
|
||||
# switch to workspace with numpad keys
|
||||
bindcode $mod+87 workspace 1
|
||||
bindcode $mod+88 workspace 2
|
||||
bindcode $mod+89 workspace 3
|
||||
bindcode $mod+83 workspace 4
|
||||
bindcode $mod+84 workspace 5
|
||||
bindcode $mod+85 workspace 6
|
||||
bindcode $mod+79 workspace 7
|
||||
bindcode $mod+80 workspace 8
|
||||
bindcode $mod+81 workspace 9
|
||||
bindcode $mod+90 workspace 10
|
||||
|
||||
# switch to workspace with numlock numpad keys
|
||||
bindcode $mod+Mod2+87 workspace $ws1
|
||||
bindcode $mod+Mod2+88 workspace $ws2
|
||||
bindcode $mod+Mod2+89 workspace $ws3
|
||||
bindcode $mod+Mod2+83 workspace $ws4
|
||||
bindcode $mod+Mod2+84 workspace $ws5
|
||||
bindcode $mod+Mod2+85 workspace $ws6
|
||||
bindcode $mod+Mod2+79 workspace $ws7
|
||||
bindcode $mod+Mod2+80 workspace $ws8
|
||||
bindcode $mod+Mod2+81 workspace $ws9
|
||||
bindcode $mod+Mod2+90 workspace $ws10
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace $ws10
|
||||
|
||||
# move focused container to workspace with numpad keys
|
||||
bindcode $mod+Shift+Mod2+87 move container to workspace $ws1
|
||||
bindcode $mod+Shift+Mod2+88 move container to workspace $ws2
|
||||
bindcode $mod+Shift+Mod2+89 move container to workspace $ws3
|
||||
bindcode $mod+Shift+Mod2+83 move container to workspace $ws4
|
||||
bindcode $mod+Shift+Mod2+84 move container to workspace $ws5
|
||||
bindcode $mod+Shift+Mod2+85 move container to workspace $ws6
|
||||
bindcode $mod+Shift+Mod2+79 move container to workspace $ws7
|
||||
bindcode $mod+Shift+Mod2+80 move container to workspace $ws8
|
||||
bindcode $mod+Shift+Mod2+81 move container to workspace $ws9
|
||||
bindcode $mod+Shift+Mod2+90 move container to workspace $ws10
|
||||
|
||||
# move focused container to workspace with numpad keys
|
||||
bindcode $mod+Shift+87 move container to workspace $ws1
|
||||
bindcode $mod+Shift+88 move container to workspace $ws2
|
||||
bindcode $mod+Shift+89 move container to workspace $ws3
|
||||
bindcode $mod+Shift+83 move container to workspace $ws4
|
||||
bindcode $mod+Shift+84 move container to workspace $ws5
|
||||
bindcode $mod+Shift+85 move container to workspace $ws6
|
||||
bindcode $mod+Shift+79 move container to workspace $ws7
|
||||
bindcode $mod+Shift+80 move container to workspace $ws8
|
||||
bindcode $mod+Shift+81 move container to workspace $ws9
|
||||
bindcode $mod+Shift+90 move container to workspace $ws10
|
||||
|
||||
# resize window (you can also use the mouse for that):
|
||||
#mode "resize" {
|
||||
# These bindings trigger as soon as you enter the resize mode
|
||||
# Pressing left will shrink the window's width.
|
||||
# Pressing right will grow the window's width.
|
||||
# Pressing up will shrink the window's height.
|
||||
# Pressing down will grow the window's height.
|
||||
# bindsym j resize shrink width 10 px or 10 ppt
|
||||
# bindsym k resize grow height 10 px or 10 ppt
|
||||
# bindsym l resize shrink height 10 px or 10 ppt
|
||||
# bindsym ntilde resize grow width 10 px or 10 ppt
|
||||
|
||||
# same bindings, but for the arrow keys
|
||||
# bindsym Left resize shrink width 10 px or 10 ppt
|
||||
# bindsym Down resize grow height 10 px or 10 ppt
|
||||
# bindsym Up resize shrink height 10 px or 10 ppt
|
||||
# bindsym Right resize grow width 10 px or 10 ppt
|
||||
|
||||
# back to normal: Enter or Escape
|
||||
# bindsym Return mode "default"
|
||||
# bindsym Escape mode "default"
|
||||
#}
|
||||
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
######################################
|
||||
# keybindings for different actions: #
|
||||
######################################
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec alacritty
|
||||
|
||||
# kill focused window
|
||||
bindsym $mod+q kill
|
||||
|
||||
# exit-menu
|
||||
bindsym $mod+Shift+e exec ~/.config/i3/scripts/powermenu
|
||||
|
||||
# Lock the system
|
||||
# lock with a picture:
|
||||
#bindsym $mod+l exec i3lock -i ~/.config/i3/i3-lock-screen.png -p default|win -t
|
||||
# lock by blurring the screen:
|
||||
bindsym $mod+l exec ~/.config/i3/scripts/blur-lock
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
|
||||
# restart i3 inplace (preserves your layout/session, can be used to update i3)
|
||||
bindsym $mod+Shift+r restart
|
||||
|
||||
# keybinding in fancy rofi (automated):
|
||||
bindsym F1 exec ~/.config/i3/scripts/keyhint-2
|
||||
# alternative
|
||||
# keybinding list in editor:
|
||||
# bindsym $mod+F1 exec xed ~/.config/i3/keybindings
|
||||
|
||||
# Backlight control
|
||||
bindsym XF86MonBrightnessUp exec xbacklight +10 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
|
||||
bindsym XF86MonBrightnessDown exec xbacklight -10 && notify-send "Brightness - $(xbacklight -get | cut -d '.' -f 1)%"
|
||||
|
||||
# change focus
|
||||
bindsym $mod+j focus left
|
||||
bindsym $mod+k focus down
|
||||
bindsym $mod+b focus up
|
||||
bindsym $mod+o focus right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# move focused window
|
||||
bindsym $mod+Shift+j move left
|
||||
bindsym $mod+Shift+k move down
|
||||
bindsym $mod+Shift+b move up
|
||||
bindsym $mod+Shift+o move right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
|
||||
# split in horizontal orientation
|
||||
bindsym $mod+h split h
|
||||
|
||||
# split in vertical orientation
|
||||
bindsym $mod+v split v
|
||||
|
||||
# enter fullscreen mode for the focused container
|
||||
bindsym $mod+f fullscreen toggle
|
||||
|
||||
# change container layout (stacked, tabbed, toggle split)
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+g layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# toggle tiling / floating
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# change focus between tiling / floating windows
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# focus the parent container
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
# open new empty workspace
|
||||
bindsym $mod+Shift+n exec ~/.config/i3/scripts/empty_workspace
|
||||
|
||||
# Multimedia Keys
|
||||
|
||||
# volume
|
||||
bindsym XF86AudioRaiseVolume exec amixer -D pulse sset Master 5%+ && pkill -RTMIN+1 i3blocks
|
||||
bindsym XF86AudioLowerVolume exec amixer -D pulse sset Master 5%- && pkill -RTMIN+1 i3blocks
|
||||
|
||||
# gradular volume control
|
||||
bindsym $mod+XF86AudioRaiseVolume exec amixer -D pulse sset Master 1%+ && pkill -RTMIN+1 i3blocks
|
||||
bindsym $mod+XF86AudioLowerVolume exec amixer -D pulse sset Master 1%- && pkill -RTMIN+1 i3blocks
|
||||
|
||||
# mute
|
||||
bindsym XF86AudioMute exec amixer sset Master toggle && killall -USR1 i3blocks
|
||||
|
||||
# audio control
|
||||
bindsym XF86AudioPlay exec playerctl play
|
||||
bindsym XF86AudioPause exec playerctl pause
|
||||
bindsym XF86AudioNext exec playerctl next
|
||||
bindsym XF86AudioPrev exec playerctl previous
|
||||
|
||||
# Redirect sound to headphones
|
||||
bindsym $mod+p exec /usr/local/bin/switch-audio-port
|
||||
|
||||
## App shortcuts
|
||||
bindsym $mod+w exec /usr/bin/firefox
|
||||
bindsym $mod+n exec /usr/bin/thunar
|
||||
bindsym Print exec scrot ~/%Y-%m-%d-%T-screenshot.png && notify-send "Screenshot saved to ~/$(date +"%Y-%m-%d-%T")-screenshot.png"
|
||||
|
||||
# Power Profiles menu switcher (rofi)
|
||||
bindsym $mod+Shift+p exec ~/.config/i3/scripts/power-profiles
|
||||
|
||||
##########################################
|
||||
# configuration for workspace behaviour: #
|
||||
##########################################
|
||||
|
||||
# Define names for default workspaces for which we configure key bindings later on.
|
||||
# We use variables to avoid repeating the names in multiple places.
|
||||
set $ws1 "1:"
|
||||
set $ws2 "2:"
|
||||
set $ws3 "3:"
|
||||
set $ws4 "4:"
|
||||
set $ws5 "5:"
|
||||
set $ws6 "6"
|
||||
set $ws7 "7"
|
||||
set $ws8 "8"
|
||||
set $ws9 "9"
|
||||
set $ws10 "10"
|
||||
|
||||
# use workspaces on different displays:
|
||||
# where you have to replace VGA-0/HDMI-0 with the names for your displays
|
||||
# you can get from xrandr command
|
||||
#workspace $ws1 output VGA-0
|
||||
#workspace $ws2 output VGA-0
|
||||
#workspace $ws3 output HDMI-0
|
||||
#workspace $ws4 output HDMI-0
|
||||
#workspace $ws5 output HDMI-0
|
||||
|
||||
# bind program to workspace and focus to them on startup:
|
||||
assign [class="Terminal"] $ws1
|
||||
assign [class="(?i)firefox"] $ws2
|
||||
assign [class="Thunar"] $ws3
|
||||
assign [class="thunderbird"] $ws4
|
||||
assign [class="TelegramDesktop"] $ws5
|
||||
|
||||
# automatic set focus new window if it opens on another workspace than the current:
|
||||
for_window [class=Terminal] focus
|
||||
for_window [class=(?i)firefox] focus
|
||||
for_window [class=Thunar] focus
|
||||
for_window [class=Thunderbird] focus
|
||||
for_window [class=TelegramDesktop] focus
|
||||
|
||||
##############
|
||||
# compositor #
|
||||
##############
|
||||
|
||||
# transparency
|
||||
# options could need changes, related to used GPU and drivers.
|
||||
# to find the right setting consult the archwiki or ask at the forum.
|
||||
#
|
||||
# picom: https://wiki.archlinux.org/title/Picom
|
||||
# manpage: https://man.archlinux.org/man/picom.1.en
|
||||
# The default configuration is available in /etc/xdg/picom.conf
|
||||
# For modifications, it can be copied to ~/.config/picom/picom.conf or ~/.config/picom.conf
|
||||
# install picom package (yay -S picom)
|
||||
# start using default config
|
||||
exec_always --no-startup-id picom -b
|
||||
#
|
||||
# for custom config:
|
||||
#exec_always --no-startup-id picom --config ~/.config/picom.conf
|
||||
|
||||
#############################################
|
||||
# autostart applications/services on login: #
|
||||
#############################################
|
||||
|
||||
#get auth work with polkit-gnome
|
||||
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
|
||||
|
||||
# dex execute .desktop files + apps using /etc/xdg/autostart.
|
||||
exec --no-startup-id dex --autostart --environment i3
|
||||
|
||||
# num lock activated
|
||||
#exec --no-startup-id numlockx on
|
||||
|
||||
# start a script to setup displays
|
||||
# uncomment the next line, use arandr to setup displays and save the file as monitor:
|
||||
# exec --no-startup-id ~/.screenlayout/monitor.sh
|
||||
|
||||
# set wallpaper
|
||||
# exec --no-startup-id sleep 2 && nitrogen --restore
|
||||
exec --no-startup-id sleep 1 && feh --bg-fill ~/.config/i3/wallpaper.jpg
|
||||
|
||||
# set powersavings for display:
|
||||
exec --no-startup-id xset s 480 dpms 600 600 600
|
||||
|
||||
# disable power saving (for example if using xscreensaver)
|
||||
#exec --no-startup-id xset -dpms
|
||||
|
||||
# use xautolock to use autosuspend rules for mobile devices
|
||||
# https://wiki.archlinux.org/title/Session_lock#xautolock
|
||||
#exec --no-startup-id xautolock -time 60 -locker "systemctl suspend"
|
||||
|
||||
|
||||
# xscreensaver
|
||||
# https://www.jwz.org/xscreensaver
|
||||
#exec --no-startup-id xscreensaver --no-splash
|
||||
|
||||
# Desktop notifications
|
||||
# dunst config used ~/.config/dunst/dunstrc
|
||||
# set alternative config if needed:
|
||||
#exec --no-startup-id /usr/bin/dunst --config ~/.config/dunst/dunstrc
|
||||
# may yneed to run dbus-launch explicitly:
|
||||
#exec --no-startup-id dbus-launch /usr/bin/dunst
|
||||
exec --no-startup-id /usr/bin/dunst
|
||||
|
||||
|
||||
# autotiling script
|
||||
# https://github.com/nwg-piotr/autotiling
|
||||
# `yay -S autotiling ; (it is in AUR)
|
||||
#exec_always --no-startup-id autotiling
|
||||
|
||||
# Autostart apps as you like
|
||||
#exec --no-startup-id sleep 2 && Terminal
|
||||
#exec --no-startup-id sleep 3 && thunar
|
||||
|
||||
###############
|
||||
# system tray #
|
||||
###############
|
||||
# if you do not use dex: exec --no-startup-id dex --autostart --environment i3
|
||||
# you need to have tray apps started manually one by one:
|
||||
|
||||
# start blueberry app for managing bluetooth devices from tray:
|
||||
#exec --no-startup-id blueberry-tray
|
||||
|
||||
# networkmanager-applet
|
||||
#exec --no-startup-id nm-applet
|
||||
|
||||
##################
|
||||
# floating rules #
|
||||
##################
|
||||
|
||||
# set floating (nontiling) for apps needing it
|
||||
for_window [class="Yad" instance="yad"] floating enable
|
||||
for_window [class="Galculator" instance="galculator"] floating enable
|
||||
for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
|
||||
|
||||
# set floating (nontiling) for special apps
|
||||
for_window [class="Xsane" instance="xsane"] floating enable
|
||||
for_window [class="Pavucontrol" instance="pavucontrol"] floating enable
|
||||
for_window [class="qt5ct" instance="qt5ct"] floating enable
|
||||
for_window [class="Blueberry.py" instance="blueberry.py"] floating enable
|
||||
for_window [class="Bluetooth-sendto" instance="bluetooth-sendto"] floating enable
|
||||
for_window [class="Pamac-manager"] floating enable
|
||||
for_window [window_role="About"] floating enable
|
||||
|
||||
# set border of floating window
|
||||
for_window [class="urxvt"] border pixel 1
|
||||
|
||||
# set size of floating window
|
||||
#for_window [window_role="(?i)GtkFileChooserDialog"] resize set 640 480 #to set size of file choose dialog
|
||||
#for_window [class=".*"] resize set 640 480 #to change size of all floating windows
|
||||
|
||||
# set position of floating window
|
||||
#for_window [class=".*"] move position center
|
||||
|
||||
######################################
|
||||
# color settings for bar and windows #
|
||||
######################################
|
||||
|
||||
# Define colors variables:
|
||||
set $darkbluetrans #08052be6
|
||||
set $darkblue #08052b
|
||||
set $lightblue #5294e2
|
||||
set $urgentred #e53935
|
||||
set $white #ffffff
|
||||
set $black #000000
|
||||
set $purple #e345ff
|
||||
set $darkgrey #383c4a
|
||||
set $grey #b0b5bd
|
||||
set $mediumgrey #8b8b8b
|
||||
set $yellowbrown #e1b700
|
||||
|
||||
# define colors for windows:
|
||||
#class border bground text indicator child_border
|
||||
client.focused $lightblue $darkblue $white $mediumgrey $mediumgrey
|
||||
client.unfocused $darkblue $darkblue $grey $darkgrey $darkgrey
|
||||
client.focused_inactive $darkblue $darkblue $grey $black $black
|
||||
client.urgent $urgentred $urgentred $white $yellowbrown $yellowbrown
|
||||
|
||||
############################################
|
||||
# bar settings (input comes from i3blocks) #
|
||||
############################################
|
||||
|
||||
# Start i3bar to display a workspace bar
|
||||
# (plus the system information i3status finds out, if available)
|
||||
bar {
|
||||
font pango: Noto Sans Regular 10
|
||||
status_command i3blocks -c ~/.config/i3/i3blocks.conf
|
||||
position bottom
|
||||
# i3bar_command i3bar --transparency
|
||||
# it could be that you have no primary display set: set one (xrandr --output <output> --primary)
|
||||
# reference: https://i3wm.org/docs/userguide.html#_tray_output
|
||||
#tray_output primary
|
||||
tray_padding 0
|
||||
|
||||
# When strip_workspace_numbers is set to yes,
|
||||
# any workspace that has a name of the form
|
||||
# “[n][:][NAME]” will display only the name.
|
||||
strip_workspace_numbers yes
|
||||
##strip_workspace_name no
|
||||
|
||||
colors {
|
||||
separator $purple
|
||||
background $darkgrey
|
||||
statusline $white
|
||||
# border bg txt indicator
|
||||
focused_workspace $mediumgrey $grey $darkgrey $purple
|
||||
active_workspace $lightblue $mediumgrey $darkgrey $purple
|
||||
inactive_workspace $darkgrey $darkgrey $grey $purple
|
||||
urgent_workspace $urgentred $urgentred $white $purple
|
||||
}
|
||||
}
|
||||
|
||||
# you can add different bars for multidisplay setups on each display:
|
||||
# set output HDMI-0 to the display you want the bar, --transparency can be set.
|
||||
# Transparency needs rgba color codes to be used where the last two letters are the transparency factor see here:
|
||||
# https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4
|
||||
# #08052be6 --> e6=90%
|
||||
|
||||
# bar {
|
||||
# font pango: Noto Sans Regular 10
|
||||
# status_command i3blocks -c ~/.config/i3/i3blocks-2.conf
|
||||
# i3bar_command i3bar --transparency
|
||||
# output HDMI-0
|
||||
# position bottom
|
||||
#
|
||||
# When strip_workspace_numbers is set to yes,
|
||||
# any workspace that has a name of the form
|
||||
# “[n][:][NAME]” will display only the name.
|
||||
#strip_workspace_numbers yes
|
||||
##strip_workspace_name no
|
||||
#
|
||||
# colors {
|
||||
# separator $purple
|
||||
# background $darkbluetrans
|
||||
# statusline $white
|
||||
# border bg txt indicator
|
||||
# focused_workspace $lighterblue $lighterblue $darkblue $purple
|
||||
# active_workspace $lightdblue $lightdblue $darkblue $purple
|
||||
# inactive_workspace $darkblue $darkblue $lightdblue $purple
|
||||
# urgent_workspace $urgentred $urgentred $white $purple
|
||||
# }
|
||||
#}
|
||||
|
||||
#####################################
|
||||
# Application menu handled by rofi: #
|
||||
#####################################
|
||||
|
||||
## rofi bindings fancy application menu ($mod+d /F9 optional disabled)
|
||||
|
||||
bindsym $mod+d exec rofi -modi drun -show drun \
|
||||
-config ~/.config/rofi/rofidmenu.rasi
|
||||
|
||||
#bindsym F9 exec rofi -modi drun -show drun \
|
||||
# -config ~/.config/rofi/rofidmenu.rasi
|
||||
|
||||
## rofi bindings for window menu ($mod+t /F10 optional disabled)
|
||||
|
||||
bindsym $mod+t exec rofi -show window \
|
||||
-config ~/.config/rofi/rofidmenu.rasi
|
||||
|
||||
#bindsym F10 exec rofi -show window \
|
||||
# -config ~/.config/rofi/rofidmenu.rasi
|
||||
|
||||
## rofi bindings to manage clipboard (install rofi-greenclip from the AUR)
|
||||
|
||||
#exec --no-startup-id greenclip daemon>/dev/null
|
||||
#bindsym $mod+c exec --no-startup-id rofi -modi "clipboard:greenclip print" -show clipboard \
|
||||
# -config ~/.config/rofi/rofidmenu.rasi
|
||||
@@ -1,33 +0,0 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
# i3 配置,基于 https://github.com/endeavouros-team/endeavouros-i3wm-setup
|
||||
# 直接从当前文件夹中读取配置文件作为配置内容
|
||||
|
||||
# wallpaper, binary file
|
||||
home.file.".config/i3/wallpaper.jpg".source = ../../wallpaper.jpg;
|
||||
home.file.".config/i3/config".source = ./config;
|
||||
home.file.".config/i3/i3blocks.conf".source = ./i3blocks.conf;
|
||||
home.file.".config/i3/keybindings".source = ./keybindings;
|
||||
home.file.".config/i3/scripts" = {
|
||||
source = ./scripts;
|
||||
# copy the scripts directory recursively
|
||||
recursive = true;
|
||||
executable = true; # make all scripts executable
|
||||
};
|
||||
|
||||
|
||||
# set cursor size and dpi for 4k monitor
|
||||
xresources.properties = {
|
||||
"Xcursor.size" = 16;
|
||||
"Xft.dpi" = 192;
|
||||
};
|
||||
|
||||
# 直接以 text 的方式,在 nix 配置文件中硬编码文件内容
|
||||
# home.file.".xxx".text = ''
|
||||
# xxx
|
||||
# '';
|
||||
|
||||
}
|
||||
@@ -1,179 +0,0 @@
|
||||
# i3blocks config file changed for EndeavourOS-i3 setup
|
||||
|
||||
# source is available here:
|
||||
# https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/i3blocks.conf
|
||||
# Maintainer: joekamprad [joekamprad@endeavouros.com]
|
||||
# Former Visual Designer: Florent Valetti [@FLVAL EndeavourOS]
|
||||
# created for i3wm setup on EndeavourOS
|
||||
# https://endeavouros.com
|
||||
|
||||
# cheatsheet for icon fonts used on the block-bar:
|
||||
# https://fontawesome.com/v4.7/cheatsheet/
|
||||
|
||||
# --> to update this run the following command:
|
||||
# wget --backups=1 https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/i3blocks.conf -P ~/.config/i3/
|
||||
|
||||
# Please see man i3blocks for a complete reference!
|
||||
# The man page is also hosted at http://vivien.github.io/i3blocks
|
||||
|
||||
|
||||
# List of valid properties:
|
||||
#
|
||||
# align
|
||||
# color
|
||||
# command
|
||||
# full_text
|
||||
# instance
|
||||
# interval
|
||||
# label
|
||||
# min_width
|
||||
# name
|
||||
# separator
|
||||
# separator_block_width
|
||||
# short_text
|
||||
# signal
|
||||
# urgent
|
||||
|
||||
# Global properties
|
||||
#
|
||||
# The top properties below are applied to every block, but can be overridden.
|
||||
separator=false
|
||||
markup=pango
|
||||
|
||||
#[Weather]
|
||||
#command=~/.config/i3/scripts/openweather
|
||||
# or:
|
||||
#command=~/.config/i3/scripts/openweather-city
|
||||
#interval=1800
|
||||
#color=#7275b3
|
||||
|
||||
[terminal]
|
||||
full_text=
|
||||
color=#807dfe
|
||||
command=i3-msg -q exec alacritty
|
||||
|
||||
[browser]
|
||||
full_text=
|
||||
color=#ff7f81
|
||||
command=i3-msg -q exec firefox
|
||||
|
||||
[files]
|
||||
full_text=
|
||||
color=#7f3fbf
|
||||
command=i3-msg -q exec thunar ~/
|
||||
|
||||
#[mail]
|
||||
#full_text=
|
||||
#color=#dbcb75
|
||||
#command=i3-msg -q exec thunderbird
|
||||
|
||||
[simple-2]
|
||||
full_text=: :
|
||||
color=#717171
|
||||
|
||||
# Disk usage
|
||||
#
|
||||
# The directory defaults to $HOME if the instance is not specified.
|
||||
# The script may be called with a optional argument to set the alert
|
||||
# (defaults to 10 for 10%).
|
||||
[disk]
|
||||
label=
|
||||
instance=/
|
||||
command=~/.config/i3/scripts/disk
|
||||
interval=30
|
||||
|
||||
# Memory usage
|
||||
#
|
||||
# The type defaults to "mem" if the instance is not specified.
|
||||
[memory]
|
||||
label=
|
||||
command=~/.config/i3/scripts/memory
|
||||
interval=2
|
||||
|
||||
[cpu_usage]
|
||||
label=
|
||||
command=~/.config/i3/scripts/cpu_usage
|
||||
#min_width=CPU: 100.00%
|
||||
interval=2
|
||||
|
||||
[CPU-temperature]
|
||||
label=
|
||||
command=~/.config/i3/scripts/temperature
|
||||
interval=30
|
||||
#T_WARN=70
|
||||
#T_CRIT=90
|
||||
#SENSOR_CHIP=""
|
||||
# where SENSOR_CHIP can be find with sensors output
|
||||
# can be used also for GPU temperature or other temperature sensors lm-sensors detects.
|
||||
|
||||
# showing name of connected network (enable for wifi use)
|
||||
#[net]
|
||||
#label=
|
||||
#command=echo "$(LANG=C nmcli d | grep connected | awk '{print $4}')"
|
||||
#interval=30
|
||||
|
||||
[bandwidth]
|
||||
command=~/.config/i3/scripts/bandwidth2
|
||||
interval=persist
|
||||
|
||||
# Battery indicator
|
||||
# [battery]
|
||||
# command=~/.config/i3/scripts/battery2
|
||||
# # for alternative battery script change to battery1
|
||||
# # change this to battery-pinebook-pro if you are running on pinebook-pro
|
||||
# label=
|
||||
# interval=30
|
||||
|
||||
[simple-2]
|
||||
full_text=: :
|
||||
color=#717171
|
||||
|
||||
[pavucontrol]
|
||||
full_text=
|
||||
command=pavucontrol
|
||||
|
||||
[volume-pulseaudio]
|
||||
command=~/.config/i3/scripts/volume
|
||||
instance=Master
|
||||
interval=1
|
||||
|
||||
# display keyboard layout name
|
||||
# for keyboard layouts switcher
|
||||
# see i3 config file
|
||||
# this needs xkblayout-state installed from the AUR:
|
||||
# https://aur.archlinux.org/packages/xkblayout-state-git
|
||||
#[keyboard-layout]
|
||||
#command=~/.config/i3/scripts/keyboard-layout
|
||||
#interval=2
|
||||
|
||||
[keybindings]
|
||||
full_text=
|
||||
command=~/.config/i3/scripts/keyhint
|
||||
|
||||
# power-profiles-daemon implementation:
|
||||
# needs package power-profiles-daemon installed and the service running see here:
|
||||
# https://wiki.archlinux.org/title/CPU_frequency_scaling#power-profiles-daemon
|
||||
|
||||
#set power-profile
|
||||
[ppd_menu]
|
||||
full_text=
|
||||
command=~/.config/i3/scripts/power-profiles
|
||||
color=#407437
|
||||
|
||||
#Show the current power-profile
|
||||
[ppd-status]
|
||||
command=~/.config/i3/scripts/ppd-status
|
||||
interval=5
|
||||
|
||||
[time]
|
||||
#label=
|
||||
command=date '+%a %d %b %H:%M:%S'
|
||||
interval=1
|
||||
|
||||
[shutdown_menu]
|
||||
full_text=
|
||||
command=~/.config/i3/scripts/powermenu
|
||||
|
||||
[simple-2]
|
||||
full_text=: :
|
||||
color=#717171
|
||||
@@ -1,106 +0,0 @@
|
||||
EndeavourOS i3wm Keybindings cheat sheet:
|
||||
|
||||
--> to update this run the following command:
|
||||
wget --backups=1 https://raw.githubusercontent.com/endeavouros-team/endeavouros-i3wm-setup/main/.config/i3/keybindings -P ~/.config/i3/
|
||||
|
||||
All sources and updates are available at GitHub:
|
||||
https://github.com/endeavouros-team/endeavouros-i3wm-setup
|
||||
|
||||
For reference consult our WIKI:
|
||||
https://discovery.endeavouros.com/window-tiling-managers/i3-wm/
|
||||
|
||||
= windows key
|
||||
|
||||
# start alacritty
|
||||
+Return
|
||||
|
||||
# kill focused window
|
||||
+q
|
||||
|
||||
# Application menu search by typing (fancy Rofi menu):
|
||||
+d
|
||||
|
||||
# Window switcher menu (fancy Rofi menu):
|
||||
+t
|
||||
|
||||
# fancy exit-menu on bottom right:
|
||||
+Shift+e
|
||||
|
||||
# Lock the system
|
||||
# lock with a picture or blurring the screen (options in config)
|
||||
+l
|
||||
|
||||
# reload the configuration file
|
||||
+Shift+c
|
||||
|
||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||
+Shift+r
|
||||
|
||||
# keybinding in fancy rofi (automated)
|
||||
F1
|
||||
|
||||
# full keybinding list in editor:
|
||||
+F1
|
||||
|
||||
# change window focus
|
||||
+j focus left
|
||||
+k focus down
|
||||
+b focus up
|
||||
+o focus right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
+Left focus left
|
||||
+Down focus down
|
||||
+Up focus up
|
||||
+Right focus right
|
||||
|
||||
# move a focused window
|
||||
+Shift+j move left
|
||||
+Shift+k move down
|
||||
+Shift+b move up
|
||||
+Shift+o move right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
+Shift+Left move left
|
||||
+Shift+Down move down
|
||||
+Shift+Up move up
|
||||
+Shift+Right move right
|
||||
|
||||
# split in horizontal orientation
|
||||
+h split h
|
||||
|
||||
# split in vertical orientation
|
||||
+v split v
|
||||
|
||||
# enter fullscreen mode for the focused container
|
||||
+f fullscreen toggle
|
||||
|
||||
# change container layout (stacked, tabbed, toggle split)
|
||||
+s layout stacking
|
||||
+g layout tabbed
|
||||
+e layout toggle split
|
||||
|
||||
# toggle tiling / floating
|
||||
+Shift+space floating toggle
|
||||
|
||||
# change focus between tiling / floating windows
|
||||
+space focus mode_toggle
|
||||
|
||||
# focus the parent container
|
||||
+a focus parent
|
||||
|
||||
# focus the child container
|
||||
#+d focus child
|
||||
|
||||
# resize floating window
|
||||
+right mouse button
|
||||
|
||||
## Multimedia Keys
|
||||
|
||||
# Redirect sound to headphones
|
||||
+p
|
||||
|
||||
## App shortcuts
|
||||
+w starts Firefox
|
||||
+n starts Thunar
|
||||
Button screenshot
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#simple Shellscript for i3blocks on Pinebook pro
|
||||
#05012020 geri123@gmx.net Gerhard S.
|
||||
#battery-symbols: on Manjaro you need the awesome-terminal-fonts package installed!
|
||||
PERCENT=$(cat /sys/class/power_supply/cw2015-battery/capacity)
|
||||
STATUS=$(cat /sys/class/power_supply/cw2015-battery/status)
|
||||
case $((
|
||||
$PERCENT >= 0 && $PERCENT <= 20 ? 1 :
|
||||
$PERCENT > 20 && $PERCENT <= 40 ? 2 :
|
||||
$PERCENT > 40 && $PERCENT <= 60 ? 3 :
|
||||
$PERCENT > 60 && $PERCENT <= 80 ? 4 : 5)) in
|
||||
#
|
||||
(1) echo $STATUS:"" :$PERCENT%;;
|
||||
(2) echo $STATUS:"" :$PERCENT%;;
|
||||
(3) echo $STATUS:"" :$PERCENT%;;
|
||||
(4) echo $STATUS:"" :$PERCENT%;;
|
||||
(5) echo $STATUS:"" :$PERCENT%;;
|
||||
esac
|
||||
@@ -1,114 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
|
||||
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
|
||||
#
|
||||
# Licensed under the terms of the GNU GPL v3, or any later version.
|
||||
#
|
||||
# This script is meant to use with i3blocks. It parses the output of the "acpi"
|
||||
# command (often provided by a package of the same name) to read the status of
|
||||
# the battery, and eventually its remaining time (to full charge or discharge).
|
||||
#
|
||||
# The color will gradually change for a percentage below 85%, and the urgency
|
||||
# (exit code 33) is set if there is less that 5% remaining.
|
||||
|
||||
# Edited by Andreas Lindlbauer <endeavouros.mousily@aleeas.com>
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
|
||||
# otherwise we get in console "Wide character in print at"
|
||||
binmode(STDOUT, ':utf8');
|
||||
|
||||
# my $acpi;
|
||||
my $upower;
|
||||
my $percent;
|
||||
my $bat_state;
|
||||
my $status;
|
||||
my $ac_adapt;
|
||||
my $full_text;
|
||||
my $short_text;
|
||||
my $label = '😅';
|
||||
my $bat_number = $ENV{BLOCK_INSTANCE} || 0;
|
||||
|
||||
open (UPOWER, "upower -i /org/freedesktop/UPower/devices/battery_BAT$bat_number | grep 'percentage' |") or die;
|
||||
$upower = <UPOWER>;
|
||||
close(UPOWER);
|
||||
|
||||
# fail on unexpected output
|
||||
if ($upower !~ /: (\d+)%/) {
|
||||
die "$upower\n";
|
||||
}
|
||||
|
||||
$percent = $1;
|
||||
$full_text = "$percent%";
|
||||
|
||||
open (BAT_STATE, "upower -i /org/freedesktop/UPower/devices/battery_BAT$bat_number | grep 'state' |") or die;
|
||||
$bat_state = <BAT_STATE>;
|
||||
close(BAT_STATE);
|
||||
|
||||
if ($bat_state !~ /: (\w+)/) {
|
||||
die "$bat_state\n";
|
||||
}
|
||||
$status = $1;
|
||||
|
||||
if ($status eq 'discharging') {
|
||||
$full_text .= ' ';
|
||||
} elsif ($status eq 'charging') {
|
||||
$full_text .= ' ';
|
||||
} elsif ($status eq 'Unknown') {
|
||||
open (AC_ADAPTER, "acpi -a |") or die;
|
||||
$ac_adapt = <AC_ADAPTER>;
|
||||
close(AC_ADAPTER);
|
||||
|
||||
if ($ac_adapt =~ /: ([\w-]+)/) {
|
||||
$ac_adapt = $1;
|
||||
|
||||
if ($ac_adapt eq 'on-line') {
|
||||
$full_text .= ' CHR';
|
||||
} elsif ($ac_adapt eq 'off-line') {
|
||||
$full_text .= ' DIS';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$short_text = $full_text;
|
||||
|
||||
if ($percent < 20) {
|
||||
$label = '';
|
||||
} elsif ($percent < 45) {
|
||||
$label = '';
|
||||
} elsif ($percent < 70) {
|
||||
$label = '';
|
||||
} elsif ($percent < 95) {
|
||||
$label = '';
|
||||
} else {
|
||||
$label = '';
|
||||
}
|
||||
|
||||
# print text
|
||||
print " ${label}";
|
||||
print " $full_text\n";
|
||||
print " ${label}";
|
||||
print " $short_text\n";
|
||||
|
||||
# consider color and urgent flag only on discharge
|
||||
if ($status eq 'discharging') {
|
||||
|
||||
if ($percent < 20) {
|
||||
print "#FF0000\n";
|
||||
} elsif ($percent < 40) {
|
||||
print "#FFAE00\n";
|
||||
} elsif ($percent < 60) {
|
||||
print "#FFF600\n";
|
||||
} elsif ($percent < 85) {
|
||||
print "#A8FF00\n";
|
||||
}
|
||||
|
||||
if ($percent < 5) {
|
||||
exit(33);
|
||||
}
|
||||
}
|
||||
|
||||
exit(0);
|
||||
@@ -1,106 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2016 James Murphy
|
||||
# Licensed under the GPL version 2 only
|
||||
#
|
||||
# A battery indicator blocklet script for i3blocks
|
||||
|
||||
from subprocess import check_output
|
||||
import os
|
||||
import re
|
||||
|
||||
config = dict(os.environ)
|
||||
status = check_output(['acpi'], universal_newlines=True)
|
||||
|
||||
if not status:
|
||||
# stands for no battery found
|
||||
color = config.get("color_10", "red")
|
||||
fulltext = "<span color='{}'><span font='FontAwesome'>\uf00d \uf240</span></span>".format(color)
|
||||
percentleft = 100
|
||||
else:
|
||||
# if there is more than one battery in one laptop, the percentage left is
|
||||
# available for each battery separately, although state and remaining
|
||||
# time for overall block is shown in the status of the first battery
|
||||
batteries = status.split("\n")
|
||||
state_batteries=[]
|
||||
commasplitstatus_batteries=[]
|
||||
percentleft_batteries=[]
|
||||
time = ""
|
||||
for battery in batteries:
|
||||
if battery!='':
|
||||
state_batteries.append(battery.split(": ")[1].split(", ")[0])
|
||||
commasplitstatus = battery.split(", ")
|
||||
if not time:
|
||||
time = commasplitstatus[-1].strip()
|
||||
# check if it matches a time
|
||||
time = re.match(r"(\d+):(\d+)", time)
|
||||
if time:
|
||||
time = ":".join(time.groups())
|
||||
timeleft = " ({})".format(time)
|
||||
else:
|
||||
timeleft = ""
|
||||
|
||||
p = int(commasplitstatus[1].rstrip("%\n"))
|
||||
if p>0:
|
||||
percentleft_batteries.append(p)
|
||||
commasplitstatus_batteries.append(commasplitstatus)
|
||||
state = state_batteries[0]
|
||||
commasplitstatus = commasplitstatus_batteries[0]
|
||||
if percentleft_batteries:
|
||||
percentleft = int(sum(percentleft_batteries)/len(percentleft_batteries))
|
||||
else:
|
||||
percentleft = 0
|
||||
|
||||
# stands for charging
|
||||
color = config.get("color_charging", "yellow")
|
||||
FA_LIGHTNING = "<span color='{}'><span font='FontAwesome'>\uf0e7</span></span>".format(color)
|
||||
|
||||
# stands for plugged in
|
||||
FA_PLUG = "<span font='FontAwesome'>\uf1e6</span>"
|
||||
|
||||
# stands for using battery
|
||||
FA_BATTERY = "<span font='FontAwesome'>\uf240</span>"
|
||||
|
||||
# stands for unknown status of battery
|
||||
FA_QUESTION = "<span font='FontAwesome'>\uf128</span>"
|
||||
|
||||
|
||||
if state == "Discharging":
|
||||
fulltext = FA_BATTERY + " "
|
||||
elif state == "Full":
|
||||
fulltext = FA_PLUG + " "
|
||||
timeleft = ""
|
||||
elif state == "Unknown":
|
||||
fulltext = FA_QUESTION + " " + FA_BATTERY + " "
|
||||
timeleft = ""
|
||||
else:
|
||||
fulltext = FA_LIGHTNING + " " + FA_PLUG + " "
|
||||
|
||||
def color(percent):
|
||||
if percent < 10:
|
||||
# exit code 33 will turn background red
|
||||
return config.get("color_10", "#FFFFFF")
|
||||
if percent < 20:
|
||||
return config.get("color_20", "#FF3300")
|
||||
if percent < 30:
|
||||
return config.get("color_30", "#FF6600")
|
||||
if percent < 40:
|
||||
return config.get("color_40", "#FF9900")
|
||||
if percent < 50:
|
||||
return config.get("color_50", "#FFCC00")
|
||||
if percent < 60:
|
||||
return config.get("color_60", "#FFFF00")
|
||||
if percent < 70:
|
||||
return config.get("color_70", "#FFFF33")
|
||||
if percent < 80:
|
||||
return config.get("color_80", "#FFFF66")
|
||||
return config.get("color_full", "#FFFFFF")
|
||||
|
||||
form = '<span color="{}">{}%</span>'
|
||||
fulltext += form.format(color(percentleft), percentleft)
|
||||
#fulltext += timeleft
|
||||
|
||||
print(fulltext)
|
||||
print(fulltext)
|
||||
if percentleft < 10:
|
||||
exit(33)
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
#
|
||||
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
|
||||
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
|
||||
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
|
||||
#
|
||||
# Licensed under the terms of the GNU GPL v3, or any later version.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
use Getopt::Long;
|
||||
|
||||
# default values
|
||||
my $t_warn = $ENV{T_WARN} // 50;
|
||||
my $t_crit = $ENV{T_CRIT} // 80;
|
||||
my $cpu_usage = -1;
|
||||
my $decimals = $ENV{DECIMALS} // 0;
|
||||
my $label = $ENV{LABEL} // "";
|
||||
|
||||
sub help {
|
||||
print "Usage: cpu_usage [-w <warning>] [-c <critical>] [-d <decimals>]\n";
|
||||
print "-w <percent>: warning threshold to become yellow\n";
|
||||
print "-c <percent>: critical threshold to become red\n";
|
||||
print "-d <decimals>: Use <decimals> decimals for percentage (default is $decimals) \n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
GetOptions("help|h" => \&help,
|
||||
"w=i" => \$t_warn,
|
||||
"c=i" => \$t_crit,
|
||||
"d=i" => \$decimals,
|
||||
);
|
||||
|
||||
# Get CPU usage
|
||||
$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
|
||||
open (MPSTAT, 'mpstat 1 1 |') or die;
|
||||
while (<MPSTAT>) {
|
||||
if (/^.*\s+(\d+\.\d+)[\s\x00]?$/) {
|
||||
$cpu_usage = 100 - $1; # 100% - %idle
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(MPSTAT);
|
||||
|
||||
$cpu_usage eq -1 and die 'Can\'t find CPU information';
|
||||
|
||||
# Print short_text, full_text
|
||||
print "${label}";
|
||||
printf "%02.${decimals}f%%\n", $cpu_usage;
|
||||
print "${label}";
|
||||
printf "%02.${decimals}f%%\n", $cpu_usage;
|
||||
|
||||
# Print color, if needed
|
||||
if ($cpu_usage >= $t_crit) {
|
||||
print "#FF0000\n";
|
||||
exit 33;
|
||||
} elsif ($cpu_usage >= $t_warn) {
|
||||
print "#FFFC00\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
DIR="${DIR:-$BLOCK_INSTANCE}"
|
||||
DIR="${DIR:-$HOME}"
|
||||
ALERT_LOW="${ALERT_LOW:-$1}"
|
||||
ALERT_LOW="${ALERT_LOW:-10}" # color will turn red under this value (default: 10%)
|
||||
|
||||
LOCAL_FLAG="-l"
|
||||
if [ "$1" = "-n" ] || [ "$2" = "-n" ]; then
|
||||
LOCAL_FLAG=""
|
||||
fi
|
||||
|
||||
df -h -P $LOCAL_FLAG "$DIR" | awk -v label="$LABEL" -v alert_low=$ALERT_LOW '
|
||||
/\/.*/ {
|
||||
# full text
|
||||
print label $4
|
||||
|
||||
# short text
|
||||
print label $4
|
||||
|
||||
use=$5
|
||||
|
||||
# no need to continue parsing
|
||||
exit 0
|
||||
}
|
||||
|
||||
END {
|
||||
gsub(/%$/,"",use)
|
||||
if (100 - use < alert_low) {
|
||||
# color
|
||||
print "#FF0000"
|
||||
}
|
||||
}
|
||||
'
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
KBD=$(/usr/bin/xkblayout-state print '%s')
|
||||
echo $KBD
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
Main() {
|
||||
source /usr/share/endeavouros/scripts/eos-script-lib-yad || return 1
|
||||
|
||||
local command=(
|
||||
eos_yad --title="EndeavourOS i3-wm keybindings:" --no-buttons --geometry=400x345-15-400 --list
|
||||
--column=key: --column=description: --column=command:
|
||||
"ESC" "close this app" ""
|
||||
"=" "modkey" "(set mod Mod4)"
|
||||
"+enter" "open a terminal" ""
|
||||
"+Shift+n" "new empty workspace" ""
|
||||
"+w" "open Browser" ""
|
||||
"+n" "open Filebrowser" ""
|
||||
"+d" "app menu" ""
|
||||
"+q" "close focused app" ""
|
||||
"Print-key" "screenshot" ""
|
||||
"+Shift+e" "logout menu" ""
|
||||
"F1" "open keybinding helper" ""
|
||||
)
|
||||
|
||||
"${command[@]}"
|
||||
}
|
||||
|
||||
Main "$@"
|
||||
@@ -1,6 +0,0 @@
|
||||
I3_CONFIG=$HOME/.config/i3/config
|
||||
mod_key=$(sed -nre 's/^set \$mod (.*)/\1/p' ${I3_CONFIG})
|
||||
grep "^bindsym" ${I3_CONFIG} \
|
||||
| sed "s/-\(-\w\+\)\+//g;s/\$mod/${mod_key}/g;s/Mod1/Alt/g;s/exec //;s/bindsym //;s/^\s\+//;s/^\([^ ]\+\) \(.\+\)$/\2: \1/;s/^\s\+//" \
|
||||
| tr -s ' ' \
|
||||
| rofi -dmenu -theme ~/.config/rofi/rofikeyhint.rasi
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
TYPE="${BLOCK_INSTANCE:-mem}"
|
||||
|
||||
awk -v type=$TYPE '
|
||||
/^MemTotal:/ {
|
||||
mem_total=$2
|
||||
}
|
||||
/^MemFree:/ {
|
||||
mem_free=$2
|
||||
}
|
||||
/^Buffers:/ {
|
||||
mem_free+=$2
|
||||
}
|
||||
/^Cached:/ {
|
||||
mem_free+=$2
|
||||
}
|
||||
/^SwapTotal:/ {
|
||||
swap_total=$2
|
||||
}
|
||||
/^SwapFree:/ {
|
||||
swap_free=$2
|
||||
}
|
||||
END {
|
||||
if (type == "swap") {
|
||||
free=swap_free/1024/1024
|
||||
used=(swap_total-swap_free)/1024/1024
|
||||
total=swap_total/1024/1024
|
||||
} else {
|
||||
free=mem_free/1024/1024
|
||||
used=(mem_total-mem_free)/1024/1024
|
||||
total=mem_total/1024/1024
|
||||
}
|
||||
|
||||
pct=0
|
||||
if (total > 0) {
|
||||
pct=used/total*100
|
||||
}
|
||||
|
||||
# full text
|
||||
# printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct)
|
||||
|
||||
# short text
|
||||
printf("%.f%%\n", pct)
|
||||
|
||||
# color
|
||||
if (pct > 90) {
|
||||
print("#FF0000")
|
||||
} else if (pct > 80) {
|
||||
print("#FFAE00")
|
||||
} else if (pct > 70) {
|
||||
print("#FFF600")
|
||||
}
|
||||
}
|
||||
' /proc/meminfo
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Edited by Andreas Lindlbauer <endeavouros.mousily@aleeas.com>
|
||||
|
||||
temps=("#0600FF" "#0500FF" "#0400FF" "#0300FF" "#0200FF" "#0100FF" "#0000FF" "#0002FF" "#0012FF" "#0022FF" "#0032FF" "#0044FF" "#0054FF" "#0064FF" "#0074FF" "#0084FF" "#0094FF" "#00A4FF" "#00B4FF" "#00C4FF" "#00D4FF" "#00E4FF" "#00FFF4" "#00FFD0" "#00FFA8" "#00FF83" "#00FF5C" "#00FF36" "#00FF10" "#17FF00" "#3EFF00" "#65FF00" "#B0FF00" "#FDFF00" "#FFF000" "#FFDC00" "#FFC800" "#FFB400" "#FFA000" "#FF8C00" "#FF7800" "#FF6400" "#FF5000" "#FF3C00" "#FF2800" "#FF1400" "#FF0000")
|
||||
|
||||
command -v jq >/dev/null 2>&1 || { echo >&2 "Program 'jq' required but it is not installed.
|
||||
Aborting."; exit 1; }
|
||||
command -v wget >/dev/null 2>&1 || { echo >&2 "Program 'wget' required but is not installed.
|
||||
Aborting."; exit 1; }
|
||||
|
||||
# To use this script you need to create an API key here https://home.openweathermap.org
|
||||
# You need to put your Open Weather APIKEY here:
|
||||
APIKEY="keykeykey"
|
||||
# And get your Latitute and Longitudes to put in here:
|
||||
LAT="XX.XXXX"
|
||||
LON="XX.XXXX"
|
||||
URL="http://api.openweathermap.org/data/2.5/onecall?lat=${LAT}&lon=${LON}&units=metric&exclude=minutely,hourly,daily&APPID=${APIKEY}"
|
||||
WEATHER_RESPONSE=$(wget -qO- "${URL}")
|
||||
|
||||
WEATHER_CONDITION=$(echo "$WEATHER_RESPONSE" | jq '.current.weather[0].main' | sed 's/"//g')
|
||||
WEATHER_TEMP=$(echo "$WEATHER_RESPONSE" | jq '.current.feels_like')
|
||||
WEATHER_INT=${WEATHER_TEMP%.*}
|
||||
|
||||
TIME_NOW=$( echo "$WEATHER_RESPONSE" | jq '.current.dt')
|
||||
SUNRISE=$( echo "$WEATHER_RESPONSE" | jq '.current.sunrise')
|
||||
SUNSET=$( echo "$WEATHER_RESPONSE" | jq '.current.sunset')
|
||||
DESCRIPTION=$( echo "$WEATHER_RESPONSE" | jq '.current.weather[0].description' | sed 's/"//g')
|
||||
WEATHER_ALERT=$( echo "$WEATHER_RESPONSE" | jq '.alerts[0].event' | sed 's/"//g')
|
||||
DAYTIME="n"
|
||||
|
||||
if [[ "$TIME_NOW" > "$SUNRISE" ]] && [[ "$TIME_NOW" < "$SUNSET" ]]; then
|
||||
DAYTIME="d"
|
||||
fi
|
||||
|
||||
case $WEATHER_CONDITION in
|
||||
'Clouds')
|
||||
if [ "$DAYTIME" == "d" ]; then
|
||||
WEATHER_ICON=""
|
||||
else
|
||||
WEATHER_ICON=""
|
||||
fi
|
||||
;;
|
||||
'Rain')
|
||||
WEATHER_ICON=""
|
||||
;;
|
||||
'Drizzle')
|
||||
if [ "$DAYTIME" == "d" ]; then
|
||||
WEATHER_ICON=""
|
||||
else
|
||||
WEATHER_ICON=""
|
||||
fi
|
||||
;;
|
||||
'Thunderstorm')
|
||||
WEATHER_ICON=""
|
||||
;;
|
||||
'Snow')
|
||||
WEATHER_ICON=""
|
||||
;;
|
||||
'Clear')
|
||||
if [ "$DAYTIME" == "d" ]; then
|
||||
WEATHER_ICON=""
|
||||
else
|
||||
WEATHER_ICON=""
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
WEATHER_ICON="🌫"
|
||||
;;
|
||||
esac
|
||||
|
||||
WEATHER_COLOR="#FFFFFF"
|
||||
if [ "$WEATHER_INT" -lt "-11" ]; then
|
||||
WEATHER_COLOR="#0000FF"
|
||||
elif [ "$WEATHER_INT" -gt 35 ]; then
|
||||
WEATHER_COLOR="#FF0000"
|
||||
else
|
||||
WEATHER_INT=$(( WEATHER_INT + 11 ))
|
||||
WEATHER_COLOR="${temps[$WEATHER_INT]}"
|
||||
fi
|
||||
|
||||
full_text="${WEATHER_ICON} ${WEATHER_TEMP}°C: ${DESCRIPTION} "
|
||||
if [ "$WEATHER_ALERT" != "null" ]; then
|
||||
WARN_START=$(echo "$WEATHER_RESPONSE" | jq '.alerts[0].start')
|
||||
WARN_END=$(echo "$WEATHER_RESPONSE" | jq '.alerts[0].end')
|
||||
WARN_START=$(date -d @"$WARN_START" +%a_%k:%M)
|
||||
WARN_END=$(date -d @"$WARN_END" +%a_%k:%M)
|
||||
full_text="${WEATHER_ICON} ${WEATHER_TEMP}°C: ${DESCRIPTION} ${WEATHER_ALERT} from ${WARN_START} to ${WARN_END} "
|
||||
fi
|
||||
|
||||
|
||||
echo "${full_text}"
|
||||
echo "${WEATHER_TEMP}°C "
|
||||
echo "${WEATHER_COLOR}"
|
||||
@@ -1,43 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
command -v jq >/dev/null 2>&1 || { echo >&2 "Program 'jq' required but it is not installed.
|
||||
Aborting."; exit 1; }
|
||||
command -v wget >/dev/null 2>&1 || { echo >&2 "Program 'wget' required but is not installed.
|
||||
Aborting."; exit 1; }
|
||||
|
||||
# To use this script you need to create an API key here https://home.openweathermap.org
|
||||
# You need to put your Open Weather APIKEY here:
|
||||
APIKEY="keykey"
|
||||
# find your City ID here: https://openweathermap.org/
|
||||
# search for your city and copy the ID from the URL inside the browser.
|
||||
CITY_ID="idid"
|
||||
URL="http://api.openweathermap.org/data/2.5/weather?id=${CITY_ID}&units=metric&APPID=${APIKEY}"
|
||||
|
||||
WEATHER_RESPONSE=$(wget -qO- "${URL}")
|
||||
|
||||
WEATHER_CONDITION=$(echo $WEATHER_RESPONSE | jq '.weather[0].main' | sed 's/"//g')
|
||||
WEATHER_TEMP=$(echo $WEATHER_RESPONSE | jq '.main.temp')
|
||||
WIND_DIR=$( echo "$WEATHER_RESPONSE" | jq '.wind.deg')
|
||||
WIND_SPEED=$( echo "$WEATHER_RESPONSE" | jq '.wind.speed')
|
||||
|
||||
WIND_SPEED=$(awk "BEGIN {print 60*60*$WIND_SPEED/1000}")
|
||||
WIND_DIR=$(awk "BEGIN {print int(($WIND_DIR % 360)/22.5)}")
|
||||
DIR_ARRAY=( N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW N )
|
||||
WIND_DIR=${DIR_ARRAY[WIND_DIR]}
|
||||
|
||||
case $WEATHER_CONDITION in
|
||||
'Clouds')
|
||||
WEATHER_ICON=""
|
||||
;;
|
||||
'Rain')
|
||||
WEATHER_ICON=""
|
||||
;;
|
||||
'Snow')
|
||||
WEATHER_ICON=""
|
||||
;;
|
||||
*)
|
||||
WEATHER_ICON=""
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "${WEATHER_ICON} ${WEATHER_TEMP}°C: ${WIND_SPEED} km/h ${WIND_DIR}"
|
||||
@@ -1,5 +0,0 @@
|
||||
# Weather
|
||||
[Weather]
|
||||
command=~/.config/i3/scripts/openweather
|
||||
interval=1800
|
||||
color=#7275b3
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# power-profiles-daemon implementation:
|
||||
# needs package power-profiles-daemon installed and the service running see here:
|
||||
# https://wiki.archlinux.org/title/CPU_frequency_scaling#power-profiles-daemon
|
||||
# used in i3-blocks: ~/.config/i3/i3blocks.conf together with: ~/.config/i3/scripts/power-profiles
|
||||
|
||||
# script to show current power profile
|
||||
|
||||
current_profile=$(powerprofilesctl get)
|
||||
echo "$current_profile"
|
||||
@@ -1,86 +0,0 @@
|
||||
#!/usr/bin/env perl
|
||||
# Copyright 2014 Pierre Mavro <deimos@deimos.fr>
|
||||
# Copyright 2014 Vivien Didelot <vivien@didelot.org>
|
||||
# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>
|
||||
# Copyright 2014 Benjamin Chretien <chretien at lirmm dot fr>
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Edited by Andreas Lindlbauer <endeavouros.mousily@aleeas.com>
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use utf8;
|
||||
use Getopt::Long;
|
||||
|
||||
binmode(STDOUT, ":utf8");
|
||||
|
||||
# default values
|
||||
my $t_warn = $ENV{T_WARN} || 70;
|
||||
my $t_crit = $ENV{T_CRIT} || 90;
|
||||
my $chip = $ENV{SENSOR_CHIP} || "";
|
||||
my $temperature = -9999;
|
||||
my $label = "😀 ";
|
||||
|
||||
sub help {
|
||||
print "Usage: temperature [-w <warning>] [-c <critical>] [--chip <chip>]\n";
|
||||
print "-w <percent>: warning threshold to become yellow\n";
|
||||
print "-c <percent>: critical threshold to become red\n";
|
||||
print "--chip <chip>: sensor chip\n";
|
||||
exit 0;
|
||||
}
|
||||
|
||||
GetOptions("help|h" => \&help,
|
||||
"w=i" => \$t_warn,
|
||||
"c=i" => \$t_crit,
|
||||
"chip=s" => \$chip);
|
||||
|
||||
# Get chip temperature
|
||||
open (SENSORS, "sensors -u $chip |") or die;
|
||||
while (<SENSORS>) {
|
||||
if (/^\s+temp1_input:\s+[\+]*([\-]*\d+\.\d)/) {
|
||||
$temperature = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(SENSORS);
|
||||
|
||||
$temperature eq -9999 and die 'Cannot find temperature';
|
||||
|
||||
if ($temperature < 45) {
|
||||
$label = '';
|
||||
} elsif ($temperature < 55) {
|
||||
$label = '';
|
||||
} elsif ($temperature < 65) {
|
||||
$label = '';
|
||||
} elsif ($temperature < 75) {
|
||||
$label = '';
|
||||
} else {
|
||||
$label = '';
|
||||
}
|
||||
# Print short_text, full_text
|
||||
print "${label}";
|
||||
print " $temperature°C\n";
|
||||
print "${label}";
|
||||
print " $temperature°C\n";
|
||||
|
||||
# Print color, if needed
|
||||
if ($temperature >= $t_crit) {
|
||||
print "#FF0000\n";
|
||||
exit 33;
|
||||
} elsif ($temperature >= $t_warn) {
|
||||
print "#FFFC00\n";
|
||||
}
|
||||
|
||||
exit 0;
|
||||
@@ -1,93 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>
|
||||
# Copyright (C) 2014 Alexander Keller <github@nycroth.com>
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# original source: https://github.com/vivien/i3blocks-contrib/tree/master/volume
|
||||
# check the readme: https://github.com/vivien/i3blocks-contrib/blob/master/volume/README.md
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
# The second parameter overrides the mixer selection
|
||||
# For PulseAudio users, eventually use "pulse"
|
||||
# For Jack/Jack2 users, use "jackplug"
|
||||
# For ALSA users, you may use "default" for your primary card
|
||||
# or you may use hw:# where # is the number of the card desired
|
||||
if [[ -z "$MIXER" ]] ; then
|
||||
MIXER="default"
|
||||
if command -v pulseaudio >/dev/null 2>&1 && pulseaudio --check ; then
|
||||
# pulseaudio is running, but not all installations use "pulse"
|
||||
if amixer -D pulse info >/dev/null 2>&1 ; then
|
||||
MIXER="pulse"
|
||||
fi
|
||||
fi
|
||||
[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
|
||||
MIXER="${2:-$MIXER}"
|
||||
fi
|
||||
|
||||
# The instance option sets the control to report and configure
|
||||
# This defaults to the first control of your selected mixer
|
||||
# For a list of the available, use `amixer -D $Your_Mixer scontrols`
|
||||
if [[ -z "$SCONTROL" ]] ; then
|
||||
SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
|
||||
sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" |
|
||||
head -n1
|
||||
)}"
|
||||
fi
|
||||
|
||||
# The first parameter sets the step to change the volume by (and units to display)
|
||||
# This may be in in % or dB (eg. 5% or 3dB)
|
||||
if [[ -z "$STEP" ]] ; then
|
||||
STEP="${1:-5%}"
|
||||
fi
|
||||
|
||||
# AMIXER(1):
|
||||
# "Use the mapped volume for evaluating the percentage representation like alsamixer, to be
|
||||
# more natural for human ear."
|
||||
NATURAL_MAPPING=${NATURAL_MAPPING:-0}
|
||||
if [[ "$NATURAL_MAPPING" != "0" ]] ; then
|
||||
AMIXER_PARAMS="-M"
|
||||
fi
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
capability() { # Return "Capture" if the device is a capture device
|
||||
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL |
|
||||
sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
|
||||
}
|
||||
|
||||
volume() {
|
||||
amixer $AMIXER_PARAMS -D $MIXER get $SCONTROL $(capability)
|
||||
}
|
||||
|
||||
format() {
|
||||
|
||||
perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
|
||||
perl_filter+='{CORE::say $4 eq "off" ? "MUTE" : "'
|
||||
# If dB was selected, print that instead
|
||||
perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
|
||||
perl_filter+='"; exit}'
|
||||
output=$(perl -ne "$perl_filter")
|
||||
echo "$LABEL$output"
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
3) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
|
||||
4) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ unmute ;; # scroll up, increase
|
||||
5) amixer $AMIXER_PARAMS -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- unmute ;; # scroll down, decrease
|
||||
esac
|
||||
|
||||
volume | format
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (C) 2021 Andreas Lindlbauer
|
||||
# Licensed under the terms of EUPLv1.2.
|
||||
#
|
||||
# i3blocks blocklet script to monitor the (nord)vpn connection
|
||||
|
||||
vpnstatus="📢"
|
||||
nordvpn_output=$(nordvpn status | cat -v | head -1 | sed -e 's/\^M-^M ^M//g' )
|
||||
if [ "${nordvpn_output}" = "Status: Connected" ]; then
|
||||
vpnstatus="🥸"
|
||||
elif [ "${nordvpn_output}" = "A new version of NordVPN is available! Please update the application." ]; then
|
||||
nordvpn_output=$(nordvpn status | cat -v | head -2 | tail -1 | sed -e 's/\^M-^M ^M//g' )
|
||||
if [ "${nordvpn_output}" = "Status: Connected" ]; then
|
||||
vpnstatus="🥴"
|
||||
elif [ "${nordvpn_output}" = "Status: Disconnected" ]; then
|
||||
vpnstatus="📢"
|
||||
fi
|
||||
elif [ "${nordvpn_output}" = "Status: Disconnected" ]; then
|
||||
vpnstatus="📢"
|
||||
elif [[ "$nordvpn_output" == *\/* ]] || [[ "$nordvpn_output" == *\\* ]]; then
|
||||
vpnstatus="Something's very wrong"
|
||||
fi
|
||||
|
||||
echo "$vpnstatus"
|
||||
@@ -0,0 +1,13 @@
|
||||
# Home Manager's Linux Submodules
|
||||
|
||||
1. `base`: The base module that is suitable for any NixOS environment.
|
||||
2. `desktop`: Configuration for desktop environments, such as Hyprland, I3, etc.
|
||||
3. `fcitx5`: fcitx5's configuration(Chinese input method).
|
||||
4. `hyprland`: Hyprland's configuration.
|
||||
5. `i3`: i3's configuration.
|
||||
6. `server.nix`: Configuration which is suitable for both servers and desktops. It import only `base` as its submodule.
|
||||
1. used by all my nixos servers.
|
||||
6. `desktop-hyprland.nix`: the entrypoint of hyprland's configuration, it import all the submodules above, except `i3`.
|
||||
1. used by my hyprland desktop.
|
||||
7. `desktop-i3.nix`: the entrypoint of i3's configuration, it import all the submodules above, except `hyprland`.
|
||||
1. used by my i3 desktop.
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
imports = [
|
||||
./shell.nix
|
||||
./system-tools.nix
|
||||
];
|
||||
}
|
||||
@@ -1,27 +1,22 @@
|
||||
{config, ...}: let
|
||||
{config, nushell-scripts, ...}: let
|
||||
d = config.xdg.dataHome;
|
||||
c = config.xdg.configHome;
|
||||
cache = config.xdg.cacheHome;
|
||||
in {
|
||||
imports = [
|
||||
./nushell
|
||||
./common.nix
|
||||
./starship.nix
|
||||
./terminals.nix
|
||||
];
|
||||
|
||||
in rec {
|
||||
# add environment variables
|
||||
home.sessionVariables = {
|
||||
systemd.user.sessionVariables = {
|
||||
# clean up ~
|
||||
LESSHISTFILE = cache + "/less/history";
|
||||
LESSKEY = c + "/less/lesskey";
|
||||
WINEPREFIX = d + "/wine";
|
||||
XAUTHORITY = "$XDG_RUNTIME_DIR/Xauthority";
|
||||
|
||||
# set this variable make i3 failed to start
|
||||
# related issue:
|
||||
# https://github.com/sddm/sddm/issues/871
|
||||
# XAUTHORITY = "$XDG_RUNTIME_DIR/Xauthority";
|
||||
|
||||
# set default applications
|
||||
EDITOR = "vim";
|
||||
BROWSER = "firefox";
|
||||
TERMINAL = "alacritty";
|
||||
|
||||
# enable scrolling in git diff
|
||||
DELTA_PAGER = "less -R";
|
||||
@@ -29,7 +24,5 @@ in {
|
||||
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
|
||||
};
|
||||
|
||||
home.shellAliases = {
|
||||
k = "kubectl";
|
||||
};
|
||||
}
|
||||
home.sessionVariables = systemd.user.sessionVariables;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{pkgs, ...}: {
|
||||
# Linux Only Packages, not available on Darwin
|
||||
home.packages = with pkgs; [
|
||||
nmon
|
||||
iotop
|
||||
iftop
|
||||
|
||||
# misc
|
||||
libnotify
|
||||
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
||||
|
||||
# system call monitoring
|
||||
strace # system call monitoring
|
||||
ltrace # library call monitoring
|
||||
bpftrace # powerful tracing tool
|
||||
tcpdump # network sniffer
|
||||
lsof # list open files
|
||||
|
||||
# system tools
|
||||
sysstat
|
||||
lm_sensors # for `sensors` command
|
||||
ethtool
|
||||
pciutils # lspci
|
||||
usbutils # lsusb
|
||||
hdparm # for disk performance, command
|
||||
dmidecode # a tool that reads information about your system's hardware from the BIOS according to the SMBIOS/DMI standard
|
||||
];
|
||||
|
||||
# auto mount usb drives
|
||||
services = {
|
||||
udiskie.enable = true;
|
||||
};
|
||||
|
||||
services = {
|
||||
# syncthing.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{ 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;
|
||||
}
|
||||
@@ -1,20 +1,19 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
|
||||
{ username, ... }: {
|
||||
imports = [
|
||||
../base/desktop
|
||||
|
||||
./base
|
||||
./fcitx5
|
||||
./desktop
|
||||
|
||||
./i3
|
||||
./programs
|
||||
./rofi
|
||||
./shell
|
||||
];
|
||||
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home = {
|
||||
username = "ryan";
|
||||
homeDirectory = "/home/ryan";
|
||||
username = username;
|
||||
homeDirectory = "/home/${username}";
|
||||
|
||||
# This value determines the Home Manager release that your
|
||||
# configuration is compatible with. This helps avoid breakage
|
||||
@@ -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,36 @@
|
||||
{pkgs, ...}: {
|
||||
imports = [
|
||||
./creative.nix
|
||||
./gtk.nix
|
||||
./immutable-file.nix
|
||||
./media.nix
|
||||
./ssh.nix
|
||||
./wallpaper.nix
|
||||
./xdg.nix
|
||||
];
|
||||
|
||||
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,52 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
home.pointerCursor = {
|
||||
package = pkgs.bibata-cursors;
|
||||
name = "Bibata-Modern-Classic";
|
||||
size = 24;
|
||||
gtk.enable = true;
|
||||
x11.enable = true;
|
||||
};
|
||||
|
||||
# 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 = "Roboto";
|
||||
package = pkgs.roboto;
|
||||
};
|
||||
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
##############################################################################################
|
||||
#
|
||||
# Provide a option `home.immutable-file`, it works like `home.file` but make the generated file immutable.
|
||||
#
|
||||
# Copy from https://github.com/iosmanthus/nixos-config/blob/349917b/modules/immutable-file.nix
|
||||
#
|
||||
# this module use the `chattr +i` to make the file immutable, `i` indicates `immutable`,
|
||||
# it's a i-node flags only works on Linux.
|
||||
#
|
||||
# TODO not used yet, need to test it.
|
||||
#
|
||||
##############################################################################################
|
||||
with lib; let
|
||||
cfg = config.home.immutable-file;
|
||||
immutableFileOpts = {...}: {
|
||||
options = {
|
||||
src = mkOption {
|
||||
type = types.path;
|
||||
};
|
||||
dst = mkOption {
|
||||
type = types.path;
|
||||
};
|
||||
};
|
||||
};
|
||||
mkImmutableFile = pkgs.writeScript "make_immutable_file" ''
|
||||
# $1: dst
|
||||
# $2: src
|
||||
if [ ! -d "$(dirname $1)" ]; then
|
||||
mkdir -p $1
|
||||
fi
|
||||
|
||||
if [ -f $1 ]; then
|
||||
sudo chattr -i $1
|
||||
fi
|
||||
|
||||
sudo cp $2 $1
|
||||
sudo chattr +i $1
|
||||
'';
|
||||
in {
|
||||
options.home.immutable-file = mkOption {
|
||||
type = with types; attrsOf (submodule immutableFileOpts);
|
||||
default = {};
|
||||
};
|
||||
|
||||
config = mkIf (cfg != {}) {
|
||||
home.activation =
|
||||
mapAttrs'
|
||||
(name: {
|
||||
src,
|
||||
dst,
|
||||
}:
|
||||
nameValuePair
|
||||
"make-immutable-${name}"
|
||||
(lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||
${mkImmutableFile} ${dst} ${src}
|
||||
''))
|
||||
cfg;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
pkgs,
|
||||
catppuccin-cava,
|
||||
pkgs-unstable,
|
||||
...
|
||||
}:
|
||||
# media - control and enjoy audio/video
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
# audio control
|
||||
pavucontrol
|
||||
playerctl
|
||||
pulsemixer
|
||||
imv # simple image viewer
|
||||
|
||||
nvtop
|
||||
|
||||
# video/audio tools
|
||||
cava # for visualizing audio
|
||||
libva-utils
|
||||
vdpauinfo
|
||||
vulkan-tools
|
||||
glxinfo
|
||||
];
|
||||
|
||||
# https://github.com/catppuccin/cava
|
||||
home.file.".config/cava/config".text = ''
|
||||
# custom cava config
|
||||
'' + builtins.readFile "${catppuccin-cava}/mocha.cava";
|
||||
|
||||
programs = {
|
||||
mpv = {
|
||||
enable = true;
|
||||
defaultProfiles = ["gpu-hq"];
|
||||
scripts = [pkgs.mpvScripts.mpris];
|
||||
};
|
||||
|
||||
# terminal file manager
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
playerctld.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
{pkgs, ...}: {
|
||||
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
|
||||
# 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
|
||||
HostName 192.168.5.172
|
||||
Port 22
|
||||
|
||||
Host um560
|
||||
HostName 192.168.5.173
|
||||
Port 22
|
||||
|
||||
Host s500plus
|
||||
HostName 192.168.5.174
|
||||
Port 22
|
||||
|
||||
Host k8s-main
|
||||
HostName 192.168.5.181
|
||||
ForwardAgent yes
|
||||
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,10 @@
|
||||
{ wallpapers, ... }:
|
||||
|
||||
{
|
||||
# https://github.com/ryan4yin/wallpapers
|
||||
home.file.".config/wallpapers".source = wallpapers;
|
||||
home.file.".local/bin/wallpaper_random" = {
|
||||
source = "${wallpapers}/wallpaper_random.py";
|
||||
executable = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
# XDG stands for "Cross-Desktop Group", with X used to mean "cross".
|
||||
# It's a bunch of specifications from freedesktop.org intended to standardize desktops and
|
||||
# other GUI applications on various systems (primarily Unix-like) to be interoperable:
|
||||
# https://www.freedesktop.org/wiki/Specifications/
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
home.packages = with pkgs; [
|
||||
xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
|
||||
xdg-user-dirs
|
||||
];
|
||||
|
||||
xdg = {
|
||||
enable = true;
|
||||
cacheHome = config.home.homeDirectory + "/.local/cache";
|
||||
|
||||
# manage $XDG_CONFIG_HOME/mimeapps.list
|
||||
# xdg search all desktop entries from $XDG_DATA_DIRS, check it by command:
|
||||
# echo $XDG_DATA_DIRS
|
||||
# the system-level desktop entries can be list by command:
|
||||
# ls -l /run/current-system/sw/share/applications/
|
||||
# the user-level desktop entries can be list by command(user ryan):
|
||||
# ls /etc/profiles/per-user/ryan/share/applications/
|
||||
mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications = let
|
||||
browser = ["firefox.desktop"];
|
||||
in {
|
||||
"application/json" = browser;
|
||||
"application/pdf" = browser; # TODO: pdf viewer
|
||||
|
||||
"text/html" = browser;
|
||||
"text/xml" = browser;
|
||||
"application/xml" = browser;
|
||||
"application/xhtml+xml" = browser;
|
||||
"application/xhtml_xml" = browser;
|
||||
"application/rdf+xml" = browser;
|
||||
"application/rss+xml" = browser;
|
||||
"application/x-extension-htm" = browser;
|
||||
"application/x-extension-html" = browser;
|
||||
"application/x-extension-shtml" = browser;
|
||||
"application/x-extension-xht" = browser;
|
||||
"application/x-extension-xhtml" = browser;
|
||||
|
||||
"x-scheme-handler/about" = browser;
|
||||
"x-scheme-handler/ftp" = browser;
|
||||
"x-scheme-handler/http" = browser;
|
||||
"x-scheme-handler/https" = browser;
|
||||
"x-scheme-handler/unknown" = browser;
|
||||
|
||||
"x-scheme-handler/discord" = ["discord.desktop"];
|
||||
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
|
||||
|
||||
"audio/*" = ["mpv.desktop"];
|
||||
"video/*" = ["mpv.dekstop"];
|
||||
"image/*" = ["imv.desktop"];
|
||||
"image/gif" = ["imv.desktop"];
|
||||
"image/jpeg" = ["imv.desktop"];
|
||||
"image/png" = ["imv.desktop"];
|
||||
"image/webp" = ["imv.desktop"];
|
||||
};
|
||||
|
||||
associations.removed =
|
||||
{
|
||||
# ......
|
||||
};
|
||||
};
|
||||
|
||||
userDirs = {
|
||||
enable = true;
|
||||
createDirectories = true;
|
||||
extraConfig = {
|
||||
XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
# Vertical Candidate List
|
||||
Vertical Candidate List=False
|
||||
# Use Per Screen DPI
|
||||
PerScreenDPI=True
|
||||
# Use mouse wheel to go to prev or next page
|
||||
WheelForPaging=True
|
||||
# Font
|
||||
Font="Sans 10"
|
||||
# Menu Font
|
||||
MenuFont="Sans 10"
|
||||
# Tray Font
|
||||
TrayFont="Sans Bold 10"
|
||||
# Tray Label Outline Color
|
||||
TrayOutlineColor=#000000
|
||||
# Tray Label Text Color
|
||||
TrayTextColor=#ffffff
|
||||
# Prefer Text Icon
|
||||
PreferTextIcon=False
|
||||
# Show Layout Name In Icon
|
||||
ShowLayoutNameInIcon=True
|
||||
# Use input method language to display text
|
||||
UseInputMethodLangaugeToDisplayText=True
|
||||
# Theme macchiato, frappe, latte, mocha
|
||||
Theme=catppuccin-mocha
|
||||
# Force font DPI on Wayland
|
||||
ForceWaylandDPI=0
|
||||
@@ -0,0 +1,33 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
catppuccin-fcitx5,
|
||||
...
|
||||
}: {
|
||||
home.file.".config/fcitx5/profile".source = ./profile;
|
||||
|
||||
# color schema
|
||||
home.file.".local/share/fcitx5/themes".source = "${catppuccin-fcitx5}/src";
|
||||
home.file.".config/fcitx5/conf/classicui.conf".source = ./classicui.conf;
|
||||
|
||||
# every time fcitx5 switch input method, it will modify ~/.config/fcitx5/profile file,
|
||||
# which will override my config managed by home-manager
|
||||
# so we need to remove it before everytime we rebuild the config
|
||||
home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
||||
rm -f "${config.xdg.configHome}/fcitx5/profile"
|
||||
'';
|
||||
|
||||
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,17 @@
|
||||
[Groups/0]
|
||||
# Group Name
|
||||
Name=Other
|
||||
# Layout
|
||||
Default Layout=us
|
||||
# Default Input Method
|
||||
DefaultIM=rime
|
||||
|
||||
[Groups/0/Items/0]
|
||||
# Name
|
||||
Name=rime
|
||||
# Layout
|
||||
Layout=
|
||||
|
||||
[GroupOrder]
|
||||
0=Other
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
{ pkgs, anyrun, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
anyrun.homeManagerModules.default
|
||||
];
|
||||
|
||||
programs.anyrun = {
|
||||
enable = true;
|
||||
config = {
|
||||
plugins = with anyrun.packages.${pkgs.system}; [
|
||||
applications
|
||||
randr
|
||||
rink
|
||||
shell
|
||||
symbols
|
||||
translate
|
||||
];
|
||||
|
||||
width.fraction = 0.3;
|
||||
y.absolute = 15;
|
||||
hidePluginInfo = true;
|
||||
closeOnClick = true;
|
||||
};
|
||||
|
||||
# custom css for anyrun, based on catppuccin-mocha
|
||||
extraCss = ''
|
||||
@define-color bg-col rgba(30, 30, 46, 0.7);
|
||||
@define-color bg-col-light rgba(150, 220, 235, 0.7);
|
||||
@define-color border-col rgba(30, 30, 46, 0.7);
|
||||
@define-color selected-col rgba(150, 205, 251, 0.7);
|
||||
@define-color fg-col #D9E0EE;
|
||||
@define-color fg-col2 #F28FAD;
|
||||
|
||||
* {
|
||||
transition: 200ms ease;
|
||||
font-family: "JetBrainsMono Nerd Font";
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
#window {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#plugin,
|
||||
#main {
|
||||
border: 3px solid @border-col;
|
||||
color: @fg-col;
|
||||
background-color: @bg-col;
|
||||
}
|
||||
/* anyrun's input window - Text */
|
||||
#entry {
|
||||
color: @fg-col;
|
||||
background-color: @bg-col;
|
||||
}
|
||||
|
||||
/* anyrun's ouput matches entries - Base */
|
||||
#match {
|
||||
color: @fg-col;
|
||||
background: @bg-col;
|
||||
}
|
||||
|
||||
/* anyrun's selected entry - Red */
|
||||
#match:selected {
|
||||
color: @fg-col2;
|
||||
background: @selected-col;
|
||||
}
|
||||
|
||||
#match {
|
||||
padding: 3px;
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
#entry, #plugin:hover {
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
box#main {
|
||||
background: rgba(30, 30, 46, 0.7);
|
||||
border: 1px solid @border-col;
|
||||
border-radius: 15px;
|
||||
padding: 5px;
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
{pkgs, hyprland, catppuccin-hyprland, ...}: {
|
||||
imports = [
|
||||
# hyprland.homeManagerModules.default
|
||||
|
||||
./anyrun.nix
|
||||
./wayland-apps.nix
|
||||
];
|
||||
|
||||
# wayland.windowManager.hyprland.enable = true;
|
||||
|
||||
# hyprland configs, based on https://github.com/notwidow/hyprland
|
||||
home.file.".config/hypr" = {
|
||||
source = ./hypr-conf;
|
||||
# copy the scripts directory recursively
|
||||
recursive = true;
|
||||
};
|
||||
home.file.".config/hypr/themes".source = "${catppuccin-hyprland}/themes";
|
||||
|
||||
# music player - mpd
|
||||
home.file.".config/mpd" = {
|
||||
source = ./mpd;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
# allow fontconfig to discover fonts and configurations installed through home.packages
|
||||
fonts.fontconfig.enable = true;
|
||||
|
||||
systemd.user.sessionVariables = {
|
||||
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
|
||||
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
|
||||
"MOZ_WEBRENDER" = "1";
|
||||
|
||||
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
||||
"LIBVA_DRIVER_NAME" = "nvidia";
|
||||
"XDG_SESSION_TYPE" = "wayland";
|
||||
"GBM_BACKEND" = "nvidia-drm";
|
||||
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
|
||||
"WLR_NO_HARDWARE_CURSORS" = "1";
|
||||
"WLR_EGL_NO_MODIFIRES" = "1";
|
||||
};
|
||||
|
||||
}
|
||||