mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-05-28 18:39:31 +02:00
Compare commits
198 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a8f613ead1 | |||
| 5d69019f60 | |||
| 648021b0ca | |||
| c30730bedd | |||
| e9b502fa5f | |||
| 3e2340aee7 | |||
| 94c8eef2cb | |||
| 2581c9d562 | |||
| 3aaa4c0372 | |||
| c446a693ea | |||
| 9b0c5d7d50 | |||
| 86ee8132b7 | |||
| 2f3d644234 | |||
| 87dfa7669f | |||
| 64dd1fc2f3 | |||
| fc81143c10 | |||
| 5178a3e638 | |||
| b3127a18c9 | |||
| 15e0b150e9 | |||
| 41dc24e350 | |||
| 8c795c7d0d | |||
| b671c05db9 | |||
| 80e0bcf031 | |||
| 64ab375d1f | |||
| 325f82b9cc | |||
| 59a46844a7 | |||
| 5e21effb15 | |||
| 1e7b9697e1 | |||
| 422ec75ec0 | |||
| c059d90b17 | |||
| 880e0ac65e | |||
| ed4a2f00fe | |||
| 7a1788520b | |||
| e86d7a1020 | |||
| 6670c5bd7d | |||
| 0620f199b2 | |||
| e2457e80aa | |||
| 8ffaf4e3ae | |||
| f9d07d92de | |||
| 2b91c6f99d | |||
| fed3bc981b | |||
| d02331c1e0 | |||
| 5ec72c848f | |||
| 5a6ccd8794 | |||
| 3dc7ec1fe8 | |||
| 414a222d19 | |||
| 783d61999c | |||
| 86ec08aecb | |||
| b7b913b444 | |||
| aa0e1d84e0 | |||
| 94e2e17c60 | |||
| 41f4dc6237 | |||
| d7c0e7caa6 | |||
| d8759cc845 | |||
| 6c6ada4243 | |||
| 95cdd40c77 | |||
| a04d6dfdf6 | |||
| adf1415868 | |||
| b1c6f1b90f | |||
| 5e9f98e56d | |||
| 885205d9e3 | |||
| 385bcd2d87 | |||
| b3b55c36d8 | |||
| 7d6fa4028d | |||
| 0ea8548f37 | |||
| c29148fc77 | |||
| 1eecf89793 | |||
| 5fcf0d0995 | |||
| 66949f6b8f | |||
| 36ba5a4efc | |||
| 68285a70d0 | |||
| f97ad2fd1e | |||
| 1d66cf655d | |||
| 04fa05151a | |||
| 62d986d1c8 | |||
| 730906ebf2 | |||
| bcf5b8b1cb | |||
| 1f14f5899c | |||
| 9732c87d1f | |||
| 032f478d2a | |||
| 71cb1cf295 | |||
| 09a9e086d8 | |||
| e903f95a46 | |||
| 1239f4549a | |||
| 4433e018d9 | |||
| e9ac7d8ddc | |||
| cf51e77d75 | |||
| 095b092e08 | |||
| 4e4eb9a003 | |||
| 1efe489846 | |||
| ea13da3031 | |||
| 47a735d235 | |||
| 84c4708b98 | |||
| 12494d66af | |||
| 97ff571431 | |||
| c0e3af3fad | |||
| bbe2e80650 | |||
| 5bc941d9e2 | |||
| 7f6c061041 | |||
| b8e45b28e1 | |||
| 21555a4148 | |||
| 0f4387800f | |||
| 1095d8fa53 | |||
| 98e2e7196d | |||
| 0a764cfdf3 | |||
| 54e4dfcec0 | |||
| f37588df64 | |||
| 9adf87aaf5 | |||
| 82dccbdeca | |||
| af88851772 | |||
| b3d7d0d2a3 | |||
| b0fcf9d9e7 | |||
| 7bd264fee9 | |||
| 2a841a5a32 | |||
| e97e61c8d2 | |||
| c65018f450 | |||
| 218ff4c1da | |||
| e26c20a29b | |||
| 13751a4b66 | |||
| f4d91b6827 | |||
| 4f780f3f61 | |||
| a626458b8e | |||
| 87c041f8b4 | |||
| ace653e9d6 | |||
| bb913b181d | |||
| bec52f9d60 | |||
| de891782cb | |||
| 5abbd63284 | |||
| 14dabdcee5 | |||
| 5583f1ffe9 | |||
| 6b016a2432 | |||
| cad8cf325d | |||
| 9a0e41429a | |||
| 44ce90bf68 | |||
| 9fe6ef9165 | |||
| 4b2035a0dc | |||
| 21d85d41ef | |||
| 7fd3baca0f | |||
| ce645e7935 | |||
| 9631334088 | |||
| a9bb04c37d | |||
| ddad742023 | |||
| 21c9e572af | |||
| 6b2168b925 | |||
| 309469fa85 | |||
| 0e31ec94ce | |||
| fb6ca6b12d | |||
| a1d827a34e | |||
| efc524466c | |||
| fd62548dc0 | |||
| 9a45cc6448 | |||
| ac844a6a3d | |||
| c5dcc7e24d | |||
| a593435947 | |||
| 2d5a0c6783 | |||
| 0b9574d693 | |||
| 93c423a75b | |||
| 2b75504a22 | |||
| c0c9ed21ea | |||
| 33b3f33781 | |||
| 24248b3536 | |||
| 5b2d09d0e7 | |||
| 869aafd25b | |||
| b8797d5394 | |||
| 0bf035ba1a | |||
| 0b7d6428e0 | |||
| e6f6042c3c | |||
| b8ce5573f5 | |||
| 8c464a9aee | |||
| c78184a6bf | |||
| 487d410e70 | |||
| bbb678af00 | |||
| 11a4e368d5 | |||
| f831061889 | |||
| 468480b4e7 | |||
| 0e31885540 | |||
| e789e5aff3 | |||
| a9e3dd0c53 | |||
| 75202fb46c | |||
| ed5328c8de | |||
| 80c0ab327f | |||
| 4dc50e7e8c | |||
| 3bf5ff65de | |||
| 4775cc2742 | |||
| 34e7e9b2cd | |||
| 7396ee0201 | |||
| 0082e1ae54 | |||
| f5f27bff96 | |||
| 347ae9d4b1 | |||
| 74b948a722 | |||
| 81b3cd30cc | |||
| 5c69d6c22a | |||
| 33f690388d | |||
| 2047104704 | |||
| c628eaa6c8 | |||
| 7486e75016 | |||
| 8bc96ba0e8 | |||
| 68629e929c |
+2
-1
@@ -1,2 +1,3 @@
|
|||||||
|
github: ryan4yin
|
||||||
patreon: ryan4yin
|
patreon: ryan4yin
|
||||||
custom: ["https://buymeacoffee.com/ryan4yin", "https://afdian.net/a/ryan4yin"]
|
custom: ["https://buymeacoffee.com/ryan4yin"]
|
||||||
|
|||||||
@@ -3,3 +3,4 @@ result/
|
|||||||
.direnv/
|
.direnv/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.pre-commit-config.yaml
|
.pre-commit-config.yaml
|
||||||
|
logs/
|
||||||
|
|||||||
@@ -9,4 +9,6 @@ binary = false
|
|||||||
extend-ignore-re = [
|
extend-ignore-re = [
|
||||||
"iterm2",
|
"iterm2",
|
||||||
"iHgEIBYKACAWIQSizQe9ljFEyyclWmtVhZllwnQrSwUCZZ1T9wIdAAAKCRBVhZll", # crypto keys
|
"iHgEIBYKACAWIQSizQe9ljFEyyclWmtVhZllwnQrSwUCZZ1T9wIdAAAKCRBVhZll", # crypto keys
|
||||||
|
"noice", # noice.nvim
|
||||||
|
"crypted-nixos",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,67 +1,107 @@
|
|||||||
# just is a command runner, Justfile is very similar to Makefile, but simpler.
|
# just is a command runner, Justfile is very similar to Makefile, but simpler.
|
||||||
|
|
||||||
# use nushell for shell commands
|
# Use nushell for shell commands
|
||||||
|
# To usage this justfile, you need to enter a shell with just & nushell installed:
|
||||||
|
#
|
||||||
|
# nix shell nixpkgs#just nixpkgs#nushell
|
||||||
set shell := ["nu", "-c"]
|
set shell := ["nu", "-c"]
|
||||||
|
|
||||||
|
utils_nu := absolute_path("utils.nu")
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Nix commands related to the local machine
|
# Common commands(suitable for all machines)
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
i3 mode="default":
|
|
||||||
use utils.nu *; \
|
|
||||||
nixos-switch ai-i3 {{mode}}
|
|
||||||
|
|
||||||
hypr mode="default":
|
|
||||||
use utils.nu *; \
|
|
||||||
nixos-switch ai-hyprland {{mode}}
|
|
||||||
|
|
||||||
|
|
||||||
s-i3 mode="default":
|
|
||||||
use utils.nu *; \
|
|
||||||
nixos-switch shoukei-i3 {{mode}}
|
|
||||||
|
|
||||||
|
|
||||||
s-hypr mode="default":
|
|
||||||
use utils.nu *; \
|
|
||||||
nixos-switch shoukei-hyprland {{mode}}
|
|
||||||
|
|
||||||
# Run eval tests
|
# Run eval tests
|
||||||
|
[group('nix')]
|
||||||
test:
|
test:
|
||||||
nix eval .#evalTests --show-trace --print-build-logs --verbose
|
nix eval .#evalTests --show-trace --print-build-logs --verbose
|
||||||
|
|
||||||
# update all the flake inputs
|
# Update all the flake inputs
|
||||||
|
[group('nix')]
|
||||||
up:
|
up:
|
||||||
nix flake update
|
nix flake update
|
||||||
|
|
||||||
# Update specific input
|
# Update specific input
|
||||||
# Usage: just upp nixpkgs
|
# Usage: just upp nixpkgs
|
||||||
|
[group('nix')]
|
||||||
upp input:
|
upp input:
|
||||||
nix flake lock --update-input {{input}}
|
nix flake update {{input}}
|
||||||
|
|
||||||
# List all generations of the system profile
|
# List all generations of the system profile
|
||||||
|
[group('nix')]
|
||||||
history:
|
history:
|
||||||
nix profile history --profile /nix/var/nix/profiles/system
|
nix profile history --profile /nix/var/nix/profiles/system
|
||||||
|
|
||||||
# Open a nix shell with the flake
|
# Open a nix shell with the flake
|
||||||
|
[group('nix')]
|
||||||
repl:
|
repl:
|
||||||
nix repl -f flake:nixpkgs
|
nix repl -f flake:nixpkgs
|
||||||
|
|
||||||
# remove all generations older than 7 days
|
# remove all generations older than 7 days
|
||||||
|
[group('nix')]
|
||||||
clean:
|
clean:
|
||||||
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
|
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
|
||||||
|
|
||||||
# Garbage collect all unused nix store entries
|
# Garbage collect all unused nix store entries
|
||||||
|
[group('nix')]
|
||||||
gc:
|
gc:
|
||||||
# garbage collect all unused nix store entries
|
# garbage collect all unused nix store entries
|
||||||
sudo nix store gc --debug
|
|
||||||
sudo nix-collect-garbage --delete-old
|
sudo nix-collect-garbage --delete-old
|
||||||
|
|
||||||
# Remove all reflog entries and prune unreachable objects
|
# Enter a shell session which has all the necessary tools for this flake
|
||||||
gitgc:
|
[linux]
|
||||||
git reflog expire --expire-unreachable=now --all
|
[group('nix')]
|
||||||
git gc --prune=now
|
shell:
|
||||||
|
nix shell nixpkgs#git nixpkgs#neovim nixpkgs#colmena
|
||||||
|
|
||||||
|
# Enter a shell session which has all the necessary tools for this flake
|
||||||
|
[macos]
|
||||||
|
[group('nix')]
|
||||||
|
shell:
|
||||||
|
nix shell nixpkgs#git nixpkgs#neovim
|
||||||
|
|
||||||
|
[group('nix')]
|
||||||
|
fmt:
|
||||||
|
# format the nix files in this repo
|
||||||
|
nix fmt
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# NixOS Desktop related commands
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('desktop')]
|
||||||
|
i3 mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch ai-i3 {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('desktop')]
|
||||||
|
hypr mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch ai-hyprland {{mode}}
|
||||||
|
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('desktop')]
|
||||||
|
s-i3 mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch shoukei-i3 {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('desktop')]
|
||||||
|
s-hypr mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch shoukei-hyprland {{mode}}
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
@@ -69,84 +109,210 @@ gitgc:
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
[macos]
|
||||||
|
[group('desktop')]
|
||||||
darwin-set-proxy:
|
darwin-set-proxy:
|
||||||
sudo python3 scripts/darwin_set_proxy.py
|
sudo python3 scripts/darwin_set_proxy.py
|
||||||
sleep 1sec
|
sleep 1sec
|
||||||
|
|
||||||
|
[macos]
|
||||||
|
[group('desktop')]
|
||||||
darwin-rollback:
|
darwin-rollback:
|
||||||
use utils.nu *; \
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
darwin-rollback
|
darwin-rollback
|
||||||
|
|
||||||
# Deploy to harmonica(macOS host)
|
# Deploy to harmonica(macOS host)
|
||||||
|
[macos]
|
||||||
|
[group('desktop')]
|
||||||
ha mode="default":
|
ha mode="default":
|
||||||
use utils.nu *; \
|
#!/usr/bin/env nu
|
||||||
darwin-build "harmonica" {{mode}}; \
|
use {{utils_nu}} *;
|
||||||
|
darwin-build "harmonica" {{mode}};
|
||||||
darwin-switch "harmonica" {{mode}}
|
darwin-switch "harmonica" {{mode}}
|
||||||
|
|
||||||
# Depoly to fern(macOS host)
|
# Depoly to fern(macOS host)
|
||||||
|
[macos]
|
||||||
|
[group('desktop')]
|
||||||
fe mode="default": darwin-set-proxy
|
fe mode="default": darwin-set-proxy
|
||||||
use utils.nu *; \
|
#!/usr/bin/env nu
|
||||||
darwin-build "fern" {{mode}}; \
|
use {{utils_nu}} *;
|
||||||
|
darwin-build "fern" {{mode}};
|
||||||
darwin-switch "fern" {{mode}}
|
darwin-switch "fern" {{mode}}
|
||||||
|
|
||||||
# Reload yabai and skhd(macOS)
|
# Reload yabai and skhd(macOS)
|
||||||
|
[macos]
|
||||||
|
[group('desktop')]
|
||||||
yabai-reload:
|
yabai-reload:
|
||||||
launchctl kickstart -k "gui/502/org.nixos.yabai";
|
launchctl kickstart -k "gui/502/org.nixos.yabai";
|
||||||
launchctl kickstart -k "gui/502/org.nixos.skhd";
|
launchctl kickstart -k "gui/502/org.nixos.skhd";
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Homelab - Virtual Machines running on Kubevirt
|
# Homelab - Kubevirt Cluster related commands
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
# Remote deployment via colmena
|
# Remote deployment via colmena
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
col tag:
|
col tag:
|
||||||
colmena apply --on '@{{tag}}' --verbose --show-trace
|
colmena apply --on '@{{tag}}' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
local name mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch {{name}} {{mode}}
|
||||||
|
|
||||||
# Build and upload a vm image
|
# Build and upload a vm image
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
upload-vm name mode="default":
|
upload-vm name mode="default":
|
||||||
use utils.nu *; \
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
upload-vm {{name}} {{mode}}
|
upload-vm {{name}} {{mode}}
|
||||||
|
|
||||||
# Deploy all the KubeVirt nodes(Physical machines running KubeVirt)
|
# Deploy all the KubeVirt nodes(Physical machines running KubeVirt)
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
lab:
|
lab:
|
||||||
colmena apply --on '@virt-*' --verbose --show-trace
|
colmena apply --on '@virt-*' --verbose --show-trace
|
||||||
|
|
||||||
# Deploy all the VMs running on KubeVirt
|
[linux]
|
||||||
vm:
|
[group('homelab')]
|
||||||
colmena apply --on '@homelab-*' --verbose --show-trace
|
shoryu:
|
||||||
|
colmena apply --on '@kubevirt-shoryu' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
shoryu-local mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch kubevirt-shoryu {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
shushou:
|
||||||
|
colmena apply --on '@kubevirt-shushou' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
shushou-local mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch kubevirt-shushou {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
youko:
|
||||||
|
colmena apply --on '@kubevirt-youko' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
youko-local mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch kubevirt-youko {{mode}}
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# Commands for other Virtual Machines
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
# Build and upload a vm image
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
upload-idols mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
upload-vm aquamarine {{mode}}
|
||||||
|
upload-vm ruby {{mode}}
|
||||||
|
upload-vm kana {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
aqua:
|
aqua:
|
||||||
colmena apply --on '@aqua' --verbose --show-trace
|
colmena apply --on '@aqua' --verbose --show-trace
|
||||||
# some config changes require a restart of the dae service
|
|
||||||
ssh root@aquamarine "sudo systemctl stop dae; sleep 1; sudo systemctl start dae"
|
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
aqua-local mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch aquamarine {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
ruby:
|
ruby:
|
||||||
colmena apply --on '@ruby' --verbose --show-trace
|
colmena apply --on '@ruby' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
ruby-local mode="default":
|
ruby-local mode="default":
|
||||||
use utils.nu *; \
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
nixos-switch ruby {{mode}}
|
nixos-switch ruby {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
kana:
|
kana:
|
||||||
colmena apply --on '@kana' --verbose --show-trace
|
colmena apply --on '@kana' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
kana-local mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch kana {{mode}}
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Kubernetes related commands
|
# Kubernetes related commands
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
# Build and upload a vm image
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
upload-k3s mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
upload-vm k3s-prod-1-master-1 {{mode}};
|
||||||
|
upload-vm k3s-prod-1-master-2 {{mode}};
|
||||||
|
upload-vm k3s-prod-1-master-3 {{mode}};
|
||||||
|
upload-vm k3s-prod-1-worker-1 {{mode}};
|
||||||
|
upload-vm k3s-prod-1-worker-2 {{mode}};
|
||||||
|
upload-vm k3s-prod-1-worker-3 {{mode}};
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
upload-k3s-test mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
upload-vm k3s-test-1-master-1 {{mode}};
|
||||||
|
upload-vm k3s-test-1-master-2 {{mode}};
|
||||||
|
upload-vm k3s-test-1-master-3 {{mode}};
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
k3s:
|
k3s:
|
||||||
colmena apply --on '@k3s-*' --verbose --show-trace
|
colmena apply --on '@k3s-*' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
master:
|
master:
|
||||||
colmena apply --on '@k3s-prod-1-master-*' --verbose --show-trace
|
colmena apply --on '@k3s-prod-1-master-*' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
worker:
|
worker:
|
||||||
colmena apply --on '@k3s-prod-1-worker-*' --verbose --show-trace
|
colmena apply --on '@k3s-prod-1-worker-*' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
k3s-test:
|
k3s-test:
|
||||||
colmena apply --on '@k3s-test-*' --verbose --show-trace
|
colmena apply --on '@k3s-test-*' --verbose --show-trace
|
||||||
|
|
||||||
@@ -156,12 +322,18 @@ k3s-test:
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
riscv:
|
riscv:
|
||||||
colmena apply --on '@riscv' --verbose --show-trace
|
colmena apply --on '@riscv' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
nozomi:
|
nozomi:
|
||||||
colmena apply --on '@nozomi' --verbose --show-trace
|
colmena apply --on '@nozomi' --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
yukina:
|
yukina:
|
||||||
colmena apply --on '@yukina' --verbose --show-trace
|
colmena apply --on '@yukina' --verbose --show-trace
|
||||||
|
|
||||||
@@ -171,86 +343,118 @@ yukina:
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
aarch:
|
[linux]
|
||||||
colmena apply --on '@aarch' --build-on-target --verbose --show-trace
|
[group('homelab')]
|
||||||
|
|
||||||
suzu:
|
|
||||||
colmena apply --on '@suzu' --build-on-target --verbose --show-trace
|
|
||||||
|
|
||||||
suzu-local mode="default":
|
|
||||||
use utils.nu *; \
|
|
||||||
nixos-switch suzu {{mode}}
|
|
||||||
|
|
||||||
rakushun:
|
rakushun:
|
||||||
colmena apply --on '@rakushun' --build-on-target --verbose --show-trace
|
colmena apply --on '@rakushun' --build-on-target --verbose --show-trace
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
rakushun-local mode="default":
|
rakushun-local mode="default":
|
||||||
use utils.nu *; \
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
nixos-switch rakushun {{mode}}
|
nixos-switch rakushun {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
suzu-set-proxy:
|
||||||
|
ip route del default via 192.168.5.1
|
||||||
|
ip route add default via 192.168.5.178
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
suzu-unset-proxy:
|
||||||
|
ip route del default via 192.168.5.178
|
||||||
|
ip route add default via 192.168.5.1
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('homelab')]
|
||||||
|
suzu-local mode="default":
|
||||||
|
#!/usr/bin/env nu
|
||||||
|
use {{utils_nu}} *;
|
||||||
|
nixos-switch suzu {{mode}}
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Misc, other useful commands
|
# Neovim related commands
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
fmt:
|
[group('neovim')]
|
||||||
# format the nix files in this repo
|
|
||||||
nix fmt
|
|
||||||
|
|
||||||
path:
|
|
||||||
$env.PATH | split row ":"
|
|
||||||
|
|
||||||
nvim-test:
|
nvim-test:
|
||||||
rm -rf $"($env.HOME)/.config/astronvim/lua/user"
|
rm -rf $"($env.HOME)/.config/nvim"
|
||||||
rsync -avz --copy-links --chmod=D2755,F744 home/base/desktop/editors/neovim/astronvim_user/ $"($env.HOME)/.config/astronvim/lua/user"
|
rsync -avz --copy-links --chmod=D2755,F744 home/base/tui/editors/neovim/nvim/ $"($env.HOME)/.config/nvim/"
|
||||||
|
|
||||||
|
[group('neovim')]
|
||||||
nvim-clean:
|
nvim-clean:
|
||||||
rm -rf $"($env.HOME)/.config/astronvim/lua/user"
|
rm -rf $"($env.HOME)/.config/nvim"
|
||||||
|
|
||||||
# =================================================
|
# =================================================
|
||||||
# Emacs related commands
|
# Emacs related commands
|
||||||
# =================================================
|
# =================================================
|
||||||
|
|
||||||
emacs-plist-path := "~/Library/LaunchAgents/org.nix-community.home.emacs.plist"
|
[group('emacs')]
|
||||||
|
|
||||||
reload-emacs-cmd := if os() == "macos" {
|
|
||||||
"launchctl unload " + emacs-plist-path
|
|
||||||
+ "\n"
|
|
||||||
+ "launchctl load " + emacs-plist-path
|
|
||||||
+ "\n"
|
|
||||||
+ "tail -f ~/Library/Logs/emacs-daemon.stderr.log"
|
|
||||||
} else {
|
|
||||||
"systemctl --user restart emacs.service"
|
|
||||||
+ "\n"
|
|
||||||
+ "systemctl --user status emacs.service"
|
|
||||||
}
|
|
||||||
|
|
||||||
emacs-test:
|
emacs-test:
|
||||||
rm -rf $"($env.HOME)/.config/doom"
|
rm -rf $"($env.HOME)/.config/doom"
|
||||||
rsync -avz --copy-links --chmod=D2755,F744 home/base/desktop/editors/emacs/doom/ $"($env.HOME)/.config/doom"
|
rsync -avz --copy-links --chmod=D2755,F744 home/base/tui/editors/emacs/doom/ $"($env.HOME)/.config/doom/"
|
||||||
doom clean
|
doom clean
|
||||||
doom sync
|
doom sync
|
||||||
|
|
||||||
|
[group('emacs')]
|
||||||
emacs-clean:
|
emacs-clean:
|
||||||
rm -rf $"($env.HOME)/.config/doom/"
|
rm -rf $"($env.HOME)/.config/doom/"
|
||||||
|
|
||||||
|
[group('emacs')]
|
||||||
emacs-purge:
|
emacs-purge:
|
||||||
doom purge
|
doom purge
|
||||||
doom clean
|
doom clean
|
||||||
doom sync
|
doom sync
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('emacs')]
|
||||||
emacs-reload:
|
emacs-reload:
|
||||||
doom sync
|
doom sync
|
||||||
{{reload-emacs-cmd}}
|
systemctl --user restart emacs.service
|
||||||
|
systemctl --user status emacs.service
|
||||||
|
|
||||||
|
|
||||||
|
emacs-plist-path := "~/Library/LaunchAgents/org.nix-community.home.emacs.plist"
|
||||||
|
|
||||||
|
[macos]
|
||||||
|
[group('emacs')]
|
||||||
|
emacs-reload:
|
||||||
|
doom sync
|
||||||
|
launchctl unload {{emacs-plist-path}}
|
||||||
|
launchctl load {{emacs-plist-path}}
|
||||||
|
tail -f ~/Library/Logs/emacs-daemon.stderr.log
|
||||||
|
|
||||||
# =================================================
|
# =================================================
|
||||||
#
|
#
|
||||||
# Kubernetes related commands
|
# Other useful commands
|
||||||
#
|
#
|
||||||
# =================================================
|
# =================================================
|
||||||
|
|
||||||
|
[group('common')]
|
||||||
|
path:
|
||||||
|
$env.PATH | split row ":"
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
[group('common')]
|
||||||
|
penvof pid:
|
||||||
|
sudo cat $"/proc/($pid)/environ" | tr '\0' '\n'
|
||||||
|
|
||||||
|
# Remove all reflog entries and prune unreachable objects
|
||||||
|
[group('git')]
|
||||||
|
ggc:
|
||||||
|
git reflog expire --expire-unreachable=now --all
|
||||||
|
git gc --prune=now
|
||||||
|
|
||||||
|
# Amend the last commit without changing the commit message
|
||||||
|
[group('git')]
|
||||||
|
game:
|
||||||
|
git commit --amend -a --no-edit
|
||||||
|
|
||||||
|
# Delete all failed pods
|
||||||
|
[group('k8s')]
|
||||||
del-failed:
|
del-failed:
|
||||||
kubectl delete pod --all-namespaces --field-selector="status.phase==Failed"
|
kubectl delete pod --all-namespaces --field-selector="status.phase==Failed"
|
||||||
|
|||||||
@@ -8,27 +8,32 @@
|
|||||||
<a href="https://github.com/ryan4yin/nix-config/stargazers">
|
<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>
|
<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/">
|
<a href="https://nixos.org/">
|
||||||
<img src="https://img.shields.io/badge/NixOS-23.11-informational.svg?style=for-the-badge&logo=nixos&color=F2CDCD&logoColor=D9E0EE&labelColor=302D41"></a>
|
<img src="https://img.shields.io/badge/NixOS-24.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">
|
<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>
|
<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>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
> My configuration is becoming more and more complex, and it may be difficult for beginners to read
|
> My configuration is becoming more and more complex, and **it will be difficult for beginners to
|
||||||
> it. If you are new to NixOS and want to know how I use NixOS, I would recommend you to take a look
|
> read**. If you are new to NixOS and want to know how I use NixOS, I would recommend you to take a
|
||||||
> at the [ryan4yin/nix-config/releases](https://github.com/ryan4yin/nix-config/releases) first,
|
> look at the [ryan4yin/nix-config/releases](https://github.com/ryan4yin/nix-config/releases) first,
|
||||||
> **checkout to some simpler older versions**, which will be much easier to understand.
|
> **checkout to some simpler older versions, such as
|
||||||
|
> [i3-kickstarter](https://github.com/ryan4yin/nix-config/tree/i3-kickstarter), which will be much
|
||||||
|
> easier to understand**.
|
||||||
|
|
||||||
This repository is home to the nix code that builds my systems:
|
This repository is home to the nix code that builds my systems:
|
||||||
|
|
||||||
1. NixOS Desktops: NixOS with home-manager, i3, hyprland, agenix, etc.
|
1. NixOS Desktops: NixOS with home-manager, i3, hyprland, agenix, etc.
|
||||||
2. macOS Desktops: nix-darwin with home-manager, share the same home-manager configuration with
|
2. macOS Desktops: nix-darwin with home-manager, share the same home-manager configuration with
|
||||||
NixOS Desktops.
|
NixOS Desktops.
|
||||||
3. NixOS Servers: virtual machines running on Proxmox, with various services, such as kubernetes,
|
3. NixOS Servers: virtual machines running on Proxmox/KubeVirt, with various services, such as
|
||||||
homepage, prometheus, grafana, etc.
|
kubernetes, homepage, prometheus, grafana, etc.
|
||||||
|
|
||||||
See [./hosts](./hosts) for details of each host.
|
See [./hosts](./hosts) for details of each host.
|
||||||
|
|
||||||
|
See [./Virtual-Machine.md](./Virtual-Machine.md) for details of how to create & manage KubeVirt's
|
||||||
|
Virtual Machine from this flake.
|
||||||
|
|
||||||
## Why NixOS & Flakes?
|
## Why NixOS & Flakes?
|
||||||
|
|
||||||
Nix allows for easy-to-manage, collaborative, reproducible deployments. This means that once
|
Nix allows for easy-to-manage, collaborative, reproducible deployments. This means that once
|
||||||
@@ -89,11 +94,11 @@ Wallpapers: https://github.com/ryan4yin/wallpapers
|
|||||||
|
|
||||||
## Neovim
|
## Neovim
|
||||||
|
|
||||||
See [./home/base/desktop/editors/neovim/](./home/base/desktop/editors/neovim/) for details.
|
See [./home/base/tui/editors/neovim/](./home/base/tui/editors/neovim/) for details.
|
||||||
|
|
||||||
## Emacs
|
## Emacs
|
||||||
|
|
||||||
See [./home/base/desktop/editors/emacs/](./home/base/desktop/editors/emacs/) for details.
|
See [./home/base/tui/editors/emacs/](./home/base/tui/editors/emacs/) for details.
|
||||||
|
|
||||||
## Secrets Management
|
## Secrets Management
|
||||||
|
|
||||||
@@ -104,7 +109,6 @@ See [./secrets](./secrets) for details.
|
|||||||
> :red_circle: **IMPORTANT**: **You should NOT deploy this flake directly on your machine
|
> :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
|
> :exclamation: It will not succeed.** This flake contains my hardware configuration(such as
|
||||||
> [hardware-configuration.nix](hosts/idols-ai/hardware-configuration.nix),
|
> [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),
|
> [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 hardwares, and requires my private secrets repository
|
> etc.) which is not suitable for your hardwares, and requires my private secrets repository
|
||||||
> [ryan4yin/nix-secrets](https://github.com/ryan4yin/nix-config/tree/main/secrets) to deploy. You
|
> [ryan4yin/nix-secrets](https://github.com/ryan4yin/nix-config/tree/main/secrets) to deploy. You
|
||||||
@@ -128,7 +132,7 @@ just hypr # deploy my pc with hyprland compositor
|
|||||||
|
|
||||||
# or we can deploy with details
|
# or we can deploy with details
|
||||||
# just i3 debug
|
# just i3 debug
|
||||||
just hypr-debug
|
just hypr debug
|
||||||
```
|
```
|
||||||
|
|
||||||
For macOS:
|
For macOS:
|
||||||
|
|||||||
+8
-2
@@ -1,19 +1,25 @@
|
|||||||
## How to create & managage KubeVirt's Virtual Machine from this flake?
|
## How to create & managage KubeVirt's Virtual Machine from this flake?
|
||||||
|
|
||||||
Use `aquamarine` as an example, we can create a virtual machine with the following command:
|
Use `aquamarine` as an example, first build and upload the virtual machine's qcow2 image to the file
|
||||||
|
server:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
just upload-vm aquamarine
|
just upload-vm aquamarine
|
||||||
```
|
```
|
||||||
|
|
||||||
Then create the virtual machine by creating a yaml file at
|
Then create the virtual machine by creating a yaml file at
|
||||||
[ryan4yin/k8s-gitops](https://github.com/ryan4yin/k8s-gitops/tree/main/vms)
|
[ryan4yin/k8s-gitops](https://github.com/ryan4yin/k8s-gitops/tree/main/vms), set the
|
||||||
|
`spec.dataVolumeTemplates[0].source.http.url` to the uploaded file's URL, and fluxcd will
|
||||||
|
automatically apply the changes, then a virtual machine named `aquamarine` will be created in the
|
||||||
|
KubeVirt cluster.
|
||||||
|
|
||||||
Once the virtual machine `aquamarine` is created, we can deploy updates to it with the following
|
Once the virtual machine `aquamarine` is created, we can deploy updates to it with the following
|
||||||
commands:
|
commands:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
just col aquamarine
|
just col aquamarine
|
||||||
|
just col kubevirt-shoryu
|
||||||
|
just col k3s-test-1-master-1
|
||||||
```
|
```
|
||||||
|
|
||||||
If you're not familiar with remote deployment, please read this tutorial first:
|
If you're not familiar with remote deployment, please read this tutorial first:
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 981 KiB |
@@ -0,0 +1,2 @@
|
|||||||
|
*.key
|
||||||
|
*.csr
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# My Private PKI / CA
|
||||||
|
|
||||||
|
This is my private Private Key Infrastructure (PKI) / Certificate Authority (CA) for my personal
|
||||||
|
use. It is used to issue certificates for my own servers and services.
|
||||||
|
|
||||||
|
All the private keys are ignored by git, and will be stored in my private secrets repo
|
||||||
|
[../secrets](../secrets/)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIBajCB8QIJAIwL98is2nQPMAoGCCqGSM49BAMEMB8xHTAbBgNVBAMMFFJ5YW40
|
||||||
|
WWluJ3MgUm9vdCBDQSAxMB4XDTI0MDQwMzA4NDgzM1oXDTM0MDQwMTA4NDgzM1ow
|
||||||
|
HzEdMBsGA1UEAwwUUnlhbjRZaW4ncyBSb290IENBIDEwdjAQBgcqhkjOPQIBBgUr
|
||||||
|
gQQAIgNiAAQ6ixMbsGZ/u/ZnwzOZ49naVL7rQxm9C74SboGytKcYBH03JjC7tgZ3
|
||||||
|
DylirxSLcTYHHtCz9ajdamP6+sgiGVpUODtfGSO+WmS+gAbLjCS37T41bkUhkx88
|
||||||
|
JU4NsGhjPXcwCgYIKoZIzj0EAwQDaAAwZQIwDrGLSdO+p/1uywkzqzdM/OnZs8bp
|
||||||
|
n60uBhUI7EZzDmrouOFeGx+dXYI5yy5AD/qDAjEA7fTQx+jccyOj4dimq1iU9+71
|
||||||
|
e/gWYg0rexfy/+9dQY6kvwMzv8Lnm6URaRMbE1Q/
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
C050420A8E5A3C1E
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
[ req ]
|
||||||
|
prompt = no
|
||||||
|
req_extensions = v3_ext
|
||||||
|
distinguished_name = req_distinguished_name
|
||||||
|
|
||||||
|
[ req_distinguished_name ]
|
||||||
|
countryName = US
|
||||||
|
stateOrProvinceName = NYK
|
||||||
|
localityName = NYK
|
||||||
|
organizationName = Ryan4Yin
|
||||||
|
organizationalUnitName = Ryan4Yin
|
||||||
|
commonName = writefor.fun # deprecated, use subjectAltName(SAN) instead
|
||||||
|
emailAddress = rayn4yin@linux.com
|
||||||
|
|
||||||
|
[ alt_names ]
|
||||||
|
DNS.1 = writefor.fun
|
||||||
|
DNS.2 = *.writefor.fun
|
||||||
|
|
||||||
|
[ v3_ext ]
|
||||||
|
subjectAltName=@alt_names
|
||||||
|
basicConstraints = CA:false
|
||||||
|
extendedKeyUsage = serverAuth
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICKTCCAa6gAwIBAgIJAMBQQgqOWjweMAoGCCqGSM49BAMEMB8xHTAbBgNVBAMM
|
||||||
|
FFJ5YW40WWluJ3MgUm9vdCBDQSAxMB4XDTI0MDQwMzA4NDgzM1oXDTM0MDQwMTA4
|
||||||
|
NDgzM1owgYkxCzAJBgNVBAYTAlVTMQwwCgYDVQQIDANOWUsxDDAKBgNVBAcMA05Z
|
||||||
|
SzERMA8GA1UECgwIUnlhbjRZaW4xETAPBgNVBAsMCFJ5YW40WWluMRUwEwYDVQQD
|
||||||
|
DAx3cml0ZWZvci5mdW4xITAfBgkqhkiG9w0BCQEWEnJheW40eWluQGxpbnV4LmNv
|
||||||
|
bTB2MBAGByqGSM49AgEGBSuBBAAiA2IABCNTYKDq/I99NltQR5eKrrovQXp9BbLV
|
||||||
|
iuUdYmzFrAh+NC9ikiIqTfDwP+c+7QvDyI3KXu3KI2qPSPdxktZKDUPHK4p2Y2kZ
|
||||||
|
xKOI2IFTgTqV3uBciyx7ayWPTwBYxsTDmqNLMEkwJwYDVR0RBCAwHoIMd3JpdGVm
|
||||||
|
b3IuZnVugg4qLndyaXRlZm9yLmZ1bjAJBgNVHRMEAjAAMBMGA1UdJQQMMAoGCCsG
|
||||||
|
AQUFBwMBMAoGCCqGSM49BAMEA2kAMGYCMQCHw9YkDo15P9mqEObvxSUak8tQmhBB
|
||||||
|
9wB81Qg4c+JsMCZA1rMUB7GkNJj1Dr9rWLoCMQDSituLzmo/yPLEOrbNV83bj3/I
|
||||||
|
ikKgobSie3pMXm5ZG7krOXaunyFRR/bIkih2V2Q=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# 1. Generate the private key for Root CA
|
||||||
|
openssl ecparam -genkey -name secp384r1 -out ecc-ca.key
|
||||||
|
# 2. Generate the certificate for Root CA with the validity period of 10 years
|
||||||
|
# using the private key and some basic information
|
||||||
|
# NOTE: we specify sha512 as the signature algorithm, which is the key point
|
||||||
|
openssl req -x509 -new -SHA512 -key ecc-ca.key -subj "/CN=Ryan4Yin's Root CA 1" -days 3650 -out ecc-ca.crt
|
||||||
|
|
||||||
|
# 3. Generate the private key for web server
|
||||||
|
openssl ecparam -genkey -name secp384r1 -out ecc-server.key
|
||||||
|
# 4. Generate the certificate signing request (CSR) for the server certificate
|
||||||
|
# using the private key and the configuration file ecc-csr.conf
|
||||||
|
openssl req -new -SHA512 -key ecc-server.key -out ecc-server.csr -config ecc-csr.conf
|
||||||
|
# 5. Sign the server certificate with the Root CA's certificate and private key
|
||||||
|
# NOTE: we specify sha512 as the signature algorithm, which is the key point
|
||||||
|
openssl x509 -req -SHA512 -in ecc-server.csr -CA ecc-ca.crt -CAkey ecc-ca.key \
|
||||||
|
-CAcreateserial -out ecc-server.crt -days 3650 \
|
||||||
|
-extensions v3_ext -extfile ecc-csr.conf
|
||||||
|
|
||||||
|
# 6. Display the information of the certificates
|
||||||
|
openssl x509 -noout -text -in ecc-ca.crt
|
||||||
|
openssl x509 -noout -text -in ecc-server.crt
|
||||||
|
|
||||||
Generated
+350
-724
File diff suppressed because it is too large
Load Diff
@@ -12,18 +12,16 @@
|
|||||||
|
|
||||||
# the nixConfig here only affects the flake itself, not the system configuration!
|
# the nixConfig here only affects the flake itself, not the system configuration!
|
||||||
# for more information, see:
|
# for more information, see:
|
||||||
# https://nixos-and-flakes.thiscute.world/nixos-with-flakes/add-custom-cache-servers
|
# https://nixos-and-flakes.thiscute.world/nix-store/add-binary-cache-servers
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
# substituers will be appended to the default substituters when fetching packages
|
# substituers will be appended to the default substituters when fetching packages
|
||||||
extra-substituters = [
|
extra-substituters = [
|
||||||
"https://anyrun.cachix.org"
|
"https://anyrun.cachix.org"
|
||||||
"https://hyprland.cachix.org"
|
|
||||||
"https://nix-gaming.cachix.org"
|
"https://nix-gaming.cachix.org"
|
||||||
# "https://nixpkgs-wayland.cachix.org"
|
# "https://nixpkgs-wayland.cachix.org"
|
||||||
];
|
];
|
||||||
extra-trusted-public-keys = [
|
extra-trusted-public-keys = [
|
||||||
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
||||||
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
|
|
||||||
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
|
"nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="
|
||||||
# "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
# "nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
||||||
];
|
];
|
||||||
@@ -37,11 +35,11 @@
|
|||||||
|
|
||||||
# Official NixOS package source, using nixos's unstable branch by default
|
# Official NixOS package source, using nixos's unstable branch by default
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable-small";
|
||||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||||
|
|
||||||
# for macos
|
# for macos
|
||||||
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.11-darwin";
|
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-24.05-darwin";
|
||||||
nix-darwin = {
|
nix-darwin = {
|
||||||
url = "github:lnl7/nix-darwin";
|
url = "github:lnl7/nix-darwin";
|
||||||
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||||
@@ -50,8 +48,8 @@
|
|||||||
|
|
||||||
# home-manager, used for managing user configuration
|
# home-manager, used for managing user configuration
|
||||||
home-manager = {
|
home-manager = {
|
||||||
# url = "github:nix-community/home-manager/release-23.11";
|
|
||||||
url = "github:nix-community/home-manager/master";
|
url = "github:nix-community/home-manager/master";
|
||||||
|
# url = "github:nix-community/home-manager/release-24.05";
|
||||||
|
|
||||||
# The `follows` keyword in inputs is used for inheritance.
|
# The `follows` keyword in inputs is used for inheritance.
|
||||||
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
|
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
|
||||||
@@ -60,17 +58,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
lanzaboote = {
|
lanzaboote = {
|
||||||
url = "github:nix-community/lanzaboote/v0.3.0";
|
url = "github:nix-community/lanzaboote/v0.4.1";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
impermanence.url = "github:nix-community/impermanence";
|
impermanence.url = "github:nix-community/impermanence";
|
||||||
|
|
||||||
hyprland = {
|
|
||||||
url = "github:hyprwm/Hyprland/v0.33.1";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
|
|
||||||
# community wayland nixpkgs
|
# community wayland nixpkgs
|
||||||
# nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
# nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
||||||
# anyrun - a wayland launcher
|
# anyrun - a wayland launcher
|
||||||
@@ -96,7 +89,7 @@
|
|||||||
nix-gaming.url = "github:fufexan/nix-gaming";
|
nix-gaming.url = "github:fufexan/nix-gaming";
|
||||||
|
|
||||||
disko = {
|
disko = {
|
||||||
url = "github:nix-community/disko";
|
url = "github:nix-community/disko/v1.6.1";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -111,8 +104,6 @@
|
|||||||
daeuniverse.url = "github:daeuniverse/flake.nix";
|
daeuniverse.url = "github:daeuniverse/flake.nix";
|
||||||
# daeuniverse.url = "github:daeuniverse/flake.nix/exp";
|
# daeuniverse.url = "github:daeuniverse/flake.nix/exp";
|
||||||
|
|
||||||
attic.url = "github:zhaofengli/attic";
|
|
||||||
|
|
||||||
haumea = {
|
haumea = {
|
||||||
url = "github:nix-community/haumea/v0.2.2";
|
url = "github:nix-community/haumea/v0.2.2";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
@@ -125,11 +116,6 @@
|
|||||||
|
|
||||||
######################## Some non-flake repositories #########################################
|
######################## Some non-flake repositories #########################################
|
||||||
|
|
||||||
# AstroNvim is an aesthetic and feature-rich neovim config.
|
|
||||||
astronvim = {
|
|
||||||
url = "github:AstroNvim/AstroNvim/v3.41.2";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
# doom-emacs is a configuration framework for GNU Emacs.
|
# doom-emacs is a configuration framework for GNU Emacs.
|
||||||
doomemacs = {
|
doomemacs = {
|
||||||
url = "github:doomemacs/doomemacs";
|
url = "github:doomemacs/doomemacs";
|
||||||
|
|||||||
@@ -5,17 +5,22 @@
|
|||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
skopeo
|
|
||||||
docker-compose
|
docker-compose
|
||||||
dive # explore docker layers
|
dive # explore docker layers
|
||||||
lazydocker # Docker terminal UI.
|
lazydocker # Docker terminal UI.
|
||||||
|
skopeo # copy/sync images between registries and local storage
|
||||||
|
go-containerregistry # provides `crane` & `gcrane`, it's similar to skopeo
|
||||||
|
|
||||||
kubectl
|
kubectl
|
||||||
|
kubebuilder
|
||||||
istioctl
|
istioctl
|
||||||
|
clusterctl # for kubernetes cluster-api
|
||||||
kubevirt # virtctl
|
kubevirt # virtctl
|
||||||
kubernetes-helm
|
kubernetes-helm
|
||||||
fluxcd
|
fluxcd
|
||||||
argocd
|
argocd
|
||||||
|
|
||||||
|
ko # build go project to container image
|
||||||
];
|
];
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
attic,
|
|
||||||
nur-ryan4yin,
|
nur-ryan4yin,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
@@ -11,7 +10,7 @@
|
|||||||
gnupg
|
gnupg
|
||||||
gnumake
|
gnumake
|
||||||
|
|
||||||
# Morden cli tools, replacement of grep/sed/...
|
# Modern cli tools, replacement of grep/sed/...
|
||||||
|
|
||||||
# Interactively filter its input using fuzzy searching, not limit to filenames.
|
# Interactively filter its input using fuzzy searching, not limit to filenames.
|
||||||
fzf
|
fzf
|
||||||
@@ -25,7 +24,7 @@
|
|||||||
ast-grep
|
ast-grep
|
||||||
|
|
||||||
sad # CLI search and replace, just like sed, but with diff preview.
|
sad # CLI search and replace, just like sed, but with diff preview.
|
||||||
yq-go # yaml processer https://github.com/mikefarah/yq
|
yq-go # yaml processor https://github.com/mikefarah/yq
|
||||||
just # a command runner like make, but simpler
|
just # a command runner like make, but simpler
|
||||||
delta # A viewer for git and diff output
|
delta # A viewer for git and diff output
|
||||||
lazygit # Git terminal UI.
|
lazygit # Git terminal UI.
|
||||||
@@ -52,8 +51,6 @@
|
|||||||
# productivity
|
# productivity
|
||||||
caddy # A webserver with automatic HTTPS via Let's Encrypt(replacement of nginx)
|
caddy # A webserver with automatic HTTPS via Let's Encrypt(replacement of nginx)
|
||||||
croc # File transfer between computers securely and easily
|
croc # File transfer between computers securely and easily
|
||||||
# self-hosted nix cache server
|
|
||||||
attic.packages.${pkgs.system}.attic-client
|
|
||||||
ncdu # analyzer your disk usage Interactively, via TUI(replacement of `du`)
|
ncdu # analyzer your disk usage Interactively, via TUI(replacement of `du`)
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -62,7 +59,8 @@
|
|||||||
# useful in bash/zsh prompt, not in nushell.
|
# useful in bash/zsh prompt, not in nushell.
|
||||||
eza = {
|
eza = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableAliases = false; # do not enable aliases in nushell!
|
# do not enable aliases in nushell!
|
||||||
|
enableNushellIntegration = false;
|
||||||
git = true;
|
git = true;
|
||||||
icons = true;
|
icons = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
includes = [
|
includes = [
|
||||||
{
|
{
|
||||||
# use diffrent email & name for work
|
# use different email & name for work
|
||||||
path = "~/work/.gitconfig";
|
path = "~/work/.gitconfig";
|
||||||
condition = "gitdir:~/work/";
|
condition = "gitdir:~/work/";
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
init.defaultBranch = "main";
|
init.defaultBranch = "main";
|
||||||
|
trim.bases = "develop,master,main"; # for git-trim
|
||||||
push.autoSetupRemote = true;
|
push.autoSetupRemote = true;
|
||||||
pull.rebase = true;
|
pull.rebase = true;
|
||||||
|
|
||||||
|
|||||||
@@ -115,6 +115,33 @@ $env.config = {
|
|||||||
# 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
|
# 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
|
bracketed_paste: true # enable bracketed paste, currently useless on windows
|
||||||
edit_mode: emacs # emacs, vi
|
edit_mode: emacs # emacs, vi
|
||||||
shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue
|
shell_integration: {
|
||||||
|
# osc2 abbreviates the path if in the home_dir, sets the tab/window title, shows the running command in the tab/window title
|
||||||
|
osc2: true
|
||||||
|
# osc7 is a way to communicate the path to the terminal, this is helpful for spawning new tabs in the same directory
|
||||||
|
osc7: true
|
||||||
|
# osc8 is also implemented as the deprecated setting ls.show_clickable_links, it shows clickable links in ls output if your terminal supports it. show_clickable_links is deprecated in favor of osc8
|
||||||
|
osc8: true
|
||||||
|
# osc9_9 is from ConEmu and is starting to get wider support. It's similar to osc7 in that it communicates the path to the terminal
|
||||||
|
osc9_9: false
|
||||||
|
# osc133 is several escapes invented by Final Term which include the supported ones below.
|
||||||
|
# 133;A - Mark prompt start
|
||||||
|
# 133;B - Mark prompt end
|
||||||
|
# 133;C - Mark pre-execution
|
||||||
|
# 133;D;exit - Mark execution finished with exit code
|
||||||
|
# This is used to enable terminals to know where the prompt is, the command is, where the command finishes, and where the output of the command is
|
||||||
|
osc133: true
|
||||||
|
# osc633 is closely related to osc133 but only exists in visual studio code (vscode) and supports their shell integration features
|
||||||
|
# 633;A - Mark prompt start
|
||||||
|
# 633;B - Mark prompt end
|
||||||
|
# 633;C - Mark pre-execution
|
||||||
|
# 633;D;exit - Mark execution finished with exit code
|
||||||
|
# 633;E - NOT IMPLEMENTED - Explicitly set the command line with an optional nonce
|
||||||
|
# 633;P;Cwd=<path> - Mark the current working directory and communicate it to the terminal
|
||||||
|
# and also helps with the run recent menu in vscode
|
||||||
|
osc633: true
|
||||||
|
# reset_application_mode is escape \x1b[?1l and was added to help ssh work better
|
||||||
|
reset_application_mode: true
|
||||||
|
}
|
||||||
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.
|
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.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
let
|
{pkgs-unstable, ...}: let
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
k = "kubectl";
|
k = "kubectl";
|
||||||
|
|
||||||
@@ -11,6 +11,7 @@ in {
|
|||||||
|
|
||||||
programs.nushell = {
|
programs.nushell = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs-unstable.nushell;
|
||||||
configFile.source = ./config.nu;
|
configFile.source = ./config.nu;
|
||||||
inherit shellAliases;
|
inherit shellAliases;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,8 +10,13 @@
|
|||||||
package = pkgs-unstable.yazi;
|
package = pkgs-unstable.yazi;
|
||||||
# Changing working directory when exiting Yazi
|
# Changing working directory when exiting Yazi
|
||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
# TODO: nushellIntegration is broken on release-23.11, wait for master's fix to be released
|
enableNushellIntegration = true;
|
||||||
enableNushellIntegration = false;
|
settings = {
|
||||||
|
manager = {
|
||||||
|
show_hidden = true;
|
||||||
|
sort_dir_first = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.configFile."yazi/theme.toml".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-yazi}/mocha.toml";
|
xdg.configFile."yazi/theme.toml".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-yazi}/mocha.toml";
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
{
|
{pkgs, ...}: {
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# db related
|
|
||||||
dbeaver
|
|
||||||
|
|
||||||
mitmproxy # http/https proxy tool
|
mitmproxy # http/https proxy tool
|
||||||
insomnia # REST client
|
insomnia # REST client
|
||||||
wireshark # network analyzer
|
wireshark # network analyzer
|
||||||
ventoy # create bootable usb
|
|
||||||
|
# IDEs
|
||||||
|
jetbrains.idea-community
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ Error opening terminal: xterm-kitty.
|
|||||||
|
|
||||||
NixOS preserve the `TERMINFO` and `TERMINFO_DIRS` environment variables, for `root` and the `wheel`
|
NixOS preserve the `TERMINFO` and `TERMINFO_DIRS` environment variables, for `root` and the `wheel`
|
||||||
group:
|
group:
|
||||||
[nixpkgs/nixos/modules/config/terminfo.nix](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/config/terminfo.nix#L18)
|
[nixpkgs/nixos/modules/config/terminfo.nix](https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/config/terminfo.nix#L18)
|
||||||
|
|
||||||
For nix-darwin, take a look at <https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues>
|
For nix-darwin, take a look at <https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12,7 +12,7 @@
|
|||||||
# You can update Home Manager without changing this value. See
|
# You can update Home Manager without changing this value. See
|
||||||
# the Home Manager release notes for a list of state version
|
# the Home Manager release notes for a list of state version
|
||||||
# changes in each release.
|
# changes in each release.
|
||||||
stateVersion = "23.11";
|
stateVersion = "24.05";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
|
|||||||
@@ -24,6 +24,11 @@
|
|||||||
|
|
||||||
# aliyun
|
# aliyun
|
||||||
aliyun-cli
|
aliyun-cli
|
||||||
|
# digitalocean
|
||||||
|
doctl
|
||||||
|
# google cloud
|
||||||
|
google-cloud-sdk
|
||||||
|
|
||||||
# cloud tools that nix do not have cache for.
|
# cloud tools that nix do not have cache for.
|
||||||
terraform
|
terraform
|
||||||
terraformer # generate terraform configs from existing cloud resources
|
terraformer # generate terraform configs from existing cloud resources
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
colmena # nixos's remote deployment tool
|
colmena # nixos's remote deployment tool
|
||||||
|
|
||||||
# db related
|
# db related
|
||||||
mycli
|
pkgs-unstable.mycli
|
||||||
pgcli
|
pkgs-unstable.pgcli
|
||||||
mongosh
|
mongosh
|
||||||
sqlite
|
sqlite
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
minicom
|
minicom
|
||||||
|
|
||||||
# ai related
|
# ai related
|
||||||
python311Packages.huggingface-hub # huggingface-cli
|
pkgs-unstable.python312Packages.huggingface-hub # huggingface-cli
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
pkgs-unstable.devbox
|
pkgs-unstable.devbox
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
# Automatically trims your branches whose tracking remote refs are merged or gone
|
# 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.
|
# It's really useful when you work on a project for a long time.
|
||||||
git-trim
|
git-trim
|
||||||
|
gitleaks
|
||||||
|
|
||||||
# need to run `conda-install` before using it
|
# need to run `conda-install` before using it
|
||||||
# need to run `conda-shell` before using command `conda`
|
# need to run `conda-shell` before using command `conda`
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ The postfix(flags) in the above commands:
|
|||||||
| Show all buffers | `:ls` |
|
| Show all buffers | `:ls` |
|
||||||
| show next/previous buffer | `]b`/`[b` or `:bn[ext]` / `bp[rev]` |
|
| show next/previous buffer | `]b`/`[b` or `:bn[ext]` / `bp[rev]` |
|
||||||
| New Tab(New Workspace in DoomEmacs) | `:tabnew` |
|
| New Tab(New Workspace in DoomEmacs) | `:tabnew` |
|
||||||
| Next/Previews Tab | `gt`/`gT` |
|
| Next/Previews Tab | `gt`/`gy` |
|
||||||
|
|
||||||
### History
|
### History
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
- paredit/[lispy](https://github.com/doomemacs/doomemacs/tree/master/modules/editor/lispy): too
|
- paredit/[lispy](https://github.com/doomemacs/doomemacs/tree/master/modules/editor/lispy): too
|
||||||
complex.
|
complex.
|
||||||
- [evil-cleverparens](https://github.com/emacs-evil/evil-cleverparens): simple and useful.
|
- [evil-cleverparens](https://github.com/emacs-evil/evil-cleverparens): simple and useful.
|
||||||
- [parinfer(par-in-fer)](https://shaunlebron.github.io/parinfer/): morden, simple, elegant and
|
- [parinfer(par-in-fer)](https://shaunlebron.github.io/parinfer/): modern, simple, elegant and
|
||||||
useful, but works not well with some other completion plugins...
|
useful, but works not well with some other completion plugins...
|
||||||
- to make parinfer works, you should disable sexp & smartparens in any lisp mode.
|
- to make parinfer works, you should disable sexp & smartparens in any lisp mode.
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Use `:tutor` in helix to start the tutorial.
|
|||||||
1. Helix: delete 2 word: `2w` then `x`. You can always see what you're selecting before you apply
|
1. Helix: delete 2 word: `2w` then `x`. You can always see what you're selecting before you apply
|
||||||
the action.
|
the action.
|
||||||
2. Neovim: delete 2 word: `d`. then `2w`. No visual feedback before you apply the action.
|
2. Neovim: delete 2 word: `d`. then `2w`. No visual feedback before you apply the action.
|
||||||
1. Helix - Morden builtin features: LSP, tree-sitter, fuzzy finder, multi cursors, surround and
|
1. Helix - Modern builtin features: LSP, tree-sitter, fuzzy finder, multi cursors, surround and
|
||||||
more.
|
more.
|
||||||
1. They're all available in Neovim too, but you need to find and use the right plugins manually,
|
1. They're all available in Neovim too, but you need to find and use the right plugins manually,
|
||||||
which takes time and effort.
|
which takes time and effort.
|
||||||
@@ -30,7 +30,7 @@ Use `:tutor` in helix to start the tutorial.
|
|||||||
1. Personally I'm glad to take a look at a Rust codebase, but not a VimScript/Lua codebase.
|
1. Personally I'm glad to take a look at a Rust codebase, but not a VimScript/Lua codebase.
|
||||||
1. Neovim have a very activate plugin ecosystem, and it's easy to find plugins for almost
|
1. Neovim have a very activate plugin ecosystem, and it's easy to find plugins for almost
|
||||||
everything.
|
everything.
|
||||||
1. Helix is still new, and it even do have a stable plugin system yet. A PR to add a plugin
|
1. Helix is still new, and it even don't have a stable plugin system yet. A PR to add a plugin
|
||||||
system is still envolving: <https://github.com/helix-editor/helix/pull/8675>
|
system is still envolving: <https://github.com/helix-editor/helix/pull/8675>
|
||||||
1. Neovim has integrated terminal, and it's very powerful. It's quite similar to VSCode's integrated
|
1. Neovim has integrated terminal, and it's very powerful. It's quite similar to VSCode's integrated
|
||||||
terminal. I use it a lot.
|
terminal. I use it a lot.
|
||||||
|
|||||||
@@ -88,14 +88,17 @@ plugin.
|
|||||||
### Window Navigation
|
### Window Navigation
|
||||||
|
|
||||||
- Switch between windows: `<Ctrl> + h/j/k/l`
|
- Switch between windows: `<Ctrl> + h/j/k/l`
|
||||||
- Resize windows: `<Ctrl> + Up/Down/Left/Right`
|
- Resize windows: `<Ctrl> + Up/Down/Left/Right` (`<Ctrl-w> + -/+/</>`)
|
||||||
- Note: On macOS, conflicts with system shortcuts
|
- Note: On macOS, conflicts with system shortcuts
|
||||||
- Disable in System Preferences -> Keyboard -> Shortcuts -> Mission Control
|
- Disable in System Preferences -> Keyboard -> Shortcuts -> Mission Control
|
||||||
|
|
||||||
### Splitting and Buffers
|
### Splitting and Buffers
|
||||||
|
|
||||||
| | Action | Shortcut | | --------------------- | ------------- | | Horizontal Split | `\` | |
|
| Action | Shortcut |
|
||||||
Vertical Split | `\|` | | Close Buffer | `<Space> + c` |
|
| ---------------- | ------------- |
|
||||||
|
| Horizontal Split | `\` |
|
||||||
|
| Vertical Split | `\|` |
|
||||||
|
| Close Buffer | `<Space> + c` |
|
||||||
|
|
||||||
### Editing and Formatting
|
### Editing and Formatting
|
||||||
|
|
||||||
@@ -109,7 +112,18 @@ Vertical Split | `\|` | | Close Buffer | `<Space> + c` |
|
|||||||
| Comment Line(support multiple lines) | `<Space> + /` |
|
| Comment Line(support multiple lines) | `<Space> + /` |
|
||||||
| Open filepath/URL at cursor(neovim's builtin command) | `gx` |
|
| Open filepath/URL at cursor(neovim's builtin command) | `gx` |
|
||||||
| Find files by name (fzf) | `<Space> + ff` |
|
| Find files by name (fzf) | `<Space> + ff` |
|
||||||
|
| Find files by name (include hidden files) | `<Space> + fF` |
|
||||||
| Grep string in files (ripgrep) | `<Space> + fw` |
|
| Grep string in files (ripgrep) | `<Space> + fw` |
|
||||||
|
| Grep string in files (include hidden files) | `<Space> + fW` |
|
||||||
|
|
||||||
|
### Git
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| -------------------------- | --------------- |
|
||||||
|
| Git Commits (repository) | `:<Space> + gc` |
|
||||||
|
| Git Commits (current file) | `:<Space> + gC` |
|
||||||
|
| Git Branches | `:<Space> + gb` |
|
||||||
|
| Git Status | `:<Space> + gt` |
|
||||||
|
|
||||||
### Sessions
|
### Sessions
|
||||||
|
|
||||||
@@ -160,9 +174,10 @@ Provided by mini.surround plugin.
|
|||||||
### Miscellaneous
|
### Miscellaneous
|
||||||
|
|
||||||
| Action | |
|
| Action | |
|
||||||
| --------------------- | --------------- |
|
| --------------------------------- | --------------- |
|
||||||
| Show all Yank History | `:<Space> + yh` |
|
| Show all Yank History | `:<Space> + yh` |
|
||||||
| Show undo history | `:<Space> + uh` |
|
| Show undo history | `:<Space> + uh` |
|
||||||
|
| Show the path of the current file | `:!echo $%` |
|
||||||
|
|
||||||
## Additional Resources
|
## Additional Resources
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
.clj-kondo/
|
|
||||||
.nrepl-port
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{:source-file-patterns ["*.fnl" "**/*.fnl"]}
|
|
||||||
@@ -1,579 +0,0 @@
|
|||||||
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
|
|
||||||
title = true, -- Set the title of window to `filename [+=-] (path) - NVIM`
|
|
||||||
-- The percentage of 'columns' to use for the title
|
|
||||||
-- When the title is longer, only the end of the path name is shown.
|
|
||||||
titlelen = 20,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
plugins = {
|
|
||||||
"AstroNvim/astrocommunity",
|
|
||||||
-- Motion
|
|
||||||
{ import = "astrocommunity.motion.mini-surround" },
|
|
||||||
-- https://github.com/echasnovski/mini.ai
|
|
||||||
{ import = "astrocommunity.motion.mini-ai" },
|
|
||||||
{ import = "astrocommunity.motion.flash-nvim" },
|
|
||||||
-- diable toggleterm.nvim, zellij's terminal is far better than neovim's one
|
|
||||||
{ "akinsho/toggleterm.nvim", enabled = false },
|
|
||||||
{ "folke/flash.nvim", vscode = false },
|
|
||||||
-- 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 / System
|
|
||||||
{ import = "astrocommunity.pack.lua" },
|
|
||||||
{ import = "astrocommunity.pack.go" },
|
|
||||||
{ import = "astrocommunity.pack.rust" },
|
|
||||||
{ import = "astrocommunity.pack.python" },
|
|
||||||
{ import = "astrocommunity.pack.java" },
|
|
||||||
{ import = "astrocommunity.pack.cmake" },
|
|
||||||
{ import = "astrocommunity.pack.cpp" },
|
|
||||||
-- { 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.docker" },
|
|
||||||
{ import = "astrocommunity.pack.helm" },
|
|
||||||
|
|
||||||
-- colorscheme
|
|
||||||
{ import = "astrocommunity.colorscheme.catppuccin" },
|
|
||||||
{
|
|
||||||
"catppuccin/nvim",
|
|
||||||
name = "catppuccin",
|
|
||||||
opts = function(_, opts)
|
|
||||||
opts.flavour = "mocha" -- latte, frappe, macchiato, mocha
|
|
||||||
opts.transparent_background = true -- setting the background color.
|
|
||||||
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.ignore_install = { "gotmpl" }
|
|
||||||
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, {
|
|
||||||
-- neovim
|
|
||||||
"vim",
|
|
||||||
"lua",
|
|
||||||
-- operation & cloud native
|
|
||||||
"dockerfile",
|
|
||||||
"hcl",
|
|
||||||
"jsonnet",
|
|
||||||
"regex",
|
|
||||||
"terraform",
|
|
||||||
"nix",
|
|
||||||
"csv",
|
|
||||||
-- other programming language
|
|
||||||
"diff",
|
|
||||||
"gitignore",
|
|
||||||
"gitcommit",
|
|
||||||
"latex",
|
|
||||||
"sql",
|
|
||||||
-- Lisp like
|
|
||||||
"fennel",
|
|
||||||
"clojure",
|
|
||||||
"commonlisp",
|
|
||||||
-- customized languages:
|
|
||||||
"scheme",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- add support for scheme
|
|
||||||
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
|
||||||
parser_config.scheme = {
|
|
||||||
install_info = {
|
|
||||||
url = "https://github.com/6cdh/tree-sitter-scheme", -- local path or git repo
|
|
||||||
files = { "src/parser.c" },
|
|
||||||
-- optional entries:
|
|
||||||
branch = "main", -- default branch in case of git repo if different from master
|
|
||||||
generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
|
||||||
requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
|
|
||||||
},
|
|
||||||
}
|
|
||||||
-- use scheme parser for filetypes: scm
|
|
||||||
vim.treesitter.language.register("scheme", "scm")
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"eraserhd/parinfer-rust",
|
|
||||||
build = "cargo build --release",
|
|
||||||
ft = { "scm", "scheme" },
|
|
||||||
},
|
|
||||||
{ "Olical/nfnl", ft = "fennel" },
|
|
||||||
{
|
|
||||||
"Olical/conjure",
|
|
||||||
ft = { "clojure", "fennel", "python", "scheme" }, -- etc
|
|
||||||
-- [Optional] cmp-conjure for cmp
|
|
||||||
dependencies = {
|
|
||||||
{
|
|
||||||
"PaterJason/cmp-conjure",
|
|
||||||
config = function()
|
|
||||||
local cmp = require("cmp")
|
|
||||||
local config = cmp.get_config()
|
|
||||||
table.insert(config.sources, {
|
|
||||||
name = "buffer",
|
|
||||||
option = {
|
|
||||||
sources = {
|
|
||||||
{ name = "conjure" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
cmp.setup(config)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
config = function(_, opts)
|
|
||||||
require("conjure.main").main()
|
|
||||||
require("conjure.mapping")["on-filetype"]()
|
|
||||||
end,
|
|
||||||
init = function()
|
|
||||||
-- Set configuration options here
|
|
||||||
vim.g["conjure#debug"] = true
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"nvim-orgmode/orgmode",
|
|
||||||
dependencies = {
|
|
||||||
{ "nvim-treesitter/nvim-treesitter", lazy = true },
|
|
||||||
},
|
|
||||||
event = "VeryLazy",
|
|
||||||
config = function()
|
|
||||||
-- Load treesitter grammar for org
|
|
||||||
require("orgmode").setup_ts_grammar()
|
|
||||||
|
|
||||||
-- Setup treesitter
|
|
||||||
require("nvim-treesitter.configs").setup({
|
|
||||||
highlight = {
|
|
||||||
enable = true,
|
|
||||||
additional_vim_regex_highlighting = { "org" },
|
|
||||||
},
|
|
||||||
ensure_installed = { "org" },
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Setup orgmode
|
|
||||||
require("orgmode").setup({
|
|
||||||
org_agenda_files = "~/org/**/*",
|
|
||||||
org_default_notes_file = "~/org/refile.org",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- 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 = "stdout" -- notify or stdout
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- markdown preview
|
|
||||||
{
|
|
||||||
"0x00-ketsu/markdown-preview.nvim",
|
|
||||||
ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" },
|
|
||||||
config = function()
|
|
||||||
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 = {} },
|
|
||||||
-- automatically highlighting other uses of the word under the cursor using either LSP, Tree-sitter, or regex matching.
|
|
||||||
{ "RRethy/vim-illuminate", config = function() 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",
|
|
||||||
-- mason is unusable on NixOS, disable it.
|
|
||||||
-- ensure_installed nothing
|
|
||||||
opts = function(_, opts)
|
|
||||||
opts.ensure_installed = nil
|
|
||||||
opts.automatic_installation = false
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
-- Formatters/Linter installation
|
|
||||||
{
|
|
||||||
"jay-babu/mason-null-ls.nvim",
|
|
||||||
-- mason is unusable on NixOS, disable it.
|
|
||||||
-- ensure_installed nothing
|
|
||||||
opts = function(_, opts)
|
|
||||||
opts.ensure_installed = nil
|
|
||||||
opts.automatic_installation = false
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
-- Debugger installation
|
|
||||||
{
|
|
||||||
"jay-babu/mason-nvim-dap.nvim",
|
|
||||||
-- mason is unusable on NixOS, disable it.
|
|
||||||
-- 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
|
|
||||||
formatting.verible_verilog_format, -- Verilog formatter
|
|
||||||
formatting.emacs_scheme_mode, -- using emacs in batch mode to format scheme files.
|
|
||||||
formatting.fnlfmt, -- Format Fennel code
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
branch = "0.1.x",
|
|
||||||
dependencies = { "nvim-lua/plenary.nvim" },
|
|
||||||
init = function()
|
|
||||||
-- 1. Disable highlighting for certain filetypes
|
|
||||||
-- 2. Ignore files larger than a certain filesize
|
|
||||||
local previewers = require("telescope.previewers")
|
|
||||||
|
|
||||||
local _bad = { ".*%.csv", ".*%.min.js" } -- Put all filetypes that slow you down in this array
|
|
||||||
local filesize_threshold = 300 * 1024 -- 300KB
|
|
||||||
local bad_files = function(filepath)
|
|
||||||
for _, v in ipairs(_bad) do
|
|
||||||
if filepath:match(v) then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
local new_maker = function(filepath, bufnr, opts)
|
|
||||||
opts = opts or {}
|
|
||||||
if opts.use_ft_detect == nil then
|
|
||||||
opts.use_ft_detect = true
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 1. Check if the file is in the bad_files array, and if so, don't highlight it
|
|
||||||
opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath)
|
|
||||||
|
|
||||||
-- 2. Check the file size, and ignore it if it's too big(preview nothing).
|
|
||||||
filepath = vim.fn.expand(filepath)
|
|
||||||
vim.loop.fs_stat(filepath, function(_, stat)
|
|
||||||
if not stat then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if stat.size > filesize_threshold then
|
|
||||||
return
|
|
||||||
else
|
|
||||||
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
require("telescope").setup({
|
|
||||||
defaults = {
|
|
||||||
buffer_previewer_maker = new_maker,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Configure require("lazy").setup() options
|
|
||||||
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",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
scheme_langserver = {
|
|
||||||
filetypes = { "scheme", "scm" },
|
|
||||||
single_file_support = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
-- 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
|
|
||||||
"nushell", -- nushell language server
|
|
||||||
"scheme_langserver", -- scheme language server
|
|
||||||
},
|
|
||||||
formatting = {
|
|
||||||
disabled = {},
|
|
||||||
format_on_save = {
|
|
||||||
enabled = true,
|
|
||||||
allow_filetypes = {
|
|
||||||
"go",
|
|
||||||
"jsonnet",
|
|
||||||
"rust",
|
|
||||||
"terraform",
|
|
||||||
"nu",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
-- 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'
|
|
||||||
-- 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" },
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
astronvim,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
###############################################################################
|
###############################################################################
|
||||||
@@ -14,20 +15,9 @@ let
|
|||||||
vdiff = "nvim -d";
|
vdiff = "nvim -d";
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
xdg.configFile = {
|
home.activation.installAstroNvim = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||||
# astronvim's config
|
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${./nvim}/ ${config.xdg.configHome}/nvim/
|
||||||
"nvim" = {
|
'';
|
||||||
source = astronvim;
|
|
||||||
force = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# 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;
|
|
||||||
force = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
home.shellAliases = shellAliases;
|
home.shellAliases = shellAliases;
|
||||||
programs.nushell.shellAliases = shellAliases;
|
programs.nushell.shellAliases = shellAliases;
|
||||||
@@ -40,8 +30,31 @@ in {
|
|||||||
viAlias = true;
|
viAlias = true;
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
|
|
||||||
# currently we use lazy.nvim as neovim's package manager, so comment this one.
|
# These environment variables are needed to build and run binaries
|
||||||
# Install packages that will compile locally or download FHS binaries via Nix!
|
# with external package managers like mason.nvim.
|
||||||
|
#
|
||||||
|
# LD_LIBRARY_PATH is also needed to run the non-FHS binaries downloaded by mason.nvim.
|
||||||
|
# it will be set by nix-ld, so we do not need to set it here again.
|
||||||
|
extraWrapperArgs = with pkgs; [
|
||||||
|
# LIBRARY_PATH is used by gcc before compilation to search directories
|
||||||
|
# containing static and shared libraries that need to be linked to your program.
|
||||||
|
"--suffix"
|
||||||
|
"LIBRARY_PATH"
|
||||||
|
":"
|
||||||
|
"${lib.makeLibraryPath [stdenv.cc.cc zlib]}"
|
||||||
|
|
||||||
|
# PKG_CONFIG_PATH is used by pkg-config before compilation to search directories
|
||||||
|
# containing .pc files that describe the libraries that need to be linked to your program.
|
||||||
|
"--suffix"
|
||||||
|
"PKG_CONFIG_PATH"
|
||||||
|
":"
|
||||||
|
"${lib.makeSearchPathOutput "dev" "lib/pkgconfig" [stdenv.cc.cc zlib]}"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Currently we use lazy.nvim as neovim's package manager, so comment this one.
|
||||||
|
#
|
||||||
|
# NOTE: These plugins will not be used by astronvim by default!
|
||||||
|
# We should install packages that will compile locally or download FHS binaries via Nix!
|
||||||
# and use lazy.nvim's `dir` option to specify the package directory in nix store.
|
# and use lazy.nvim's `dir` option to specify the package directory in nix store.
|
||||||
# so that these plugins can work on NixOS.
|
# so that these plugins can work on NixOS.
|
||||||
#
|
#
|
||||||
@@ -50,6 +63,8 @@ in {
|
|||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
# search all the plugins using https://search.nixos.org/packages
|
# search all the plugins using https://search.nixos.org/packages
|
||||||
telescope-fzf-native-nvim
|
telescope-fzf-native-nvim
|
||||||
|
|
||||||
|
nvim-treesitter.withAllGrammars
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"neodev": {
|
||||||
|
"library": {
|
||||||
|
"enabled": true,
|
||||||
|
"plugins": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"neoconf": {
|
||||||
|
"plugins": {
|
||||||
|
"lua_ls": {
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lspconfig": {
|
||||||
|
"lua_ls": {
|
||||||
|
"Lua.format.enable": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution
|
||||||
|
-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk.
|
||||||
|
local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then
|
||||||
|
-- stylua: ignore
|
||||||
|
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- validate that lazy is available
|
||||||
|
if not pcall(require, "lazy") then
|
||||||
|
-- stylua: ignore
|
||||||
|
vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
vim.cmd.quit()
|
||||||
|
end
|
||||||
|
|
||||||
|
require "lazy_setup"
|
||||||
|
require "polish"
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
-- AstroCommunity: import any community modules here
|
||||||
|
-- We import this file in `lazy_setup.lua` before the `plugins/` folder.
|
||||||
|
-- This guarantees that the specs are processed before any user plugins.
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
"AstroNvim/astrocommunity",
|
||||||
|
-- Motion
|
||||||
|
{ import = "astrocommunity.motion.mini-surround" },
|
||||||
|
-- https://github.com/echasnovski/mini.ai
|
||||||
|
{ import = "astrocommunity.motion.mini-ai" },
|
||||||
|
{ import = "astrocommunity.motion.flash-nvim" },
|
||||||
|
-- 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 / System
|
||||||
|
{ import = "astrocommunity.pack.lua" },
|
||||||
|
{ import = "astrocommunity.pack.go" },
|
||||||
|
{ import = "astrocommunity.pack.rust" },
|
||||||
|
{ import = "astrocommunity.pack.python" },
|
||||||
|
{ import = "astrocommunity.pack.java" },
|
||||||
|
{ import = "astrocommunity.pack.cmake" },
|
||||||
|
{ import = "astrocommunity.pack.cpp" },
|
||||||
|
-- { 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.docker" },
|
||||||
|
{ import = "astrocommunity.pack.helm" },
|
||||||
|
|
||||||
|
-- colorscheme
|
||||||
|
{ import = "astrocommunity.colorscheme.catppuccin" },
|
||||||
|
|
||||||
|
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
|
||||||
|
{ import = "astrocommunity.motion.nvim-spider" },
|
||||||
|
-- AI Assistant
|
||||||
|
{ import = "astrocommunity.completion.copilot-lua-cmp" },
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
require("lazy").setup({
|
||||||
|
{
|
||||||
|
"AstroNvim/AstroNvim",
|
||||||
|
version = "^4", -- Remove version tracking to elect for nighly AstroNvim
|
||||||
|
import = "astronvim.plugins",
|
||||||
|
opts = { -- AstroNvim options must be set here with the `import` key
|
||||||
|
mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up
|
||||||
|
maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up
|
||||||
|
icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available)
|
||||||
|
pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ import = "community" },
|
||||||
|
{ import = "plugins" },
|
||||||
|
} --[[@as LazySpec]], {
|
||||||
|
-- Configure any other `lazy.nvim` configuration options here
|
||||||
|
-- https://github.com/folke/lazy.nvim?tab=readme-ov-file#%EF%B8%8F-configuration
|
||||||
|
|
||||||
|
-- try to load one of these colorschemes when starting an installation during startup
|
||||||
|
install = { colorscheme = { "catppuccin" }, },
|
||||||
|
ui = { backdrop = 100 },
|
||||||
|
performance = {
|
||||||
|
rtp = {
|
||||||
|
-- disable some rtp plugins, add more to your liking
|
||||||
|
disabled_plugins = {
|
||||||
|
"gzip",
|
||||||
|
"netrwPlugin",
|
||||||
|
"tarPlugin",
|
||||||
|
"tohtml",
|
||||||
|
"zipPlugin",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
} --[[@as LazyConfig]])
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more!
|
||||||
|
-- Configuration documentation can be found with `:h astrocore`
|
||||||
|
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
|
||||||
|
-- as this provides autocomplete and documentation while editing
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
"AstroNvim/astrocore",
|
||||||
|
---@type AstroCoreOpts
|
||||||
|
opts = {
|
||||||
|
-- Configure core features of AstroNvim
|
||||||
|
features = {
|
||||||
|
large_buf = { size = 1024 * 500, lines = 10000 }, -- set global limits for large files for disabling features like treesitter
|
||||||
|
autopairs = true, -- enable autopairs at start
|
||||||
|
cmp = true, -- enable completion at start
|
||||||
|
diagnostics_mode = 3, -- diagnostic mode on start (0 = off, 1 = no signs/virtual text, 2 = no virtual text, 3 = on)
|
||||||
|
highlighturl = true, -- highlight URLs at start
|
||||||
|
notifications = true, -- enable notifications at start
|
||||||
|
},
|
||||||
|
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
|
||||||
|
diagnostics = {
|
||||||
|
virtual_text = true,
|
||||||
|
underline = true,
|
||||||
|
},
|
||||||
|
-- vim options can be configured here
|
||||||
|
options = {
|
||||||
|
opt = { -- vim.opt.<key>
|
||||||
|
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
|
||||||
|
title = true, -- Set the title of window to `filename [+=-] (path) - NVIM`
|
||||||
|
-- The percentage of 'columns' to use for the title
|
||||||
|
-- When the title is longer, only the end of the path name is shown.
|
||||||
|
titlelen = 20,
|
||||||
|
},
|
||||||
|
g = { -- vim.g.<key>
|
||||||
|
-- configure global vim variables (vim.g)
|
||||||
|
-- NOTE: `mapLeader` and `maplocalLeader` must be set in the AstroNvim opts or before `lazy.setup`
|
||||||
|
-- This can be found in the `lua/lazy_setup.lua` file
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Mappings can be configured through AstroCore as well.
|
||||||
|
-- https://docs.astronvim.com/recipes/mappings/
|
||||||
|
-- NOTE: keycodes follow the casing in the vimdocs. For example, `<Leader>` must be capitalized
|
||||||
|
mappings = {
|
||||||
|
-- first key is the mode
|
||||||
|
n = {
|
||||||
|
-- second key is the lefthand side of the map
|
||||||
|
|
||||||
|
-- second key is the lefthand side of the map
|
||||||
|
-- mappings seen under group name "Buffer"
|
||||||
|
["<Leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
||||||
|
-- quick save
|
||||||
|
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" },
|
||||||
|
|
||||||
|
-- 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'
|
||||||
|
-- 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",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- yank_history
|
||||||
|
["<Leader>yh"] = {
|
||||||
|
function() require("telescope").extensions.yank_history.yank_history() end,
|
||||||
|
desc = "Preview Yank History",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- undo history
|
||||||
|
["<Leader>uh"] = { "<cmd>Telescope undo<cr>", desc = "Telescope undo" },
|
||||||
|
|
||||||
|
-- implementation/definition preview
|
||||||
|
["gpd"] = { "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", desc = "goto_preview_definition" },
|
||||||
|
["gpt"] = {
|
||||||
|
"<cmd>lua require('goto-preview').goto_preview_type_definition()<CR>",
|
||||||
|
desc = "goto_preview_type_definition",
|
||||||
|
},
|
||||||
|
["gpi"] = {
|
||||||
|
"<cmd>lua require('goto-preview').goto_preview_implementation()<CR>",
|
||||||
|
desc = "goto_preview_implementation",
|
||||||
|
},
|
||||||
|
["gP"] = { "<cmd>lua require('goto-preview').close_all_win()<CR>", desc = "close_all_win" },
|
||||||
|
["gpr"] = { "<cmd>lua require('goto-preview').goto_preview_references()<CR>", desc = "goto_preview_references" },
|
||||||
|
},
|
||||||
|
t = {
|
||||||
|
-- setting a mapping to false will disable it
|
||||||
|
-- ["<esc>"] = false,
|
||||||
|
},
|
||||||
|
-- Visual mode
|
||||||
|
v = {
|
||||||
|
-- search and replace globally
|
||||||
|
["<Leader>sw"] = { '<esc><cmd>lua require("spectre").open_visual()<CR>', desc = "Search current word" },
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,215 @@
|
|||||||
|
-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine
|
||||||
|
-- Configuration documentation can be found with `:h astrolsp`
|
||||||
|
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
|
||||||
|
-- as this provides autocomplete and documentation while editing
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
"AstroNvim/astrolsp",
|
||||||
|
---@type AstroLSPOpts
|
||||||
|
opts = {
|
||||||
|
-- Configuration table of features provided by AstroLSP
|
||||||
|
features = {
|
||||||
|
autoformat = true, -- enable or disable auto formatting on start
|
||||||
|
codelens = true, -- enable/disable codelens refresh on start
|
||||||
|
inlay_hints = false, -- enable/disable inlay hints on start
|
||||||
|
semantic_tokens = true, -- enable/disable semantic token highlighting
|
||||||
|
},
|
||||||
|
-- customize lsp formatting options
|
||||||
|
formatting = {
|
||||||
|
-- control auto formatting on save
|
||||||
|
format_on_save = {
|
||||||
|
enabled = true, -- enable or disable format on save globally
|
||||||
|
allow_filetypes = { -- enable format on save for specified filetypes only
|
||||||
|
"go",
|
||||||
|
"jsonnet",
|
||||||
|
"rust",
|
||||||
|
"terraform",
|
||||||
|
"nu",
|
||||||
|
},
|
||||||
|
ignore_filetypes = { -- disable format on save for specified filetypes
|
||||||
|
-- "python",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
disabled = { -- disable formatting capabilities for the listed language servers
|
||||||
|
-- disable lua_ls formatting capability if you want to use StyLua to format your lua code
|
||||||
|
-- "lua_ls",
|
||||||
|
},
|
||||||
|
timeout_ms = 1000, -- default format timeout
|
||||||
|
-- filter = function(client) -- fully override the default formatting function
|
||||||
|
-- return true
|
||||||
|
-- end
|
||||||
|
},
|
||||||
|
-- enable servers that you already have installed without mason
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
|
servers = {
|
||||||
|
---- Data & Configuration Languages
|
||||||
|
"jsonls", -- json language server
|
||||||
|
"jsonnet_ls", -- jsonnet language server
|
||||||
|
"yamlls", -- yaml language server
|
||||||
|
"taplo", -- toml language server
|
||||||
|
"dagger", -- cuelsp - cue language server
|
||||||
|
"terraformls", -- terraform hcl
|
||||||
|
"marksman", -- markdown ls
|
||||||
|
"nickel_ls", -- nickel language server
|
||||||
|
"nil_ls", -- nix language server
|
||||||
|
"bufls", -- protocol buffer language server
|
||||||
|
"dockerls", -- dockerfile
|
||||||
|
"cmake", -- cmake language server
|
||||||
|
"sqls", -- sql language server
|
||||||
|
|
||||||
|
---- General Purpose Languages
|
||||||
|
"clangd", -- c/c++
|
||||||
|
"gopls", -- go
|
||||||
|
"jdtls", -- java language server, provides only basic features
|
||||||
|
"rust_analyzer", -- rust
|
||||||
|
"pyright", -- python
|
||||||
|
"ruff_lsp", -- extremely fast Python linter and code transformation
|
||||||
|
-- "julials", -- julia language server
|
||||||
|
-- "zls", -- zig language server
|
||||||
|
"lua_ls", -- lua
|
||||||
|
"bashls", -- bash
|
||||||
|
"nushell", -- nushell language server
|
||||||
|
|
||||||
|
---- Web Development
|
||||||
|
"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
|
||||||
|
|
||||||
|
---- Lisp Like
|
||||||
|
"scheme_langserver", -- scheme language server
|
||||||
|
"elixirls", -- elixir language server
|
||||||
|
-- "clojure_lsp", -- clojure language server"
|
||||||
|
|
||||||
|
---- Circuit Design
|
||||||
|
"verible", -- verilog language server
|
||||||
|
},
|
||||||
|
-- customize language server configuration options passed to `lspconfig`
|
||||||
|
---@diagnostic disable: missing-fields
|
||||||
|
config = {
|
||||||
|
-- the offset_encoding of clangd will confilicts whit null-ls
|
||||||
|
-- so we need to manually set it to utf-8
|
||||||
|
clangd = {
|
||||||
|
capabilities = {
|
||||||
|
offsetEncoding = "utf-8",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
scheme_langserver = {
|
||||||
|
filetypes = { "scheme", "scm" },
|
||||||
|
single_file_support = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- customize how language servers are attached
|
||||||
|
handlers = {
|
||||||
|
-- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server
|
||||||
|
-- function(server, opts) require("lspconfig")[server].setup(opts) end
|
||||||
|
|
||||||
|
-- the key is the server that is being setup with `lspconfig`
|
||||||
|
-- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server
|
||||||
|
-- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed
|
||||||
|
},
|
||||||
|
-- Configure buffer local auto commands to add when attaching a language server
|
||||||
|
autocmds = {
|
||||||
|
-- first key is the `augroup` to add the auto commands to (:h augroup)
|
||||||
|
lsp_document_highlight = {
|
||||||
|
-- Optional condition to create/delete auto command group
|
||||||
|
-- can either be a string of a client capability or a function of `fun(client, bufnr): boolean`
|
||||||
|
-- condition will be resolved for each client on each execution and if it ever fails for all clients,
|
||||||
|
-- the auto commands will be deleted for that buffer
|
||||||
|
cond = "textDocument/documentHighlight",
|
||||||
|
-- cond = function(client, bufnr) return client.name == "lua_ls" end,
|
||||||
|
-- list of auto commands to set
|
||||||
|
{
|
||||||
|
-- events to trigger
|
||||||
|
event = { "CursorHold", "CursorHoldI" },
|
||||||
|
-- the rest of the autocmd options (:h nvim_create_autocmd)
|
||||||
|
desc = "Document Highlighting",
|
||||||
|
callback = function() vim.lsp.buf.document_highlight() end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
event = { "CursorMoved", "CursorMovedI", "BufLeave" },
|
||||||
|
desc = "Document Highlighting Clear",
|
||||||
|
callback = function() vim.lsp.buf.clear_references() end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- mappings to be set up on attaching of a language server
|
||||||
|
mappings = {
|
||||||
|
n = {
|
||||||
|
gl = { function() vim.diagnostic.open_float() end, desc = "Hover diagnostics" },
|
||||||
|
|
||||||
|
-- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean
|
||||||
|
-- gD = {
|
||||||
|
-- function() vim.lsp.buf.declaration() end,
|
||||||
|
-- desc = "Declaration of current symbol",
|
||||||
|
-- cond = "textDocument/declaration",
|
||||||
|
-- },
|
||||||
|
-- ["<Leader>uY"] = {
|
||||||
|
-- function() require("astrolsp.toggles").buffer_semantic_tokens() end,
|
||||||
|
-- desc = "Toggle LSP semantic highlight (buffer)",
|
||||||
|
-- cond = function(client) return client.server_capabilities.semanticTokensProvider and vim.lsp.semantic_tokens end,
|
||||||
|
-- },
|
||||||
|
|
||||||
|
-- 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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- 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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- A custom `on_attach` function to be run after the default `on_attach` function
|
||||||
|
-- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`)
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
-- this would disable semanticTokensProvider for all clients
|
||||||
|
-- client.server_capabilities.semanticTokensProvider = nil
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
-- AstroUI provides the basis for configuring the AstroNvim User Interface
|
||||||
|
-- Configuration documentation can be found with `:h astroui`
|
||||||
|
-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`)
|
||||||
|
-- as this provides autocomplete and documentation while editing
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
"AstroNvim/astroui",
|
||||||
|
---@type AstroUIOpts
|
||||||
|
opts = {
|
||||||
|
-- change colorscheme
|
||||||
|
-- colorscheme = "astrodark",
|
||||||
|
colorscheme = "catppuccin",
|
||||||
|
-- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes
|
||||||
|
highlights = {
|
||||||
|
init = { -- this table overrides highlights in all themes
|
||||||
|
-- Normal = { bg = "#000000" },
|
||||||
|
},
|
||||||
|
astrotheme = { -- a table of overrides/changes when applying the astrotheme theme
|
||||||
|
-- Normal = { bg = "#000000" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Icons can be configured throughout the interface
|
||||||
|
icons = {
|
||||||
|
-- configure the loading of the lsp in the status line
|
||||||
|
LSPLoading1 = "⠋",
|
||||||
|
LSPLoading2 = "⠙",
|
||||||
|
LSPLoading3 = "⠹",
|
||||||
|
LSPLoading4 = "⠸",
|
||||||
|
LSPLoading5 = "⠼",
|
||||||
|
LSPLoading6 = "⠴",
|
||||||
|
LSPLoading7 = "⠦",
|
||||||
|
LSPLoading8 = "⠧",
|
||||||
|
LSPLoading9 = "⠇",
|
||||||
|
LSPLoading10 = "⠏",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
"0x00-ketsu/autosave.nvim",
|
||||||
|
-- lazy-loading on events
|
||||||
|
event = { "InsertLeave", "TextChanged" },
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.prompt_style = "stdout" -- notify or stdout
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
return {
|
||||||
|
"catppuccin/nvim",
|
||||||
|
name = "catppuccin",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.flavour = "mocha" -- latte, frappe, macchiato, mocha
|
||||||
|
opts.transparent_background = true -- setting the background color.
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
return {
|
||||||
|
"Olical/conjure",
|
||||||
|
ft = { "clojure", "fennel", "python", "scheme" }, -- etc
|
||||||
|
-- [Optional] cmp-conjure for cmp
|
||||||
|
dependencies = {
|
||||||
|
{
|
||||||
|
"PaterJason/cmp-conjure",
|
||||||
|
config = function()
|
||||||
|
local cmp = require "cmp"
|
||||||
|
local config = cmp.get_config()
|
||||||
|
table.insert(config.sources, {
|
||||||
|
name = "buffer",
|
||||||
|
option = {
|
||||||
|
sources = {
|
||||||
|
{ name = "conjure" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
cmp.setup(config)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("conjure.main").main()
|
||||||
|
require("conjure.mapping")["on-filetype"]()
|
||||||
|
end,
|
||||||
|
init = function()
|
||||||
|
-- Set configuration options here
|
||||||
|
vim.g["conjure#debug"] = true
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
-- Custom copilot-lua to enable filetypes: markdown
|
||||||
|
return {
|
||||||
|
"zbirenbaum/copilot.lua",
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.filetypes = {
|
||||||
|
yaml = true,
|
||||||
|
markdown = true,
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
return { "folke/flash.nvim", vscode = false }
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
-- implementation/definition preview
|
||||||
|
return {
|
||||||
|
"rmagatti/goto-preview",
|
||||||
|
config = function() require("goto-preview").setup {} end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
-- markdown preview
|
||||||
|
return {
|
||||||
|
"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,
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
-- Customize Mason plugins
|
||||||
|
--
|
||||||
|
-- NOTE: Issue - mason.nvim does not support NixOS:
|
||||||
|
-- https://github.com/williamboman/mason.nvim/issues/428
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
-- use mason-lspconfig to configure LSP installations
|
||||||
|
{
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
-- mason is unusable on NixOS, disable it.
|
||||||
|
-- ensure_installed nothing
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = nil
|
||||||
|
opts.automatic_installation = false
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- overrides `require("mason-lspconfig").setup(...)`
|
||||||
|
-- opts = function(_, opts)
|
||||||
|
-- -- add more things to the ensure_installed table protecting against community packs modifying it
|
||||||
|
-- opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
|
||||||
|
-- "lua_ls",
|
||||||
|
-- -- add more arguments for adding more language servers
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
},
|
||||||
|
-- use mason-null-ls to configure Formatters/Linter installation for null-ls sources
|
||||||
|
{
|
||||||
|
"jay-babu/mason-null-ls.nvim",
|
||||||
|
-- mason is unusable on NixOS, disable it.
|
||||||
|
-- ensure_installed nothing
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.ensure_installed = nil
|
||||||
|
opts.automatic_installation = false
|
||||||
|
end,
|
||||||
|
|
||||||
|
-- -- overrides `require("mason-null-ls").setup(...)`
|
||||||
|
-- opts = function(_, opts)
|
||||||
|
-- -- add more things to the ensure_installed table protecting against community packs modifying it
|
||||||
|
-- opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
|
||||||
|
-- "prettier",
|
||||||
|
-- "stylua",
|
||||||
|
-- -- add more arguments for adding more null-ls sources
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
-- https://docs.astronvim.com/recipes/dap/
|
||||||
|
"jay-babu/mason-nvim-dap.nvim",
|
||||||
|
-- mason is unusable on NixOS, disable it.
|
||||||
|
-- ensure_installed nothing
|
||||||
|
-- opts = function(_, opts)
|
||||||
|
-- opts.ensure_installed = nil
|
||||||
|
-- opts.automatic_installation = false
|
||||||
|
-- end,
|
||||||
|
|
||||||
|
-- overrides `require("mason-nvim-dap").setup(...)`
|
||||||
|
-- opts = function(_, opts)
|
||||||
|
-- -- add more things to the ensure_installed table protecting against community packs modifying it
|
||||||
|
-- opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
|
||||||
|
-- "python",
|
||||||
|
-- -- add more arguments for adding more debuggers
|
||||||
|
-- })
|
||||||
|
-- end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
-- File explorer(Custom configs)
|
||||||
|
return {
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
opts = {
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
visible = true, -- visible by default
|
||||||
|
hide_dotfiles = false,
|
||||||
|
hide_gitignored = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- full signature help, docs and completion for the nvim lua API.
|
||||||
|
return { "folke/neodev.nvim", opts = {} }
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
return { "Olical/nfnl", ft = "fennel" }
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
-- Customize None-ls sources
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
"nvimtools/none-ls.nvim",
|
||||||
|
opts = function(_, config)
|
||||||
|
-- config variable is the default configuration table for the setup function call
|
||||||
|
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
|
||||||
|
|
||||||
|
-- Check supported formatters and linters
|
||||||
|
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||||
|
-- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||||
|
config.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.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.goimports, -- Go formatter
|
||||||
|
formatting.shfmt, -- Shell formatter
|
||||||
|
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
|
||||||
|
formatting.verible_verilog_format, -- Verilog formatter
|
||||||
|
formatting.emacs_scheme_mode, -- using emacs in batch mode to format scheme files.
|
||||||
|
formatting.fnlfmt, -- Format Fennel code
|
||||||
|
}
|
||||||
|
return config -- return final config table
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
-- The plugin offers the abilibty to search and replace.
|
||||||
|
return {
|
||||||
|
"nvim-pack/nvim-spectre",
|
||||||
|
dependencies = {
|
||||||
|
{ "nvim-lua/plenary.nvim" },
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
return {
|
||||||
|
'nvim-orgmode/orgmode',
|
||||||
|
event = 'VeryLazy',
|
||||||
|
ft = { 'org' },
|
||||||
|
config = function()
|
||||||
|
-- Setup orgmode
|
||||||
|
require('orgmode').setup({
|
||||||
|
org_agenda_files = "~/org/**/*",
|
||||||
|
org_default_notes_file = "~/org/refile.org",
|
||||||
|
})
|
||||||
|
|
||||||
|
-- NOTE: If you are using nvim-treesitter with ~ensure_installed = "all"~ option
|
||||||
|
-- add ~org~ to ignore_install
|
||||||
|
require('nvim-treesitter.configs').setup({
|
||||||
|
ensure_installed = 'all',
|
||||||
|
ignore_install = { 'org' },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
"eraserhd/parinfer-rust",
|
||||||
|
build = "cargo build --release",
|
||||||
|
ft = { "scm", "scheme" },
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
-- The plugin offers the alibity to refactor code.
|
||||||
|
return {
|
||||||
|
"ThePrimeagen/refactoring.nvim",
|
||||||
|
dependencies = {
|
||||||
|
{ "nvim-lua/plenary.nvim" },
|
||||||
|
{ "nvim-treesitter/nvim-treesitter" },
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
-- Enhanced matchparen.vim plugin for Neovim to highlight the outer pair.
|
||||||
|
return {
|
||||||
|
"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,
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
return {
|
||||||
|
"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)
|
||||||
|
|
||||||
|
-- Load Extensions
|
||||||
|
require("telescope").load_extension "refactoring"
|
||||||
|
require("telescope").load_extension "yank_history"
|
||||||
|
require("telescope").load_extension "undo"
|
||||||
|
end
|
||||||
|
|
||||||
|
require("telescope").setup {
|
||||||
|
defaults = {
|
||||||
|
buffer_previewer_maker = new_maker,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- disable toggleterm.nvim, zellij's terminal is far better than neovim's one
|
||||||
|
return { "akinsho/toggleterm.nvim", enabled = false }
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
-- Customize Treesitter
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
dependencies = {
|
||||||
|
-- NOTE: additional parser
|
||||||
|
{ "nushell/tree-sitter-nu" }, -- nushell scripts
|
||||||
|
},
|
||||||
|
opts = function(_, opts)
|
||||||
|
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.ignore_install = { "gotmpl", "wing" }
|
||||||
|
|
||||||
|
-- add more things to the ensure_installed table protecting against community packs modifying it
|
||||||
|
-- https://github.com/nvim-treesitter/nvim-treesitter/tree/master
|
||||||
|
opts.ensure_installed = require("astrocore").list_insert_unique(opts.ensure_installed, {
|
||||||
|
-- please add only the tree-sitters that are not available in nixpkgs here
|
||||||
|
|
||||||
|
"kdl",
|
||||||
|
"csv",
|
||||||
|
"xml",
|
||||||
|
|
||||||
|
---- Misc
|
||||||
|
"diff",
|
||||||
|
"git_config",
|
||||||
|
"git_rebase",
|
||||||
|
"gitignore",
|
||||||
|
"gitcommit",
|
||||||
|
"gitattributes",
|
||||||
|
"ssh_config",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
-- joining blocks of code into oneline, or splitting one line into multiple lines.
|
||||||
|
return {
|
||||||
|
"Wansmer/treesj",
|
||||||
|
keys = { "<space>m", "<space>j", "<space>s" },
|
||||||
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||||
|
config = function()
|
||||||
|
require("treesj").setup { --[[ your config ]]
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
-- Undo tree
|
||||||
|
return { "debugloop/telescope-undo.nvim" }
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
-- You can also add or configure plugins by creating files in this `plugins/` folder
|
||||||
|
-- Here are some examples:
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
|
||||||
|
-- == Examples of Adding Plugins ==
|
||||||
|
|
||||||
|
"andweeb/presence.nvim",
|
||||||
|
{
|
||||||
|
"ray-x/lsp_signature.nvim",
|
||||||
|
event = "BufRead",
|
||||||
|
config = function() require("lsp_signature").setup() end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- == Examples of Overriding Plugins ==
|
||||||
|
|
||||||
|
-- customize alpha options
|
||||||
|
{
|
||||||
|
"goolord/alpha-nvim",
|
||||||
|
opts = function(_, opts)
|
||||||
|
-- customize the dashboard header
|
||||||
|
opts.section.header.val = {
|
||||||
|
" █████ ███████ ████████ ██████ ██████",
|
||||||
|
"██ ██ ██ ██ ██ ██ ██ ██",
|
||||||
|
"███████ ███████ ██ ██████ ██ ██",
|
||||||
|
"██ ██ ██ ██ ██ ██ ██ ██",
|
||||||
|
"██ ██ ███████ ██ ██ ██ ██████",
|
||||||
|
" ",
|
||||||
|
" ███ ██ ██ ██ ██ ███ ███",
|
||||||
|
" ████ ██ ██ ██ ██ ████ ████",
|
||||||
|
" ██ ██ ██ ██ ██ ██ ██ ████ ██",
|
||||||
|
" ██ ██ ██ ██ ██ ██ ██ ██ ██",
|
||||||
|
" ██ ████ ████ ██ ██ ██",
|
||||||
|
}
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- You can disable default plugins as follows:
|
||||||
|
{ "max397574/better-escape.nvim", enabled = false },
|
||||||
|
|
||||||
|
-- You can also easily customize additional setup of plugins that is outside of the plugin's setup call
|
||||||
|
{
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
config = function(plugin, opts)
|
||||||
|
require "astronvim.plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call
|
||||||
|
-- add more custom luasnip configuration such as filetype extend or custom snippets
|
||||||
|
local luasnip = require "luasnip"
|
||||||
|
luasnip.filetype_extend("javascript", { "javascriptreact" })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
config = function(plugin, opts)
|
||||||
|
require "astronvim.plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call
|
||||||
|
-- add more custom autopairs configuration such as custom rules
|
||||||
|
local npairs = require "nvim-autopairs"
|
||||||
|
local Rule = require "nvim-autopairs.rule"
|
||||||
|
local cond = require "nvim-autopairs.conds"
|
||||||
|
npairs.add_rules(
|
||||||
|
{
|
||||||
|
Rule("$", "$", { "tex", "latex" })
|
||||||
|
-- don't add a pair if the next character is %
|
||||||
|
:with_pair(cond.not_after_regex "%%")
|
||||||
|
-- don't add a pair if the previous character is xxx
|
||||||
|
:with_pair(
|
||||||
|
cond.not_before_regex("xxx", 3)
|
||||||
|
)
|
||||||
|
-- don't move right when repeat character
|
||||||
|
:with_move(cond.none())
|
||||||
|
-- don't delete if the next character is xx
|
||||||
|
:with_del(cond.not_after_regex "xx")
|
||||||
|
-- disable adding a newline when you press <cr>
|
||||||
|
:with_cr(cond.none()),
|
||||||
|
},
|
||||||
|
-- disable for .vim files, but it work for another filetypes
|
||||||
|
Rule("a", "a", "-vim")
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
-- clipboard manager
|
||||||
|
return {
|
||||||
|
"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" },
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
-- This will run last in the setup process and is a good place to configure
|
||||||
|
-- things like custom filetypes. This just pure lua so anything that doesn't
|
||||||
|
-- fit in the normal config locations above can go here
|
||||||
|
|
||||||
|
-- Set up custom filetypes
|
||||||
|
-- vim.filetype.add {
|
||||||
|
-- extension = {
|
||||||
|
-- foo = "fooscript",
|
||||||
|
-- },
|
||||||
|
-- filename = {
|
||||||
|
-- ["Foofile"] = "fooscript",
|
||||||
|
-- },
|
||||||
|
-- pattern = {
|
||||||
|
-- ["~/%.config/foo/.*"] = "fooscript",
|
||||||
|
-- },
|
||||||
|
-- }
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
base: lua51
|
||||||
|
|
||||||
|
globals:
|
||||||
|
vim:
|
||||||
|
any: true
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
std = "neovim"
|
||||||
|
|
||||||
|
[rules]
|
||||||
|
global_usage = "allow"
|
||||||
|
if_same_then_else = "allow"
|
||||||
|
incorrect_standard_library_use = "allow"
|
||||||
|
mixed_table = "allow"
|
||||||
|
multiple_statements = "allow"
|
||||||
@@ -5,7 +5,48 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; (
|
||||||
|
# -*- Data & Configuration Languages -*-#
|
||||||
|
[
|
||||||
|
#-- 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
|
||||||
|
|
||||||
|
#-- nickel lang
|
||||||
|
nickel
|
||||||
|
|
||||||
|
#-- json like
|
||||||
|
# terraform # install via brew on macOS
|
||||||
|
terraform-ls
|
||||||
|
jsonnet
|
||||||
|
jsonnet-language-server
|
||||||
|
taplo # TOML language server / formatter / validator
|
||||||
|
nodePackages.yaml-language-server
|
||||||
|
actionlint # GitHub Actions linter
|
||||||
|
|
||||||
|
#-- dockerfile
|
||||||
|
hadolint # Dockerfile linter
|
||||||
|
nodePackages.dockerfile-language-server-nodejs
|
||||||
|
|
||||||
|
#-- markdown
|
||||||
|
marksman # language server for markdown
|
||||||
|
glow # markdown previewer
|
||||||
|
pandoc # document converter
|
||||||
|
hugo # static site generator
|
||||||
|
|
||||||
|
#-- sql
|
||||||
|
sqlfluff
|
||||||
|
|
||||||
|
#-- protocol buffer
|
||||||
|
buf # linting and formatting
|
||||||
|
]
|
||||||
|
++
|
||||||
|
#-*- General Purpose Languages -*-#
|
||||||
|
[
|
||||||
#-- c/c++
|
#-- c/c++
|
||||||
cmake
|
cmake
|
||||||
cmake-language-server
|
cmake-language-server
|
||||||
@@ -13,34 +54,39 @@
|
|||||||
checkmake
|
checkmake
|
||||||
# c/c++ compiler, required by nvim-treesitter!
|
# c/c++ compiler, required by nvim-treesitter!
|
||||||
gcc
|
gcc
|
||||||
|
gdb
|
||||||
# c/c++ tools with clang-tools, the unwrapped version won't
|
# c/c++ tools with clang-tools, the unwrapped version won't
|
||||||
# add alias like `cc` and `c++`, so that it won't conflict with gcc
|
# add alias like `cc` and `c++`, so that it won't conflict with gcc
|
||||||
llvmPackages.clang-unwrapped
|
# llvmPackages.clang-unwrapped
|
||||||
|
clang-tools
|
||||||
lldb
|
lldb
|
||||||
|
|
||||||
#-- python
|
#-- python
|
||||||
nodePackages.pyright # python language server
|
pyright # python language server
|
||||||
(python311.withPackages (
|
(python311.withPackages (
|
||||||
ps:
|
ps:
|
||||||
with ps; [
|
with ps; [
|
||||||
ruff-lsp
|
ruff-lsp
|
||||||
black # python formatter
|
black # python formatter
|
||||||
|
# debugpy
|
||||||
|
|
||||||
|
# my commonly used python packages
|
||||||
jupyter
|
jupyter
|
||||||
ipython
|
ipython
|
||||||
pandas
|
pandas
|
||||||
requests
|
requests
|
||||||
pyquery
|
pyquery
|
||||||
pyyaml
|
pyyaml
|
||||||
|
boto3
|
||||||
|
|
||||||
## emacs's lsp-bridge dependenciesge
|
## emacs's lsp-bridge dependenciesge
|
||||||
epc
|
# epc
|
||||||
orjson
|
# orjson
|
||||||
sexpdata
|
# sexpdata
|
||||||
six
|
# six
|
||||||
setuptools
|
# setuptools
|
||||||
paramiko
|
# paramiko
|
||||||
rapidfuzz
|
# rapidfuzz
|
||||||
]
|
]
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -49,14 +95,6 @@
|
|||||||
cargo # rust package manager
|
cargo # rust package manager
|
||||||
rustfmt
|
rustfmt
|
||||||
|
|
||||||
#-- 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
|
#-- golang
|
||||||
go
|
go
|
||||||
gomodifytags
|
gomodifytags
|
||||||
@@ -71,6 +109,10 @@
|
|||||||
gradle
|
gradle
|
||||||
maven
|
maven
|
||||||
spring-boot-cli
|
spring-boot-cli
|
||||||
|
jdt-language-server
|
||||||
|
|
||||||
|
#-- zig
|
||||||
|
zls
|
||||||
|
|
||||||
#-- lua
|
#-- lua
|
||||||
stylua
|
stylua
|
||||||
@@ -80,8 +122,9 @@
|
|||||||
nodePackages.bash-language-server
|
nodePackages.bash-language-server
|
||||||
shellcheck
|
shellcheck
|
||||||
shfmt
|
shfmt
|
||||||
|
]
|
||||||
#-- javascript/typescript --#
|
#-*- Web Development -*-#
|
||||||
|
++ [
|
||||||
nodePackages.nodejs
|
nodePackages.nodejs
|
||||||
nodePackages.typescript
|
nodePackages.typescript
|
||||||
nodePackages.typescript-language-server
|
nodePackages.typescript-language-server
|
||||||
@@ -89,45 +132,24 @@
|
|||||||
nodePackages.vscode-langservers-extracted
|
nodePackages.vscode-langservers-extracted
|
||||||
nodePackages."@tailwindcss/language-server"
|
nodePackages."@tailwindcss/language-server"
|
||||||
emmet-ls
|
emmet-ls
|
||||||
|
]
|
||||||
# -- Lisp like Languages
|
# -*- Lisp like Languages -*-#
|
||||||
|
++ [
|
||||||
guile
|
guile
|
||||||
racket-minimal
|
racket-minimal
|
||||||
fnlfmt # fennel
|
fnlfmt # fennel
|
||||||
|
]
|
||||||
#-- 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
|
proselint # English prose linter
|
||||||
|
|
||||||
#-- Misc
|
|
||||||
tree-sitter # common language parser/highlighter
|
|
||||||
nodePackages.prettier # common code formatter
|
|
||||||
marksman # language server for markdown
|
|
||||||
glow # markdown previewer
|
|
||||||
fzf
|
|
||||||
pandoc # document converter
|
|
||||||
hugo # static site generator
|
|
||||||
|
|
||||||
#-- Optional Requirements:
|
|
||||||
gdu # disk usage analyzer, required by AstroNvim
|
|
||||||
(ripgrep.override {withPCRE2 = true;}) # recursively searches directories for a regex pattern
|
|
||||||
|
|
||||||
#-- CloudNative
|
|
||||||
nodePackages.dockerfile-language-server-nodejs
|
|
||||||
# terraform # install via brew on macOS
|
|
||||||
terraform-ls
|
|
||||||
jsonnet
|
|
||||||
jsonnet-language-server
|
|
||||||
hadolint # Dockerfile linter
|
|
||||||
|
|
||||||
#-- zig
|
|
||||||
zls
|
|
||||||
#-- verilog / systemverilog
|
#-- verilog / systemverilog
|
||||||
verible
|
verible
|
||||||
gdb
|
|
||||||
];
|
#-- Optional Requirements:
|
||||||
|
nodePackages.prettier # common code formatter
|
||||||
|
fzf
|
||||||
|
gdu # disk usage analyzer, required by AstroNvim
|
||||||
|
(ripgrep.override {withPCRE2 = true;}) # recursively searches directories for a regex pattern
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ using a Cloud provider for key management.
|
|||||||
Both age, Sops & GnuPG provide asymmetric encryption, which is useful for encrypting files for a
|
Both age, Sops & GnuPG provide asymmetric encryption, which is useful for encrypting files for a
|
||||||
specific user.
|
specific user.
|
||||||
|
|
||||||
For morden use, age is recommended, as it use [AEAD encryption function -
|
For modern use, age is recommended, as it use [AEAD encryption function -
|
||||||
ChaCha20-Poly1305][age Format v1], If you do not want to manage the keys by yourself, Sops is
|
ChaCha20-Poly1305][age Format v1], If you do not want to manage the keys by yourself, Sops is
|
||||||
recommended, as it use KMS for key management.
|
recommended, as it use KMS for key management.
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ one keypair, or a keyring/keychain(which contains multiple sub key-pairs).
|
|||||||
|
|
||||||
Let's generate a keypair interactively:
|
Let's generate a keypair interactively:
|
||||||
|
|
||||||
> Now in 2024, GnuPG 2.4.1 defaults to ECC algorithm (9) and Curve 25519 for ECC, which is morden
|
> Now in 2024, GnuPG 2.4.1 defaults to ECC algorithm (9) and Curve 25519 for ECC, which is modern
|
||||||
> and safe, I would recommend to use these defaults directly.
|
> and safe, I would recommend to use these defaults directly.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ in {
|
|||||||
use ${nu_scripts}/share/nu_scripts/custom-completions/cargo/cargo-completions.nu *
|
use ${nu_scripts}/share/nu_scripts/custom-completions/cargo/cargo-completions.nu *
|
||||||
use ${nu_scripts}/share/nu_scripts/custom-completions/zellij/zellij-completions.nu *
|
use ${nu_scripts}/share/nu_scripts/custom-completions/zellij/zellij-completions.nu *
|
||||||
# alias
|
# alias
|
||||||
use ${nu_scripts}/share/nu_scripts/aliases/git/git-aliases.nu *
|
# use ${nu_scripts}/share/nu_scripts/aliases/git/git-aliases.nu *
|
||||||
use ${nu_scripts}/share/nu_scripts/aliases/eza/eza-aliases.nu *
|
use ${nu_scripts}/share/nu_scripts/aliases/eza/eza-aliases.nu *
|
||||||
# use ${nu_scripts}/share/nu_scripts/aliases/bat/bat-aliases.nu *
|
use ${nu_scripts}/share/nu_scripts/aliases/bat/bat-aliases.nu *
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
{myvars, ...}: {
|
|
||||||
home.homeDirectory = "/Users/${myvars.username}";
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
{mylib, ...}: {
|
{
|
||||||
|
mylib,
|
||||||
|
myvars,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
home.homeDirectory = "/Users/${myvars.username}";
|
||||||
imports =
|
imports =
|
||||||
(mylib.scanPaths ./.)
|
(mylib.scanPaths ./.)
|
||||||
++ [
|
++ [
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
# misc
|
# misc
|
||||||
libnotify
|
libnotify
|
||||||
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
||||||
|
|
||||||
|
ventoy # create bootable usb
|
||||||
|
virt-viewer # vnc connect to VM, used by kubevirt
|
||||||
];
|
];
|
||||||
|
|
||||||
# auto mount usb drives
|
# auto mount usb drives
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
pkgs-unstable,
|
pkgs-unstable,
|
||||||
pkgs-stable,
|
# pkgs-stable,
|
||||||
nur-ryan4yin,
|
nur-ryan4yin,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
# kicad # 3d printing, eletrical engineering
|
# kicad # 3d printing, eletrical engineering
|
||||||
|
|
||||||
# fpga
|
# fpga
|
||||||
pkgs-unstable.python311Packages.apycula # gowin fpga
|
pkgs-unstable.python312Packages.apycula # gowin fpga
|
||||||
pkgs-unstable.yosys # fpga synthesis
|
pkgs-unstable.yosys # fpga synthesis
|
||||||
pkgs-unstable.nextpnr # fpga place and route
|
pkgs-unstable.nextpnr # fpga place and route
|
||||||
pkgs-unstable.openfpgaloader # fpga programming
|
pkgs-unstable.openfpgaloader # fpga programming
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
# live streaming
|
# live streaming
|
||||||
obs-studio = {
|
obs-studio = {
|
||||||
enable = true;
|
enable = true;
|
||||||
plugins = with pkgs-stable.obs-studio-plugins; [
|
plugins = with pkgs.obs-studio-plugins; [
|
||||||
# screen capture
|
# screen capture
|
||||||
wlrobs
|
wlrobs
|
||||||
# obs-ndi
|
# obs-ndi
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
theme = {
|
theme = {
|
||||||
# https://github.com/catppuccin/gtk
|
# https://github.com/catppuccin/gtk
|
||||||
name = "Catppuccin-Macchiato-Compact-Pink-Dark";
|
name = "catppuccin-macchiato-pink-compact";
|
||||||
package = pkgs.catppuccin-gtk.override {
|
package = pkgs.catppuccin-gtk.override {
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix
|
# https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix
|
||||||
accents = ["pink"];
|
accents = ["pink"];
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
pulsemixer
|
pulsemixer
|
||||||
imv # simple image viewer
|
imv # simple image viewer
|
||||||
|
|
||||||
nvtop
|
nvtopPackages.full
|
||||||
|
|
||||||
# video/audio tools
|
# video/audio tools
|
||||||
cava # for visualizing audio
|
cava # for visualizing audio
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs-stable, ...}: {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs-stable; [
|
||||||
# https://joplinapp.org/help/
|
# https://joplinapp.org/help/
|
||||||
joplin # joplin-cli
|
joplin # joplin-cli
|
||||||
joplin-desktop
|
joplin-desktop
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
"x-scheme-handler/tg" = ["org.telegram.desktop.desktop "];
|
"x-scheme-handler/tg" = ["org.telegram.desktop.desktop "];
|
||||||
|
|
||||||
"audio/*" = ["mpv.desktop"];
|
"audio/*" = ["mpv.desktop"];
|
||||||
"video/*" = ["mpv.dekstop"];
|
"video/*" = ["mpv.desktop"];
|
||||||
"image/*" = ["imv-dir.desktop"];
|
"image/*" = ["imv-dir.desktop"];
|
||||||
"image/gif" = ["imv-dir.desktop"];
|
"image/gif" = ["imv-dir.desktop"];
|
||||||
"image/jpeg" = ["imv-dir.desktop"];
|
"image/jpeg" = ["imv-dir.desktop"];
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
## Fix anyrun
|
||||||
|
## https://github.com/anyrun-org/anyrun/issues/153
|
||||||
|
ln -s $XDG_RUNTIME_DIR/hypr /tmp/hypr
|
||||||
|
|
||||||
## Autostart Programs
|
## Autostart Programs
|
||||||
|
|
||||||
# Kill already running process
|
# Kill already running process
|
||||||
@@ -14,10 +18,10 @@ done
|
|||||||
# it will by start by home-manager automatically, do not need to restart it here.
|
# it will by start by home-manager automatically, do not need to restart it here.
|
||||||
# systemctl --user restart wallpaper.service
|
# systemctl --user restart wallpaper.service
|
||||||
|
|
||||||
# Lauch notification daemon (mako)
|
# Launch notification daemon (mako)
|
||||||
~/.config/hypr/scripts/notifications &
|
~/.config/hypr/scripts/notifications &
|
||||||
|
|
||||||
# Lauch statusbar (waybar)
|
# Launch statusbar (waybar)
|
||||||
~/.config/hypr/scripts/statusbar &
|
~/.config/hypr/scripts/statusbar &
|
||||||
|
|
||||||
# Start mpd
|
# Start mpd
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
hyprland,
|
|
||||||
nur-ryan4yin,
|
nur-ryan4yin,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
package = pkgs.hyprland;
|
||||||
|
in {
|
||||||
# NOTE:
|
# NOTE:
|
||||||
# We have to enable hyprland/i3's systemd user service in home-manager,
|
# We have to enable hyprland/i3's systemd user service in home-manager,
|
||||||
# so that gammastep/wallpaper-switcher's user service can be start correctly!
|
# so that gammastep/wallpaper-switcher's user service can be start correctly!
|
||||||
# they are all depending on hyprland/i3's user graphical-session
|
# they are all depending on hyprland/i3's user graphical-session
|
||||||
wayland.windowManager.hyprland = {
|
wayland.windowManager.hyprland = {
|
||||||
|
inherit package;
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-hyprland}/themes/mocha.conf";
|
source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-hyprland}/themes/mocha.conf";
|
||||||
@@ -25,16 +27,18 @@
|
|||||||
"GDK_BACKEND,wayland"
|
"GDK_BACKEND,wayland"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
package = hyprland.packages.${pkgs.system}.hyprland;
|
|
||||||
extraConfig = builtins.readFile ../conf/hyprland.conf;
|
extraConfig = builtins.readFile ../conf/hyprland.conf;
|
||||||
# gammastep/wallpaper-switcher need this to be enabled.
|
# gammastep/wallpaper-switcher need this to be enabled.
|
||||||
systemd.enable = true;
|
systemd = {
|
||||||
|
enable = true;
|
||||||
|
variables = ["--all"];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# NOTE: this executable is used by greetd to start a wayland session when system boot up
|
# NOTE: this executable is used by greetd to start a wayland session when system boot up
|
||||||
# with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config in NixOS module
|
# with such a vendor-no-locking script, we can switch to another wayland compositor without modifying greetd's config in NixOS module
|
||||||
home.file.".wayland-session" = {
|
home.file.".wayland-session" = {
|
||||||
source = "${pkgs.hyprland}/bin/Hyprland";
|
source = "${package}/bin/Hyprland";
|
||||||
executable = true;
|
executable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -138,6 +138,20 @@ sudo nix --experimental-features "nix-command flakes" run github:nix-community/d
|
|||||||
|
|
||||||
cd ~/nix-config
|
cd ~/nix-config
|
||||||
# install nixos
|
# install nixos
|
||||||
# NOTE: the root password you set here will be discarded when reboot
|
|
||||||
sudo nixos-install --root /mnt --flake .#rakushun --no-root-password --show-trace --verbose
|
sudo nixos-install --root /mnt --flake .#rakushun --no-root-password --show-trace --verbose
|
||||||
|
|
||||||
|
# enter into the installed system, check password & users
|
||||||
|
# `su ryan` => `sudo -i` => enter ryan's password => successfully login
|
||||||
|
# if login failed, check the password you set in install-1, and try again
|
||||||
|
nixos-enter
|
||||||
|
|
||||||
|
# NOTE: DO NOT skip this step!!!
|
||||||
|
# copy the essential files into /persistent
|
||||||
|
# otherwise the / will be cleared and data will lost
|
||||||
|
## NOTE: impermanence just create links from / to /persistent
|
||||||
|
## We need to copy files into /persistent manually!!!
|
||||||
|
mv /etc/machine-id /persistent/etc/
|
||||||
|
mv /etc/ssh /persistent/etc/
|
||||||
|
mkdir -p /persistent/home/ryan
|
||||||
|
chown -R ryan:ryan /persistent/home/ryan
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -2,33 +2,15 @@
|
|||||||
|
|
||||||
LUKS encrypted SSD for NixOS, on Orange Pi 5 Plus.
|
LUKS encrypted SSD for NixOS, on Orange Pi 5 Plus.
|
||||||
|
|
||||||
Host running storage, operation and maintenance related services:
|
TODO
|
||||||
|
|
||||||
1. Storage such as git server, file server/browser, torrent downloader,, etc.
|
|
||||||
1. Backup or sync my personal data to cloud or NAS.
|
|
||||||
- For safety, those data should be encrypted before sending to the cloud or my NAS.
|
|
||||||
1. Collect and monitor the metrics/logs of my homelab.
|
|
||||||
|
|
||||||
## Showcases
|
## Showcases
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## Features
|
## Misc
|
||||||
|
|
||||||
Services:
|
```bash
|
||||||
|
# copy closure to another arm64 machine
|
||||||
1. prometheus + alertmanager + grafana + loki: Monitor the metrics/logs of my homelab.
|
nix-copy-closure --to root@suzu /run/current-system
|
||||||
1. restic: Backup my personal data to cloud or NAS.
|
```
|
||||||
1. synthing: Sync file between android/macbook/PC and NAS.
|
|
||||||
1. attic: Nix cache server.
|
|
||||||
1. gitea: Self-hosted git service.
|
|
||||||
1. sftpgo: SFTP server.
|
|
||||||
1. transmission & AriaNg: Torrent downloader and HTTP downloader
|
|
||||||
1. alist/filebrower: File browser for local/SMB/Cloud
|
|
||||||
|
|
||||||
All the services assumes a reverse proxy to be setup in the front, they are all listening on
|
|
||||||
localhost, and a caddy service is listening on the local network interface and proxy the requests to
|
|
||||||
the services.
|
|
||||||
|
|
||||||
TODO: create a private PKI for caddy, to achieve end-to-end encryption between caddy and the
|
|
||||||
services.
|
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
config,
|
|
||||||
attic,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
#=====================================================
|
|
||||||
#
|
|
||||||
# Attic
|
|
||||||
#
|
|
||||||
# A self-hostable Nix Binary Cache server
|
|
||||||
# backed by an S3-compatible storage provider
|
|
||||||
#
|
|
||||||
# https://docs.attic.rs/tutorial.html
|
|
||||||
#
|
|
||||||
#=====================================================
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
attic.nixosModules.atticd
|
|
||||||
];
|
|
||||||
|
|
||||||
# Self-Hosted Nix Cache Server
|
|
||||||
# https://github.com/zhaofengli/attic
|
|
||||||
#
|
|
||||||
# The first thing to do after setting up the server is:
|
|
||||||
# 1. Generate a admin token on the server via command:
|
|
||||||
# `sudo atticd-atticadm make-token --sub "admin-1" --validity "2y" --pull "*" --push "*" --delete "*" --create-cache "*" --configure-cache "*" --configure-cache-retention "*" --destroy-cache "*"`
|
|
||||||
# 2. Login at the desktop via command:
|
|
||||||
# `attic login central http://attic.writefor.fun <TOKEN>`
|
|
||||||
# 3. Create a new cache via command:
|
|
||||||
# `attic cache create rk3588`
|
|
||||||
# `attic use cache rk3588`
|
|
||||||
# 4. Push Caches to the cache server via:
|
|
||||||
# it's similar to cachix, related docs:
|
|
||||||
# https://docs.attic.rs/reference/attic-cli.html
|
|
||||||
# https://docs.cachix.org/pushing#pushing
|
|
||||||
services.atticd = {
|
|
||||||
enable = true;
|
|
||||||
|
|
||||||
# Replace with absolute path to your credentials file
|
|
||||||
# The HS256 JWT secret can be generated with the openssl:
|
|
||||||
# openssl rand 64 | base64 -w0
|
|
||||||
#
|
|
||||||
# Content:
|
|
||||||
# ATTIC_SERVER_TOKEN_HS256_SECRET_BASE64="output from openssl"
|
|
||||||
credentialsFile = config.age.secrets."attic-nix-cache-server.env".path;
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
listen = "127.0.0.1:3300";
|
|
||||||
|
|
||||||
# Data chunking
|
|
||||||
#
|
|
||||||
# Warning: If you change any of the values here, it will be
|
|
||||||
# difficult to reuse existing chunks for newly-uploaded NARs
|
|
||||||
# since the cutpoints will be different. As a result, the
|
|
||||||
# deduplication ratio will suffer for a while after the change.
|
|
||||||
chunking = {
|
|
||||||
# The minimum NAR size to trigger chunking
|
|
||||||
#
|
|
||||||
# If 0, chunking is disabled entirely for newly-uploaded NARs.
|
|
||||||
# If 1, all NARs are chunked.
|
|
||||||
nar-size-threshold = 64 * 1024; # 64 KiB
|
|
||||||
|
|
||||||
# The preferred minimum size of a chunk, in bytes
|
|
||||||
min-size = 16 * 1024; # 16 KiB
|
|
||||||
|
|
||||||
# The preferred average size of a chunk, in bytes
|
|
||||||
avg-size = 64 * 1024; # 64 KiB
|
|
||||||
|
|
||||||
# The preferred maximum size of a chunk, in bytes
|
|
||||||
max-size = 256 * 1024; # 256 KiB
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
{myvars, ...}: {
|
|
||||||
services.caddy = {
|
|
||||||
enable = true;
|
|
||||||
# Reload Caddy instead of restarting it when configuration file changes.
|
|
||||||
enableReload = true;
|
|
||||||
user = "caddy"; # User account under which caddy runs.
|
|
||||||
dataDir = "/var/lib/caddy";
|
|
||||||
logDir = "/var/log/caddy";
|
|
||||||
|
|
||||||
# Additional lines of configuration appended to the global config section of the Caddyfile.
|
|
||||||
# Refer to https://caddyserver.com/docs/caddyfile/options#global-options for details on supported values.
|
|
||||||
globalConfig = ''
|
|
||||||
http_port 80
|
|
||||||
https_port 443
|
|
||||||
auto_https off
|
|
||||||
'';
|
|
||||||
|
|
||||||
# ACME related settings.
|
|
||||||
# email = myvars.useremail;
|
|
||||||
# acmeCA = "https://acme-v02.api.letsencrypt.org/directory";
|
|
||||||
|
|
||||||
# Dashboard
|
|
||||||
virtualHosts."http://home.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:4401
|
|
||||||
'';
|
|
||||||
|
|
||||||
# https://caddyserver.com/docs/caddyfile/directives/file_server
|
|
||||||
virtualHosts."http://file.writefor.fun".extraConfig = ''
|
|
||||||
root * /var/lib/caddy/fileserver/
|
|
||||||
encode zstd gzip
|
|
||||||
file_server browse {
|
|
||||||
hide .git
|
|
||||||
precompressed zstd br gzip
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Datastore
|
|
||||||
virtualHosts."http://attic.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:3300
|
|
||||||
'';
|
|
||||||
|
|
||||||
virtualHosts."http://git.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:3301
|
|
||||||
'';
|
|
||||||
virtualHosts."http://sftpgo.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:3302
|
|
||||||
'';
|
|
||||||
virtualHosts."http://webdav.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:3303
|
|
||||||
'';
|
|
||||||
virtualHosts."http://transmission.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:9091
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Monitoring
|
|
||||||
virtualHosts."http://uptime-kuma.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:3350
|
|
||||||
'';
|
|
||||||
virtualHosts."http://grafana.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:3351
|
|
||||||
'';
|
|
||||||
virtualHosts."http://prometheus.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:9090
|
|
||||||
'';
|
|
||||||
virtualHosts."http://alertmanager.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:9093
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
networking.firewall.allowedTCPPorts = [80 443];
|
|
||||||
|
|
||||||
# Create Directories
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"d /var/lib/caddy/fileserver/ 0755 caddy caddy"
|
|
||||||
# directory for virtual machine's images
|
|
||||||
"d /var/lib/caddy/fileserver/vms 0755 caddy caddy"
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -34,5 +34,5 @@ in {
|
|||||||
# this value at the release version of the first install of this system.
|
# this value at the release version of the first install of this system.
|
||||||
# Before changing this value read the documentation for this option
|
# Before changing this value read the documentation for this option
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
system.stateVersion = "23.11"; # Did you read the comment?
|
system.stateVersion = "24.05"; # Did you read the comment?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,8 @@
|
|||||||
name = "encrypted";
|
name = "encrypted";
|
||||||
settings = {
|
settings = {
|
||||||
keyFile = "/dev/disk/by-label/OPI5P_DSC"; # The keyfile is stored on a USB stick
|
keyFile = "/dev/disk/by-label/OPI5P_DSC"; # The keyfile is stored on a USB stick
|
||||||
# The maximum size of the keyfile is 8192 bytes
|
# The maximum size of the keyfile is 8192 KiB
|
||||||
|
# type `cryptsetup --help` to see the compiled-in key and passphrase maximum sizes
|
||||||
keyFileSize = 512 * 64; # match the `bs * count` of the `dd` command
|
keyFileSize = 512 * 64; # match the `bs * count` of the `dd` command
|
||||||
keyFileOffset = 512 * 128; # match the `bs * skip` of the `dd` command
|
keyFileOffset = 512 * 128; # match the `bs * skip` of the `dd` command
|
||||||
fallbackToPassword = true;
|
fallbackToPassword = true;
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
# Homepage for my Homelab
|
|
||||||
|
|
||||||
> WIP, just a demo for now
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 MiB |
@@ -1,68 +0,0 @@
|
|||||||
---
|
|
||||||
# For configuration options and examples, please see:
|
|
||||||
# https://gethomepage.dev/latest/configs/services
|
|
||||||
|
|
||||||
- Proxmox VE 虚拟化集群:
|
|
||||||
- PVE-UM560:
|
|
||||||
icon: si-proxmox
|
|
||||||
href: https://192.168.5.173:8006/
|
|
||||||
description: "CPU: R5-5625U / MEM: 32G / DISK: 512G+4T*2"
|
|
||||||
siteMonitor: https://192.168.5.173:8006/
|
|
||||||
|
|
||||||
- PVE-S500Plus:
|
|
||||||
icon: si-proxmox
|
|
||||||
href: https://192.168.5.174:8006/
|
|
||||||
description: "CPU: R7-5825U / MEM: 64G / DISK: 1T"
|
|
||||||
siteMonitor: https://192.168.5.174:8006/
|
|
||||||
|
|
||||||
- PVE-GTR5:
|
|
||||||
icon: si-proxmox
|
|
||||||
href: https://192.168.5.172:8006/
|
|
||||||
description: "CPU: R9-5900HX / MEM: 64G / DISK: 1T"
|
|
||||||
siteMonitor: https://192.168.5.172:8006/
|
|
||||||
|
|
||||||
- Homelab Monitoring:
|
|
||||||
- Grafana:
|
|
||||||
icon: si-grafana
|
|
||||||
href: http://grafana.writefor.fun
|
|
||||||
description: Data visualised on dashboards
|
|
||||||
siteMonitor: http://grafana.writefor.fun
|
|
||||||
- Prometheus Dashboard:
|
|
||||||
icon: si-prometheus
|
|
||||||
href: http://prometheus.writefor.fun
|
|
||||||
description: Monitoring - Prometheus
|
|
||||||
siteMonitor: http://prometheus.writefor.fun
|
|
||||||
- Uptime Kuma:
|
|
||||||
icon: si-uptimekuma
|
|
||||||
href: http://uptime-kuma.writefor.fun
|
|
||||||
description: Uptime Checking
|
|
||||||
siteMonitor: http://uptime-kuma.writefor.fun
|
|
||||||
|
|
||||||
- Homelab Applications:
|
|
||||||
- SFTPGO:
|
|
||||||
icon: sftpgo.png
|
|
||||||
href: "http://sftpgo.writefor.fun/web/admin/folders"
|
|
||||||
description: WebDAV & SFTP server
|
|
||||||
siteMonitor: http://sftpgo.writefor.fun/
|
|
||||||
# - Kubernetes Monitoring:
|
|
||||||
# # TODO: Update this
|
|
||||||
# - Emby:
|
|
||||||
# icon: emby.png
|
|
||||||
# href: "http://emby.home/"
|
|
||||||
# description: Media server
|
|
||||||
# namespace: media # The kubernetes namespace the app resides in
|
|
||||||
# app: emby # The name of the deployed app
|
|
||||||
#
|
|
||||||
# - Element Chat:
|
|
||||||
# icon: matrix-light.png
|
|
||||||
# href: https://chat.example.com
|
|
||||||
# description: Matrix Synapse Powered Chat
|
|
||||||
# app: matrix-element
|
|
||||||
# namespace: comms
|
|
||||||
# pod-selector: >-
|
|
||||||
# app.kubernetes.io/instance in (
|
|
||||||
# matrix-element,
|
|
||||||
# matrix-media-repo,
|
|
||||||
# matrix-media-repo-postgresql,
|
|
||||||
# matrix-synapse
|
|
||||||
# )
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
{pkgs, ...}: let
|
|
||||||
configDir = "/var/lib/homepage-dashboard";
|
|
||||||
in {
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/services/misc/homepage-dashboard.nix
|
|
||||||
services.homepage-dashboard = {
|
|
||||||
enable = true;
|
|
||||||
listenPort = 4401;
|
|
||||||
openFirewall = false;
|
|
||||||
};
|
|
||||||
systemd.services.homepage-dashboard.environment = {
|
|
||||||
HOMEPAGE_CONFIG_DIR = configDir;
|
|
||||||
|
|
||||||
# 1. The value of env var HOMEPAGE_VAR_XXX will replace {{HOMEPAGE_VAR_XXX}} in any config
|
|
||||||
# HOMEPAGE_VAR_XXX_APIKEY = "myapikey";
|
|
||||||
# 2. The value of env var HOMEPAGE_FILE_XXX must be a file path,
|
|
||||||
# the contents of which will be used to replace {{HOMEPAGE_FILE_XXX}} in any config
|
|
||||||
};
|
|
||||||
# Install the homepage-dashboard configuration files
|
|
||||||
system.activationScripts.installHomepageDashboardConfig = ''
|
|
||||||
mkdir -p ${configDir}
|
|
||||||
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F600 ${./config}/ ${configDir}/
|
|
||||||
|
|
||||||
${pkgs.systemdMinimal}/bin/systemctl restart homepage-dashboard
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
# Replace dashy with gethomepage, because dashy is too slow to start/reload.
|
|
||||||
|
|
||||||
# # Install the dashy configuration file instead of symlink it
|
|
||||||
# system.activationScripts.installDashyConfig = ''
|
|
||||||
# install -Dm 600 ${./dashy_conf.yml} /etc/dashy/dashy_conf.yml
|
|
||||||
# '';
|
|
||||||
#
|
|
||||||
# # https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/virtualisation/oci-containers.nix
|
|
||||||
# virtualisation.oci-containers.containers = {
|
|
||||||
# # check its logs via `journalctl -u podman-dashy`
|
|
||||||
# dashy = {
|
|
||||||
# hostname = "dashy";
|
|
||||||
# image = "lissy93/dashy:latest";
|
|
||||||
# ports = ["127.0.0.1:4000:80"];
|
|
||||||
# environment = {
|
|
||||||
# "NODE_ENV" = "production";
|
|
||||||
# };
|
|
||||||
# volumes = [
|
|
||||||
# "/etc/dashy/dashy_conf.yml:/app/public/conf.yml"
|
|
||||||
# ];
|
|
||||||
# autoStart = true;
|
|
||||||
# # cmd = [];
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/monitoring/uptime-kuma.nix
|
|
||||||
services.uptime-kuma = {
|
|
||||||
enable = true;
|
|
||||||
# https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
|
|
||||||
settings = {
|
|
||||||
"UPTIME_KUMA_HOST" = "127.0.0.1";
|
|
||||||
"UPTIME_KUMA_PORT" = "3350";
|
|
||||||
"DATA_DIR" = "/var/lib/uptime-kuma/";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
+1
-1
@@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixos-23.11",
|
"ref": "nixos-24.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
# a flake for testing
|
# a flake for testing
|
||||||
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
|
||||||
outputs = {nixpkgs, ...}: let
|
outputs = {nixpkgs, ...}: let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
pkgs = import nixpkgs {inherit system;};
|
pkgs = import nixpkgs {inherit system;};
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user