mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-05-28 18:39:31 +02:00
Compare commits
101 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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 |
@@ -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", "https://afdian.net/a/ryan4yin"]
|
||||||
|
|||||||
@@ -9,4 +9,5 @@ binary = false
|
|||||||
extend-ignore-re = [
|
extend-ignore-re = [
|
||||||
"iterm2",
|
"iterm2",
|
||||||
"iHgEIBYKACAWIQSizQe9ljFEyyclWmtVhZllwnQrSwUCZZ1T9wIdAAAKCRBVhZll", # crypto keys
|
"iHgEIBYKACAWIQSizQe9ljFEyyclWmtVhZllwnQrSwUCZZ1T9wIdAAAKCRBVhZll", # crypto keys
|
||||||
|
"noice", # noice.nvim
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -5,27 +5,17 @@ set shell := ["nu", "-c"]
|
|||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Nix commands related to the local machine
|
# Common commands(suitable for all machines)
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
i3 mode="default":
|
# Remote deployment via colmena
|
||||||
|
col tag:
|
||||||
|
colmena apply --on '@{{tag}}' --verbose --show-trace
|
||||||
|
|
||||||
|
local name mode="default":
|
||||||
use utils.nu *; \
|
use utils.nu *; \
|
||||||
nixos-switch ai-i3 {{mode}}
|
nixos-switch {{name}} {{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
|
||||||
test:
|
test:
|
||||||
@@ -38,7 +28,7 @@ up:
|
|||||||
# Update specific input
|
# Update specific input
|
||||||
# Usage: just upp nixpkgs
|
# Usage: just upp nixpkgs
|
||||||
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
|
||||||
history:
|
history:
|
||||||
@@ -63,47 +53,75 @@ gitgc:
|
|||||||
git reflog expire --expire-unreachable=now --all
|
git reflog expire --expire-unreachable=now --all
|
||||||
git gc --prune=now
|
git gc --prune=now
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# NixOS Desktop related commands
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
i3 mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch ai-i3 {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
hypr mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch ai-hyprland {{mode}}
|
||||||
|
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
s-i3 mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch shoukei-i3 {{mode}}
|
||||||
|
|
||||||
|
[linux]
|
||||||
|
s-hypr mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch shoukei-hyprland {{mode}}
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Darwin related commands, harmonica is my macbook pro's hostname
|
# Darwin related commands, harmonica is my macbook pro's hostname
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
[macos]
|
||||||
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]
|
||||||
darwin-rollback:
|
darwin-rollback:
|
||||||
use utils.nu *; \
|
use utils.nu *; \
|
||||||
darwin-rollback
|
darwin-rollback
|
||||||
|
|
||||||
# Deploy to harmonica(macOS host)
|
# Deploy to harmonica(macOS host)
|
||||||
|
[macos]
|
||||||
ha mode="default":
|
ha mode="default":
|
||||||
use utils.nu *; \
|
use utils.nu *; \
|
||||||
darwin-build "harmonica" {{mode}}; \
|
darwin-build "harmonica" {{mode}}; \
|
||||||
darwin-switch "harmonica" {{mode}}
|
darwin-switch "harmonica" {{mode}}
|
||||||
|
|
||||||
# Depoly to fern(macOS host)
|
# Depoly to fern(macOS host)
|
||||||
|
[macos]
|
||||||
fe mode="default": darwin-set-proxy
|
fe mode="default": darwin-set-proxy
|
||||||
use utils.nu *; \
|
use utils.nu *; \
|
||||||
darwin-build "fern" {{mode}}; \
|
darwin-build "fern" {{mode}}; \
|
||||||
darwin-switch "fern" {{mode}}
|
darwin-switch "fern" {{mode}}
|
||||||
|
|
||||||
# Reload yabai and skhd(macOS)
|
# Reload yabai and skhd(macOS)
|
||||||
|
[macos]
|
||||||
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
|
|
||||||
col tag:
|
|
||||||
colmena apply --on '@{{tag}}' --verbose --show-trace
|
|
||||||
|
|
||||||
# Build and upload a vm image
|
# Build and upload a vm image
|
||||||
upload-vm name mode="default":
|
upload-vm name mode="default":
|
||||||
use utils.nu *; \
|
use utils.nu *; \
|
||||||
@@ -113,14 +131,46 @@ upload-vm name mode="default":
|
|||||||
lab:
|
lab:
|
||||||
colmena apply --on '@virt-*' --verbose --show-trace
|
colmena apply --on '@virt-*' --verbose --show-trace
|
||||||
|
|
||||||
# Deploy all the VMs running on KubeVirt
|
shoryu:
|
||||||
vm:
|
colmena apply --on '@kubevirt-shoryu' --verbose --show-trace
|
||||||
colmena apply --on '@homelab-*' --verbose --show-trace
|
|
||||||
|
shoryu-local mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch kubevirt-shoryu {{mode}}
|
||||||
|
|
||||||
|
shushou:
|
||||||
|
colmena apply --on '@kubevirt-shushou' --verbose --show-trace
|
||||||
|
|
||||||
|
shushou-local mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch kubevirt-shushou {{mode}}
|
||||||
|
|
||||||
|
youko:
|
||||||
|
colmena apply --on '@kubevirt-youko' --verbose --show-trace
|
||||||
|
|
||||||
|
youko-local mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch kubevirt-youko {{mode}}
|
||||||
|
|
||||||
|
############################################################################
|
||||||
|
#
|
||||||
|
# Commands for other Virtual Machines
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
# Build and upload a vm image
|
||||||
|
upload-idols mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
upload-vm aquamarine {{mode}}
|
||||||
|
upload-vm ruby {{mode}}
|
||||||
|
upload-vm kana {{mode}}
|
||||||
|
|
||||||
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"
|
aqua-local mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch aquamarine {{mode}}
|
||||||
|
|
||||||
ruby:
|
ruby:
|
||||||
colmena apply --on '@ruby' --verbose --show-trace
|
colmena apply --on '@ruby' --verbose --show-trace
|
||||||
@@ -132,12 +182,32 @@ ruby-local mode="default":
|
|||||||
kana:
|
kana:
|
||||||
colmena apply --on '@kana' --verbose --show-trace
|
colmena apply --on '@kana' --verbose --show-trace
|
||||||
|
|
||||||
|
kana-local mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch kana {{mode}}
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Kubernetes related commands
|
# Kubernetes related commands
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
# Build and upload a vm image
|
||||||
|
upload-k3s mode="default":
|
||||||
|
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}};
|
||||||
|
|
||||||
|
upload-k3s-test mode="default":
|
||||||
|
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}};
|
||||||
|
|
||||||
k3s:
|
k3s:
|
||||||
colmena apply --on '@k3s-*' --verbose --show-trace
|
colmena apply --on '@k3s-*' --verbose --show-trace
|
||||||
|
|
||||||
@@ -171,16 +241,6 @@ yukina:
|
|||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
aarch:
|
|
||||||
colmena apply --on '@aarch' --build-on-target --verbose --show-trace
|
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@@ -188,6 +248,18 @@ rakushun-local mode="default":
|
|||||||
use utils.nu *; \
|
use utils.nu *; \
|
||||||
nixos-switch rakushun {{mode}}
|
nixos-switch rakushun {{mode}}
|
||||||
|
|
||||||
|
suzu-set-proxy:
|
||||||
|
ip route del default via 192.168.5.1
|
||||||
|
ip route add default via 192.168.5.178
|
||||||
|
|
||||||
|
suzu-unset-proxy:
|
||||||
|
ip route del default via 192.168.5.178
|
||||||
|
ip route add default via 192.168.5.1
|
||||||
|
|
||||||
|
suzu-local mode="default":
|
||||||
|
use utils.nu *; \
|
||||||
|
nixos-switch suzu {{mode}}
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Misc, other useful commands
|
# Misc, other useful commands
|
||||||
@@ -202,11 +274,11 @@ path:
|
|||||||
$env.PATH | split row ":"
|
$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/"
|
||||||
|
|
||||||
nvim-clean:
|
nvim-clean:
|
||||||
rm -rf $"($env.HOME)/.config/astronvim/lua/user"
|
rm -rf $"($env.HOME)/.config/nvim"
|
||||||
|
|
||||||
# =================================================
|
# =================================================
|
||||||
# Emacs related commands
|
# Emacs related commands
|
||||||
@@ -228,7 +300,7 @@ reload-emacs-cmd := if os() == "macos" {
|
|||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
@@ -8,24 +8,26 @@
|
|||||||
<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.
|
||||||
|
|
||||||
@@ -89,11 +91,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 +106,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 +129,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:
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ 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
+333
-456
File diff suppressed because it is too large
Load Diff
@@ -36,12 +36,12 @@
|
|||||||
# which represents the GitHub repository URL + branch/commit-id/tag.
|
# which represents the GitHub repository URL + branch/commit-id/tag.
|
||||||
|
|
||||||
# Official NixOS package source, using nixos's 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-24.05";
|
||||||
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 +50,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/release-24.05";
|
||||||
url = "github:nix-community/home-manager/master";
|
# url = "github:nix-community/home-manager/master";
|
||||||
|
|
||||||
# The `follows` keyword in inputs is used for inheritance.
|
# The `follows` keyword in inputs is used for inheritance.
|
||||||
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
|
# Here, `inputs.nixpkgs` of home-manager is kept consistent with the `inputs.nixpkgs` of the current flake,
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
impermanence.url = "github:nix-community/impermanence";
|
impermanence.url = "github:nix-community/impermanence";
|
||||||
|
|
||||||
hyprland = {
|
hyprland = {
|
||||||
url = "github:hyprwm/Hyprland/v0.33.1";
|
url = "github:hyprwm/Hyprland/v0.39.1";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -96,7 +96,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 +111,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 +123,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";
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
attic,
|
|
||||||
nur-ryan4yin,
|
nur-ryan4yin,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,7 @@
|
|||||||
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;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
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,7 @@
|
|||||||
{
|
{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
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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,205 @@
|
|||||||
|
-- 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
|
||||||
|
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
|
||||||
|
},
|
||||||
|
-- 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,63 @@
|
|||||||
|
-- Customize Mason plugins
|
||||||
|
|
||||||
|
---@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,60 @@
|
|||||||
|
-- Customize Treesitter
|
||||||
|
|
||||||
|
---@type LazySpec
|
||||||
|
return {
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
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" }
|
||||||
|
|
||||||
|
-- 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, {
|
||||||
|
-- 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,
|
||||||
|
}
|
||||||
@@ -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"
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
gcc
|
gcc
|
||||||
# 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
|
||||||
@@ -25,22 +26,25 @@
|
|||||||
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
|
||||||
]
|
]
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -51,7 +55,7 @@
|
|||||||
|
|
||||||
#-- nix
|
#-- nix
|
||||||
nil
|
nil
|
||||||
rnix-lsp
|
# rnix-lsp
|
||||||
# nixd
|
# nixd
|
||||||
statix # Lints and suggestions for the nix programming language
|
statix # Lints and suggestions for the nix programming language
|
||||||
deadnix # Find and remove unused code in .nix source files
|
deadnix # Find and remove unused code in .nix source files
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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"];
|
||||||
|
|||||||
@@ -14,10 +14,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
|
||||||
|
|||||||
@@ -4,12 +4,15 @@
|
|||||||
hyprland,
|
hyprland,
|
||||||
nur-ryan4yin,
|
nur-ryan4yin,
|
||||||
...
|
...
|
||||||
}: {
|
}: let
|
||||||
|
package = hyprland.packages.${pkgs.system}.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,7 +28,6 @@
|
|||||||
"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;
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
# 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
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ Services:
|
|||||||
1. prometheus + alertmanager + grafana + loki: Monitor the metrics/logs of my homelab.
|
1. prometheus + alertmanager + grafana + loki: Monitor the metrics/logs of my homelab.
|
||||||
1. restic: Backup my personal data to cloud or NAS.
|
1. restic: Backup my personal data to cloud or NAS.
|
||||||
1. synthing: Sync file between android/macbook/PC and NAS.
|
1. synthing: Sync file between android/macbook/PC and NAS.
|
||||||
1. attic: Nix cache server.
|
|
||||||
1. gitea: Self-hosted git service.
|
1. gitea: Self-hosted git service.
|
||||||
1. sftpgo: SFTP server.
|
1. sftpgo: SFTP server.
|
||||||
1. transmission & AriaNg: Torrent downloader and HTTP downloader
|
1. transmission & AriaNg: Torrent downloader and HTTP downloader
|
||||||
@@ -32,3 +31,10 @@ the services.
|
|||||||
|
|
||||||
TODO: create a private PKI for caddy, to achieve end-to-end encryption between caddy and the
|
TODO: create a private PKI for caddy, to achieve end-to-end encryption between caddy and the
|
||||||
services.
|
services.
|
||||||
|
|
||||||
|
## Misc
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# copy closure to another arm64 machine
|
||||||
|
nix-copy-closure --to root@suzu /run/current-system
|
||||||
|
```
|
||||||
|
|||||||
@@ -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,4 +1,17 @@
|
|||||||
{myvars, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
wallpapers,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
hostCommonConfig = ''
|
||||||
|
encode zstd gzip
|
||||||
|
tls ${../../certs/ecc-server.crt} ${config.age.secrets."certs/ecc-server.key".path} {
|
||||||
|
protocols tls1.3 tls1.3
|
||||||
|
curves x25519 secp384r1 secp521r1
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
in {
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# Reload Caddy instead of restarting it when configuration file changes.
|
# Reload Caddy instead of restarting it when configuration file changes.
|
||||||
@@ -12,66 +25,56 @@
|
|||||||
globalConfig = ''
|
globalConfig = ''
|
||||||
http_port 80
|
http_port 80
|
||||||
https_port 443
|
https_port 443
|
||||||
auto_https off
|
auto_https disable_certs
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# ACME related settings.
|
|
||||||
# email = myvars.useremail;
|
|
||||||
# acmeCA = "https://acme-v02.api.letsencrypt.org/directory";
|
|
||||||
|
|
||||||
# Dashboard
|
# Dashboard
|
||||||
virtualHosts."http://home.writefor.fun".extraConfig = ''
|
virtualHosts."home.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
${hostCommonConfig}
|
||||||
reverse_proxy http://localhost:4401
|
reverse_proxy http://localhost:4401
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# https://caddyserver.com/docs/caddyfile/directives/file_server
|
# https://caddyserver.com/docs/caddyfile/directives/file_server
|
||||||
virtualHosts."http://file.writefor.fun".extraConfig = ''
|
virtualHosts."file.writefor.fun".extraConfig = ''
|
||||||
root * /var/lib/caddy/fileserver/
|
root * /var/lib/caddy/fileserver/
|
||||||
encode zstd gzip
|
${hostCommonConfig}
|
||||||
file_server browse {
|
file_server browse {
|
||||||
hide .git
|
hide .git
|
||||||
precompressed zstd br gzip
|
precompressed zstd br gzip
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Datastore
|
virtualHosts."git.writefor.fun".extraConfig = ''
|
||||||
virtualHosts."http://attic.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
|
||||||
reverse_proxy http://localhost:3300
|
|
||||||
'';
|
|
||||||
|
|
||||||
virtualHosts."http://git.writefor.fun".extraConfig = ''
|
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
reverse_proxy http://localhost:3301
|
reverse_proxy http://localhost:3301
|
||||||
'';
|
'';
|
||||||
virtualHosts."http://sftpgo.writefor.fun".extraConfig = ''
|
virtualHosts."sftpgo.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
reverse_proxy http://localhost:3302
|
reverse_proxy http://localhost:3302
|
||||||
'';
|
'';
|
||||||
virtualHosts."http://webdav.writefor.fun".extraConfig = ''
|
virtualHosts."webdav.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
reverse_proxy http://localhost:3303
|
reverse_proxy http://localhost:3303
|
||||||
'';
|
'';
|
||||||
virtualHosts."http://transmission.writefor.fun".extraConfig = ''
|
virtualHosts."transmission.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
reverse_proxy http://localhost:9091
|
reverse_proxy http://localhost:9091
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Monitoring
|
# Monitoring
|
||||||
virtualHosts."http://uptime-kuma.writefor.fun".extraConfig = ''
|
virtualHosts."uptime-kuma.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
reverse_proxy http://localhost:3350
|
reverse_proxy http://localhost:3350
|
||||||
'';
|
'';
|
||||||
virtualHosts."http://grafana.writefor.fun".extraConfig = ''
|
virtualHosts."grafana.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
reverse_proxy http://localhost:3351
|
reverse_proxy http://localhost:3351
|
||||||
'';
|
'';
|
||||||
virtualHosts."http://prometheus.writefor.fun".extraConfig = ''
|
virtualHosts."prometheus.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
reverse_proxy http://localhost:9090
|
reverse_proxy http://localhost:9090
|
||||||
'';
|
'';
|
||||||
virtualHosts."http://alertmanager.writefor.fun".extraConfig = ''
|
virtualHosts."alertmanager.writefor.fun".extraConfig = ''
|
||||||
encode zstd gzip
|
encode zstd gzip
|
||||||
reverse_proxy http://localhost:9093
|
reverse_proxy http://localhost:9093
|
||||||
'';
|
'';
|
||||||
@@ -84,4 +87,11 @@
|
|||||||
# directory for virtual machine's images
|
# directory for virtual machine's images
|
||||||
"d /var/lib/caddy/fileserver/vms 0755 caddy caddy"
|
"d /var/lib/caddy/fileserver/vms 0755 caddy caddy"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Add all my wallpapers into /var/lib/caddy/fileserver/wallpapers
|
||||||
|
# Install the homepage-dashboard configuration files
|
||||||
|
system.activationScripts.installCaddyWallpapers = ''
|
||||||
|
mkdir -p /var/lib/caddy/fileserver/wallpapers
|
||||||
|
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F644 ${wallpapers}/ /var/lib/caddy/fileserver/wallpapers/
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,6 +1,6 @@
|
|||||||
{pkgs, ...}: let
|
{pkgs, ...}: let
|
||||||
in {
|
in {
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/misc/gitea.nix
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/misc/gitea.nix
|
||||||
services.gitea = {
|
services.gitea = {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = "gitea";
|
user = "gitea";
|
||||||
|
|||||||
@@ -1,3 +1 @@
|
|||||||
# Homepage for my Homelab
|
# Homepage for my Homelab
|
||||||
|
|
||||||
> WIP, just a demo for now
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.5 MiB |
@@ -2,24 +2,31 @@
|
|||||||
# For configuration options and examples, please see:
|
# For configuration options and examples, please see:
|
||||||
# https://gethomepage.dev/latest/configs/services
|
# https://gethomepage.dev/latest/configs/services
|
||||||
|
|
||||||
- Proxmox VE 虚拟化集群:
|
- KubeVirt 虚拟化集群:
|
||||||
- PVE-UM560:
|
- KubeVirt-Shoryu:
|
||||||
icon: si-proxmox
|
icon: si-kubevirt
|
||||||
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"
|
description: "CPU: R7-5825U / MEM: 64G / DISK: 1T"
|
||||||
siteMonitor: https://192.168.5.174:8006/
|
href: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.181:9100
|
||||||
|
siteMonitor: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.181:9100
|
||||||
- PVE-GTR5:
|
- KubeVirt-Shushou:
|
||||||
icon: si-proxmox
|
icon: si-kubevirt
|
||||||
href: https://192.168.5.172:8006/
|
|
||||||
description: "CPU: R9-5900HX / MEM: 64G / DISK: 1T"
|
description: "CPU: R9-5900HX / MEM: 64G / DISK: 1T"
|
||||||
siteMonitor: https://192.168.5.172:8006/
|
href: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.182:9100
|
||||||
|
siteMonitor: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.182:9100
|
||||||
|
- KubeVirt-Youko:
|
||||||
|
icon: si-kubevirt
|
||||||
|
description: "CPU: R5-5625U / MEM: 32G / DISK: 512G+4T*2"
|
||||||
|
href: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.183:9100
|
||||||
|
siteMonitor: http://grafana.writefor.fun/d/rYdddlPWk/node-exporter-full?orgId=1&var-node=192.168.5.183:9100
|
||||||
|
- LongHorn-Storage:
|
||||||
|
icon: si-longhorn
|
||||||
|
href: http://longhorn.writefor.fun/
|
||||||
|
- Victoria-Metrics:
|
||||||
|
icon: si-victoriametrics
|
||||||
|
href: http://vm.writefor.fun/
|
||||||
|
- KubeVirt-Grafana:
|
||||||
|
icon: si-grafana
|
||||||
|
href: http://k8s-grafana.writefor.fun/
|
||||||
|
|
||||||
- Homelab Monitoring:
|
- Homelab Monitoring:
|
||||||
- Grafana:
|
- Grafana:
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
# https://gethomepage.dev/latest/configs/settings
|
# https://gethomepage.dev/latest/configs/settings
|
||||||
|
|
||||||
title: Ryan Yin's Homelab
|
title: Ryan Yin's Homelab
|
||||||
base: http://home.writefor.fun/
|
base: https://home.writefor.fun/
|
||||||
favicon: https://thiscute.world/favicon.ico
|
favicon: https://thiscute.world/favicon.ico
|
||||||
|
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/Manifest/start_url
|
# https://developer.mozilla.org/en-US/docs/Web/Manifest/start_url
|
||||||
# Used by some browsers to determine the start page of the web application
|
# Used by some browsers to determine the start page of the web application
|
||||||
startUrl: http://home.writefor.fun/
|
startUrl: https://home.writefor.fun/
|
||||||
|
|
||||||
language: zh
|
language: zh
|
||||||
|
|
||||||
@@ -20,11 +20,11 @@ providers:
|
|||||||
weatherapi: { { HOMEPAGE_VAR_WEATHERAPI_APIKEY } }
|
weatherapi: { { HOMEPAGE_VAR_WEATHERAPI_APIKEY } }
|
||||||
|
|
||||||
background:
|
background:
|
||||||
image: /images/rolling-girls.png
|
image: https://file.writefor.fun/wallpapers/rolling-girls.png
|
||||||
blur: sm # sm, "", md, xl... see https://tailwindcss.com/docs/backdrop-blur
|
blur: sm # sm, "", md, xl... see https://tailwindcss.com/docs/backdrop-blur
|
||||||
saturate: 50 # 0, 50, 100... see https://tailwindcss.com/docs/backdrop-saturate
|
saturate: 90 # 0, 50, 100... see https://tailwindcss.com/docs/backdrop-saturate
|
||||||
brightness: 50 # 0, 50, 75... see https://tailwindcss.com/docs/backdrop-brightness
|
brightness: 90 # 0, 50, 75... see https://tailwindcss.com/docs/backdrop-brightness
|
||||||
opacity: 50 # 0-100
|
opacity: 85 # 0-100
|
||||||
|
|
||||||
theme: dark # or light
|
theme: dark # or light
|
||||||
|
|
||||||
@@ -40,8 +40,8 @@ useEqualHeights: true
|
|||||||
# Groups and its layout
|
# Groups and its layout
|
||||||
# Groups Name should match the name defined in your services.yaml or widgets.yaml
|
# Groups Name should match the name defined in your services.yaml or widgets.yaml
|
||||||
layout:
|
layout:
|
||||||
Proxmox VE 虚拟化集群:
|
KubeVirt 虚拟化集群:
|
||||||
icon: si-proxmox
|
icon: si-kubevirt
|
||||||
tab: First
|
tab: First
|
||||||
|
|
||||||
Group A:
|
Group A:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
# install -Dm 600 ${./dashy_conf.yml} /etc/dashy/dashy_conf.yml
|
# 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
|
# # https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/virtualisation/oci-containers.nix
|
||||||
# virtualisation.oci-containers.containers = {
|
# virtualisation.oci-containers.containers = {
|
||||||
# # check its logs via `journalctl -u podman-dashy`
|
# # check its logs via `journalctl -u podman-dashy`
|
||||||
# dashy = {
|
# dashy = {
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/monitoring/prometheus/exporters/v2ray.nix
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/prometheus/exporters/v2ray.nix
|
||||||
# https://github.com/wi1dcard/v2ray-exporter
|
# https://github.com/wi1dcard/v2ray-exporter
|
||||||
services.prometheus.exporters.v2ray = {
|
services.prometheus.exporters.v2ray = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
sshKeyPath = "/etc/agenix/ssh-key-for-restic-backup";
|
sshKeyPath = "/etc/agenix/ssh-key-for-restic-backup";
|
||||||
rcloneConfigFile = "/etc/agenix/rclone-conf-for-restic-backup";
|
rcloneConfigFile = "/etc/agenix/rclone-conf-for-restic-backup";
|
||||||
in {
|
in {
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/backup/restic.nix
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/backup/restic.nix
|
||||||
services.restic.backups = {
|
services.restic.backups = {
|
||||||
homelab-backup = {
|
homelab-backup = {
|
||||||
inherit passwordFile;
|
inherit passwordFile;
|
||||||
initialize = true; # Initialize the repository if it doesn't exist.
|
initialize = true; # Initialize the repository if it doesn't exist.
|
||||||
repository = "rclone:smb-downloads:/Downloads/proxmox-backup/"; # backup to a rclone remote
|
repository = "rclone:smb-downloads:/Downloads/kubevirt-backup/"; # backup to a rclone remote
|
||||||
|
|
||||||
# rclone related
|
# rclone related
|
||||||
# rcloneOptions = {
|
# rcloneOptions = {
|
||||||
@@ -34,20 +34,16 @@ in {
|
|||||||
# A script that must run before starting the backup process.
|
# A script that must run before starting the backup process.
|
||||||
backupPrepareCommand = ''
|
backupPrepareCommand = ''
|
||||||
${pkgs.nushell}/bin/nu -c '
|
${pkgs.nushell}/bin/nu -c '
|
||||||
let pve_nodes = [
|
let kubevirt_nodes = [
|
||||||
# proxmox cluster's nodes
|
"kubevirt-shoryu"
|
||||||
"um560"
|
"kubevirt-shushou"
|
||||||
"gtr5"
|
"kubevirt-youko"
|
||||||
"s500plus"
|
|
||||||
|
|
||||||
# others
|
|
||||||
"kana"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
pve_nodes | each {|it|
|
kubevirt_nodes | each {|it|
|
||||||
rsync -avz \
|
rsync -avz \
|
||||||
-e "ssh -i ${sshKeyPath}" \
|
-e "ssh -i ${sshKeyPath}" \
|
||||||
$"($it):/var/lib/vz" $"/tmp/restic-backup-temp/($it)"
|
$"($it):/perissitent/" $"/tmp/restic-backup-temp/($it)"
|
||||||
}
|
}
|
||||||
'
|
'
|
||||||
'';
|
'';
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
name = "transmission";
|
name = "transmission";
|
||||||
in {
|
in {
|
||||||
# the headless Transmission BitTorrent daemon
|
# the headless Transmission BitTorrent daemon
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/torrent/transmission.nix
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/torrent/transmission.nix
|
||||||
# https://wiki.archlinux.org/title/transmission
|
# https://wiki.archlinux.org/title/transmission
|
||||||
services.transmission = {
|
services.transmission = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -81,7 +81,7 @@ in {
|
|||||||
lpd-enabled = true;
|
lpd-enabled = true;
|
||||||
# The peer port to listen for incoming connections.
|
# The peer port to listen for incoming connections.
|
||||||
peer-port = 51413;
|
peer-port = 51413;
|
||||||
# Enable UPnP or NAT-PMP to forward a port through your firewall(NAT).
|
# Enable UOnP or NAT-PMP to forward a port through your firewall(NAT).
|
||||||
# https://github.com/transmission/transmission/blob/main/docs/Port-Forwarding-Guide.md
|
# https://github.com/transmission/transmission/blob/main/docs/Port-Forwarding-Guide.md
|
||||||
port-forwarding-enabled = true;
|
port-forwarding-enabled = true;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/monitoring/uptime-kuma.nix
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/monitoring/uptime-kuma.nix
|
||||||
services.uptime-kuma = {
|
services.uptime-kuma = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
|
# https://github.com/louislam/uptime-kuma/wiki/Environment-Variables
|
||||||
|
|||||||
+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;};
|
||||||
|
|||||||
@@ -38,5 +38,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?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,14 +37,14 @@
|
|||||||
"ntfs"
|
"ntfs"
|
||||||
"fat"
|
"fat"
|
||||||
"vfat"
|
"vfat"
|
||||||
"cifs" # mount windows share
|
"exfat"
|
||||||
];
|
];
|
||||||
|
|
||||||
# clear /tmp on boot to get a stateless /tmp directory.
|
# clear /tmp on boot to get a stateless /tmp directory.
|
||||||
boot.tmp.cleanOnBoot = true;
|
boot.tmp.cleanOnBoot = true;
|
||||||
boot.initrd = {
|
boot.initrd = {
|
||||||
# unlocked luks devices via a keyfile or prompt a passphrase.
|
# unlocked luks devices via a keyfile or prompt a passphrase.
|
||||||
luks.devices."crypted-nixos" = {
|
luks.devices."encrypted-nixos" = {
|
||||||
device = "/dev/nvme0n1p4";
|
device = "/dev/nvme0n1p4";
|
||||||
# the keyfile(or device partition) that should be used as the decryption key for the encrypted device.
|
# the keyfile(or device partition) that should be used as the decryption key for the encrypted device.
|
||||||
# if not specified, you will be prompted for a passphrase instead.
|
# if not specified, you will be prompted for a passphrase instead.
|
||||||
|
|||||||
@@ -137,6 +137,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 .#suzu --no-root-password --show-trace --verbose
|
sudo nixos-install --root /mnt --flake .#suzu --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,6 +2,12 @@
|
|||||||
|
|
||||||
LUKS encrypted SSD for NixOS, on Orange Pi 5.
|
LUKS encrypted SSD for NixOS, on Orange Pi 5.
|
||||||
|
|
||||||
|
## TODOs
|
||||||
|
|
||||||
|
- [ ] Add support for BGP routing.
|
||||||
|
- [Comparing Open Source BGP Stacks](https://elegantnetwork.github.io/posts/comparing-open-source-bgp-stacks/)
|
||||||
|
- [`services.frr.*` - search.nixos.org](https://search.nixos.org/options?channel=unstable&query=services.frr)
|
||||||
|
|
||||||
## Showcases
|
## Showcases
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -30,5 +30,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/OPI5_DSC"; # The keyfile is stored on a USB stick
|
keyFile = "/dev/disk/by-label/OPI5_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;
|
||||||
|
|||||||
@@ -63,5 +63,5 @@
|
|||||||
socket = "control.socket";
|
socket = "control.socket";
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "23.11";
|
system.stateVersion = "24.05";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
# which is already persistent across reboots(via impermanence.nix)
|
# which is already persistent across reboots(via impermanence.nix)
|
||||||
#
|
#
|
||||||
# References:
|
# References:
|
||||||
# https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/services/networking/tailscale.nix
|
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/networking/tailscale.nix
|
||||||
#
|
#
|
||||||
# =============================================================
|
# =============================================================
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -66,5 +66,5 @@
|
|||||||
socket = "control.socket";
|
socket = "control.socket";
|
||||||
};
|
};
|
||||||
|
|
||||||
system.stateVersion = "23.11";
|
system.stateVersion = "24.05";
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user