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

|

|
||||||

|

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

|

|
||||||
|

|
||||||
|
|
||||||
|
## Visual Modes
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ------------------------ | ---------------------------------------- |
|
||||||
|
| Toggle visual mode | `v` |
|
||||||
|
| Toggle visual block mode | `<Ctrl> + v` (select a block vertically) |
|
||||||
|
|
||||||
|
## Incremental Selection
|
||||||
|
|
||||||
|
Provided by nvim-treesitter.
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ----------------- | -------------- |
|
||||||
|
| init selection | `<Ctrl-space>` |
|
||||||
|
| node incremental | `<Ctrl-space>` |
|
||||||
|
| scope incremental | `<Alt-Space>` |
|
||||||
|
| node decremental | `Backspace` |
|
||||||
|
|
||||||
|
## Search and Jump
|
||||||
|
|
||||||
|
Provided by [flash.nvim](https://github.com/folke/flash.nvim), it's a intelligent search and jump plugin.
|
||||||
|
|
||||||
|
1. It enhaces the default search and jump behavior of neovim.(search with prefix `/`)
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ----------------- | ------------------------------------------------------------------------------------------------------------- |
|
||||||
|
| Search | `/`(normal search), `s`(disable all code highlight, only highlight matches) |
|
||||||
|
| Treesitter Search | `yR`,`dR`, `cR`, `vR`, `ctrl+v+R`(arround your matches, all the surrounding Treesitter nodes will be labeled) |
|
||||||
|
| Remote Flash | `yr`, `dr`, `cr`, (arround your matches, all the surrounding Treesitter nodes will be labeled) |
|
||||||
|
|
||||||
|
## Text Manipulation
|
||||||
|
|
||||||
|
- Add at the end of multiple lines: `:normal A<text>`
|
||||||
|
|
||||||
|
- Execublock: `:A<text>`
|
||||||
|
|
||||||
|
- visual block mode(ctrl + v)
|
||||||
|
- Append text at the end of each line in the selected block
|
||||||
|
- If position exceeds line end, neovim adds spaces automatically
|
||||||
|
|
||||||
|
- Delete the last char of multivle lines: `:normal $x`
|
||||||
|
|
||||||
|
- Execute `$x` on each line
|
||||||
|
- visual mode(v)
|
||||||
|
- `$` moves cursor to the end of line
|
||||||
|
- `x` deletes the character under the cursor
|
||||||
|
|
||||||
|
- Delete the last word of multiple lines: `:normal $bD`
|
||||||
|
- Execute `$bD` on each line
|
||||||
|
- visual mode(v)
|
||||||
|
- `$` moves cursor to the end of line
|
||||||
|
- `b` moves cursor to the beginning of the last word
|
||||||
|
- `D` deletes from cursor to the end of line
|
||||||
|
|
||||||
|
## Commands & Shortcuts
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ----------------------------- | -------------- |
|
||||||
|
| Learn Neovim's Basics | `:Tutor` |
|
||||||
|
| Open file explorer | `<Space> + e` |
|
||||||
|
| Focus Neotree to current file | `<Space> + o` |
|
||||||
|
| Floating Terminal | `<Space> + tf` |
|
||||||
|
| Horizontal Split Terminal | `<Space> + th` |
|
||||||
|
| Vertical Split Terminal | `<Space> + tv` |
|
||||||
|
| Open IPython REPL | `<Space> + tp` |
|
||||||
|
| Toggle line wrap | `<Space> + uw` |
|
||||||
|
| Show line diagnostics | `gl` |
|
||||||
|
| Show function/variable info | `K` |
|
||||||
|
| Go to definition | `gd` |
|
||||||
|
| References of a symbol | `gr` |
|
||||||
|
|
||||||
|
## Window Navigation
|
||||||
|
|
||||||
|
- Switch between windows: `<Ctrl> + h/j/k/l`
|
||||||
|
- Resize windows: `<Ctrl> + Up/Down/Left/Right`
|
||||||
|
- Note: On macOS, conflicts with system shortcuts
|
||||||
|
- Disable in System Preferences -> Keyboard -> Shortcuts -> Mission Control
|
||||||
|
|
||||||
|
## Splitting and Buffers
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| --------------------- | ------------- |
|
||||||
|
| Horizontal Split | `\` |
|
||||||
|
| Vertical Split | `\|` |
|
||||||
|
| Next Buffer (Tab) | `]b` |
|
||||||
|
| Previous Buffer (Tab) | `[b` |
|
||||||
|
| Close Buffer | `<Space> + c` |
|
||||||
|
|
||||||
|
## Editing and Formatting
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ----------------------------------------------------- | -------------- |
|
||||||
|
| Toggle buffer auto formatting | `<Space> + uf` |
|
||||||
|
| Format Document | `<Space> + lf` |
|
||||||
|
| Code Actions | `<Space> + la` |
|
||||||
|
| Rename | `<Space> + lr` |
|
||||||
|
| Opening LSP symbols | `<Space> + lS` |
|
||||||
|
| Comment Line(support multiple lines) | `<Space> + /` |
|
||||||
|
| Open filepath/URL at cursor(neovim's builtin command) | `gx` |
|
||||||
|
| Find files by name (fzf) | `<Space> + ff` |
|
||||||
|
| Grep string in files (ripgrep) | `<Space> + fw` |
|
||||||
|
|
||||||
|
## Sessions
|
||||||
|
|
||||||
|
| Action | Shortcut |
|
||||||
|
| ------------------------------ | -------------- |
|
||||||
|
| Save Session | `<Space> + Ss` |
|
||||||
|
| Last Session | `<Space> + Sl` |
|
||||||
|
| Delete Session | `<Space> + Sd` |
|
||||||
|
| Search Session | `<Space> + Sf` |
|
||||||
|
| Load Current Directory Session | `<Space> + S.` |
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
Press `<Space> + D` to view available bindings and options.
|
||||||
|
|
||||||
|
## Find and Replace
|
||||||
|
|
||||||
|
| Action | Command |
|
||||||
|
| ------------------------ | ----------------------------------- |
|
||||||
|
| Replace in selected area | `:s/old/new/g` |
|
||||||
|
| Replace in current line | Same as above |
|
||||||
|
| Replace in whole file | `:% s/old/new/g` |
|
||||||
|
| Replace with regex | `:% s@\vhttp://(\w+)@https://\1@gc` |
|
||||||
|
|
||||||
|
1. `\v` means means that in the regex pattern after it can be used without backslash escaping(similar to python's raw string).
|
||||||
|
2. `\1` means the first matched group in the pattern.
|
||||||
|
|
||||||
|
## Replace in the specific lines
|
||||||
|
|
||||||
|
| Action | Command |
|
||||||
|
| ----------------------------------------- | -------------------------------------- |
|
||||||
|
| From the 10th line to the end of the file | `:10,$ s/old/new/g` or `:10,$ s@^@#@g` |
|
||||||
|
| From the 10th line to the 20th line | `:10,20 s/old/new/g` |
|
||||||
|
|
||||||
|
The postfix(flags) in the above commands:
|
||||||
|
|
||||||
|
1. `g` means replace all the matched strings in the current line/file.
|
||||||
|
2. `c` means ask for confirmation before replacing.
|
||||||
|
3. `i` means ignore case.
|
||||||
|
|
||||||
|
## Search and Replace Globally
|
||||||
|
|
||||||
|
| Description | Shortcut |
|
||||||
|
| ------------------------------------------------------------ | ---------------------------------------------------------------- |
|
||||||
|
| Open spectre.nvim search and replace panel | `<Space> + ss` |
|
||||||
|
| Search and replace in command line(need install `sad` first) | `find -name "*.nix" \| sad '<pattern>' '<replacement>' \| delta` |
|
||||||
|
|
||||||
|
## Surrounding Characters
|
||||||
|
|
||||||
|
Provided by mini.surround plugin.
|
||||||
|
|
||||||
|
- Prefix `gz`
|
||||||
|
|
||||||
|
| Action | Shortcut | Description |
|
||||||
|
| ------------------------------ | -------- | ----------------------------------------------- |
|
||||||
|
| Add surrounding characters | `gzaiw'` | Add `'` around the word under cursor |
|
||||||
|
| Delete surrounding characters | `gzd'` | Delete `'` around the word under cursor |
|
||||||
|
| Replace surrounding characters | `gzr'"` | Replace `'` by `"` around the word under cursor |
|
||||||
|
| Highlight surrounding | `gzh'` | Highlight `'` around the word under cursor |
|
||||||
|
|
||||||
|
## Text Manipulation
|
||||||
|
|
||||||
|
| Action | |
|
||||||
|
| -------------------------------------- | ------------- |
|
||||||
|
| Join Selection of Lines With Space | `:join` |
|
||||||
|
| Join without spaces | `:join!` |
|
||||||
|
| Join with LSP intelligence(treesj) | `<Space> + j` |
|
||||||
|
| Split Line into Multiple Lines(treesj) | `<Space> + s` |
|
||||||
|
|
||||||
|
## Convert Text Case
|
||||||
|
|
||||||
|
| Action | |
|
||||||
|
| -------------------- | --- |
|
||||||
|
| Toggle text's case | `~` |
|
||||||
|
| Convert to uppercase | `U` |
|
||||||
|
| Convert to lowercase | `u` |
|
||||||
|
|
||||||
|
## Miscellaneous
|
||||||
|
|
||||||
|
| Action | |
|
||||||
|
| ---------------------------- | -------------------------------------------- |
|
||||||
|
| Save selected text to a file | `:w filename` (Will show `:'<,'>w filename`) |
|
||||||
|
| Show all Yank History | `:<Space> + yh` |
|
||||||
|
| Show undo history | `:<Space> + uh` |
|
||||||
|
|
||||||
|
## Additional Resources
|
||||||
|
|
||||||
|
For more detailed information and advanced usage, refer to:
|
||||||
|
|
||||||
|
1. [AstroNvim walkthrough](https://astronvim.com/Basic%20Usage/walkthrough)
|
||||||
|
2. [./astronvim_user/mapping.lua](./astronvim_user/mappings.lua)
|
||||||
|
3. All the plugins' documentations
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ return {
|
|||||||
opt = {
|
opt = {
|
||||||
relativenumber = true, -- Show relative numberline
|
relativenumber = true, -- Show relative numberline
|
||||||
signcolumn = "auto", -- Show sign column when used only
|
signcolumn = "auto", -- Show sign column when used only
|
||||||
spell = false, -- Spell checking
|
spell = false, -- Spell checking
|
||||||
swapfile = false, -- Swapfile
|
swapfile = false, -- Swapfile
|
||||||
smartindent = false; -- fix https://github.com/ryan4yin/nix-config/issues/4
|
smartindent = false, -- fix https://github.com/ryan4yin/nix-config/issues/4
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -24,7 +24,6 @@ return {
|
|||||||
{ import = "astrocommunity.motion.leap-nvim" },
|
{ import = "astrocommunity.motion.leap-nvim" },
|
||||||
{ import = "astrocommunity.motion.flit-nvim" },
|
{ import = "astrocommunity.motion.flit-nvim" },
|
||||||
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
|
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
|
||||||
{ import = "astrocommunity.editing-support.auto-save-nvim" },
|
|
||||||
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
|
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
|
||||||
-- Language Support
|
-- Language Support
|
||||||
---- Frontend & NodeJS
|
---- Frontend & NodeJS
|
||||||
@@ -35,7 +34,6 @@ return {
|
|||||||
{ import = "astrocommunity.pack.vue" },
|
{ import = "astrocommunity.pack.vue" },
|
||||||
---- Configuration Language
|
---- Configuration Language
|
||||||
{ import = "astrocommunity.pack.markdown" },
|
{ import = "astrocommunity.pack.markdown" },
|
||||||
{ import = "astrocommunity.markdown-and-latex.glow-nvim" },
|
|
||||||
{ import = "astrocommunity.pack.json" },
|
{ import = "astrocommunity.pack.json" },
|
||||||
{ import = "astrocommunity.pack.yaml" },
|
{ import = "astrocommunity.pack.yaml" },
|
||||||
{ import = "astrocommunity.pack.toml" },
|
{ import = "astrocommunity.pack.toml" },
|
||||||
@@ -53,6 +51,14 @@ return {
|
|||||||
{ import = "astrocommunity.pack.cmake" },
|
{ import = "astrocommunity.pack.cmake" },
|
||||||
{ import = "astrocommunity.pack.cpp" },
|
{ import = "astrocommunity.pack.cpp" },
|
||||||
{ import = "astrocommunity.pack.docker" },
|
{ import = "astrocommunity.pack.docker" },
|
||||||
|
-- Motion
|
||||||
|
{ import = "astrocommunity.motion.mini-surround" },
|
||||||
|
-- https://github.com/echasnovski/mini.ai
|
||||||
|
{ import = "astrocommunity.motion.mini-ai" },
|
||||||
|
{ import = "astrocommunity.motion.flash-nvim" },
|
||||||
|
{ "folke/flash.nvim", vscode = false },
|
||||||
|
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
|
||||||
|
{ import = "astrocommunity.motion.nvim-spider" },
|
||||||
-- AI Assistant
|
-- AI Assistant
|
||||||
{ import = "astrocommunity.completion.copilot-lua-cmp" },
|
{ import = "astrocommunity.completion.copilot-lua-cmp" },
|
||||||
-- Custom copilot-lua to enable filtypes: markdown
|
-- Custom copilot-lua to enable filtypes: markdown
|
||||||
@@ -60,30 +66,120 @@ return {
|
|||||||
"zbirenbaum/copilot.lua",
|
"zbirenbaum/copilot.lua",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts.filetypes = {
|
opts.filetypes = {
|
||||||
yaml = true;
|
yaml = true,
|
||||||
markdown = true,
|
markdown = true,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
---- Nushell
|
|
||||||
{
|
{
|
||||||
"LhKipp/nvim-nu",
|
"0x00-ketsu/autosave.nvim",
|
||||||
|
-- lazy-loading on events
|
||||||
|
event = { "InsertLeave", "TextChanged" },
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.prompt_style = "notify" -- or stdout
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- markdown preview
|
||||||
|
{
|
||||||
|
"0x00-ketsu/markdown-preview.nvim",
|
||||||
|
ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" },
|
||||||
config = function()
|
config = function()
|
||||||
require'nu'.setup({
|
require("markdown-preview").setup({
|
||||||
use_lsp_features = true, -- requires https://github.com/jose-elias-alvarez/null-ls.nvim
|
-- your configuration comes here
|
||||||
-- lsp_feature: all_cmd_names is the source for the cmd name completion.
|
-- or leave it empty to use the default settings
|
||||||
-- It can be
|
-- refer to the setup section below
|
||||||
-- * a string, which is interpreted as a shell command and the returned list is the source for completions (requires plenary.nvim)
|
})
|
||||||
-- * a list, which is the direct source for completions (e.G. all_cmd_names = {"echo", "to csv", ...})
|
end,
|
||||||
-- * a function, returning a list of strings and the return value is used as the source for completions
|
},
|
||||||
all_cmd_names = [[nu -c 'help commands | get name | str join "\n"']]
|
|
||||||
|
-- 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,
|
end,
|
||||||
dependencies = {
|
|
||||||
{"nvim-treesitter/nvim-treesitter"},
|
|
||||||
{ "jose-elias-alvarez/null-ls.nvim"},
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
-- File explorer(Custom configs)
|
-- File explorer(Custom configs)
|
||||||
@@ -92,36 +188,48 @@ return {
|
|||||||
opts = {
|
opts = {
|
||||||
filesystem = {
|
filesystem = {
|
||||||
filtered_items = {
|
filtered_items = {
|
||||||
visible = true, -- visible by default
|
visible = true, -- visible by default
|
||||||
hide_dotfiles = false,
|
hide_dotfiles = false,
|
||||||
hide_gitignored = false,
|
hide_gitignored = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
-- The plugin offers the `:Refactor` command to refactor code.
|
-- The plugin offers the alibity to refactor code.
|
||||||
-- TODO not work yet
|
|
||||||
{
|
{
|
||||||
"ThePrimeagen/refactoring.nvim",
|
"ThePrimeagen/refactoring.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{"nvim-lua/plenary.nvim"},
|
{ "nvim-lua/plenary.nvim" },
|
||||||
{"nvim-treesitter/nvim-treesitter"}
|
{ "nvim-treesitter/nvim-treesitter" },
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
-- The plugin offers the `:Spectre` command to search and replace.
|
-- The plugin offers the abilibty to search and replace.
|
||||||
-- TODO not work yet
|
|
||||||
{
|
{
|
||||||
"nvim-pack/nvim-spectre",
|
"nvim-pack/nvim-spectre",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{"nvim-lua/plenary.nvim"},
|
{ "nvim-lua/plenary.nvim" },
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- full signature help, docs and completion for the nvim lua API.
|
||||||
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
|
|
||||||
|
{ "RRethy/vim-illuminate", config = function() end },
|
||||||
|
|
||||||
-- Language Parser for syntax highlighting / indentation / folding / Incremental selection
|
-- Language Parser for syntax highlighting / indentation / folding / Incremental selection
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local utils = require "astronvim.utils";
|
local utils = require("astronvim.utils")
|
||||||
opts.indent.enable = false;
|
opts.incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<C-space>", -- Ctrl + Space
|
||||||
|
node_incremental = "<C-space>",
|
||||||
|
scope_incremental = "<A-space>", -- Alt + Space
|
||||||
|
node_decremental = "<bs>", -- Backspace
|
||||||
|
},
|
||||||
|
}
|
||||||
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, {
|
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, {
|
||||||
-- neovim
|
-- neovim
|
||||||
"vim",
|
"vim",
|
||||||
@@ -137,6 +245,17 @@ return {
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- implementation/definition preview
|
||||||
|
{
|
||||||
|
"rmagatti/goto-preview",
|
||||||
|
config = function()
|
||||||
|
require("goto-preview").setup({})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Undo tree
|
||||||
|
{ "debugloop/telescope-undo.nvim" },
|
||||||
|
|
||||||
-- Install lsp, formmatter and others via home manager instead of Mason.nvim
|
-- Install lsp, formmatter and others via home manager instead of Mason.nvim
|
||||||
-- LSP installations
|
-- LSP installations
|
||||||
{
|
{
|
||||||
@@ -160,7 +279,7 @@ return {
|
|||||||
{
|
{
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local null_ls = require "null-ls"
|
local null_ls = require("null-ls")
|
||||||
local code_actions = null_ls.builtins.code_actions
|
local code_actions = null_ls.builtins.code_actions
|
||||||
local diagnostics = null_ls.builtins.diagnostics
|
local diagnostics = null_ls.builtins.diagnostics
|
||||||
local formatting = null_ls.builtins.formatting
|
local formatting = null_ls.builtins.formatting
|
||||||
@@ -173,42 +292,40 @@ return {
|
|||||||
code_actions.gitsigns,
|
code_actions.gitsigns,
|
||||||
-- common refactoring actions based off the Refactoring book by Martin Fowler
|
-- common refactoring actions based off the Refactoring book by Martin Fowler
|
||||||
code_actions.refactoring,
|
code_actions.refactoring,
|
||||||
code_actions.gomodifytags, -- Go - modify struct field tags
|
code_actions.gomodifytags, -- Go - modify struct field tags
|
||||||
code_actions.impl, -- Go - generate interface method stubs
|
code_actions.impl, -- Go - generate interface method stubs
|
||||||
code_actions.shellcheck,
|
code_actions.shellcheck,
|
||||||
code_actions.proselint, -- English prose linter
|
code_actions.proselint, -- English prose linter
|
||||||
code_actions.statix, -- Lints and suggestions for Nix.
|
code_actions.statix, -- Lints and suggestions for Nix.
|
||||||
|
|
||||||
-- Completion
|
|
||||||
completion.luasnip,
|
|
||||||
|
|
||||||
-- Diagnostic
|
-- Diagnostic
|
||||||
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
|
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
|
||||||
diagnostics.buf, -- check text in current buffer
|
diagnostics.buf, -- check text in current buffer
|
||||||
diagnostics.checkmake, -- check Makefiles
|
diagnostics.checkmake, -- check Makefiles
|
||||||
diagnostics.deadnix, -- Scan Nix files for dead code.
|
diagnostics.deadnix, -- Scan Nix files for dead code.
|
||||||
|
|
||||||
-- Formatting
|
-- Formatting
|
||||||
formatting.prettier, -- js/ts/vue/css/html/json/... formatter
|
formatting.prettier, -- js/ts/vue/css/html/json/... formatter
|
||||||
diagnostics.hadolint, -- Dockerfile linter
|
diagnostics.hadolint, -- Dockerfile linter
|
||||||
formatting.black, -- Python formatter
|
formatting.black, -- Python formatter
|
||||||
formatting.ruff, -- extremely fast Python linter
|
formatting.ruff, -- extremely fast Python linter
|
||||||
formatting.goimports, -- Go formatter
|
formatting.goimports, -- Go formatter
|
||||||
formatting.shfmt, -- Shell formatter
|
formatting.shfmt, -- Shell formatter
|
||||||
formatting.rustfmt, -- Rust formatter
|
formatting.rustfmt, -- Rust formatter
|
||||||
formatting.taplo, -- TOML formatteautoindentr
|
formatting.taplo, -- TOML formatteautoindentr
|
||||||
formatting.terraform_fmt, -- Terraform formatter
|
formatting.terraform_fmt, -- Terraform formatter
|
||||||
formatting.stylua, -- Lua formatter
|
formatting.stylua, -- Lua formatter
|
||||||
formatting.alejandra, -- Nix formatter
|
formatting.alejandra, -- Nix formatter
|
||||||
formatting.sqlfluff.with({ -- SQL formatter
|
formatting.sqlfluff.with({ -- SQL formatter
|
||||||
extra_args = { "--dialect", "postgres" }, -- change to your dialect
|
extra_args = { "--dialect", "postgres" }, -- change to your dialect
|
||||||
}),
|
}),
|
||||||
formatting.nginx_beautifier, -- Nginx formatter
|
formatting.nginx_beautifier, -- Nginx formatter
|
||||||
|
null_ls.builtins.formatting.verible_verilog_format, -- Verilog formatter
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- Debugger installation
|
-- Debugger installation
|
||||||
{
|
{
|
||||||
"jay-babu/mason-nvim-dap.nvim",
|
"jay-babu/mason-nvim-dap.nvim",
|
||||||
-- overrides `require("mason-nvim-dap").setup(...)`
|
-- overrides `require("mason-nvim-dap").setup(...)`
|
||||||
@@ -217,6 +334,57 @@ return {
|
|||||||
opts.automatic_installation = false
|
opts.automatic_installation = false
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
branch = "0.1.x",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
init = function()
|
||||||
|
-- 1. Disable highlighting for certain filetypes
|
||||||
|
-- 2. Ignore files larger than a certain filesize
|
||||||
|
local previewers = require("telescope.previewers")
|
||||||
|
|
||||||
|
local _bad = { ".*%.csv", ".*%.min.js" } -- Put all filetypes that slow you down in this array
|
||||||
|
local filesize_threshold = 300 * 1024 -- 300KB
|
||||||
|
local bad_files = function(filepath)
|
||||||
|
for _, v in ipairs(_bad) do
|
||||||
|
if filepath:match(v) then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local new_maker = function(filepath, bufnr, opts)
|
||||||
|
opts = opts or {}
|
||||||
|
if opts.use_ft_detect == nil then
|
||||||
|
opts.use_ft_detect = true
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 1. Check if the file is in the bad_files array, and if so, don't highlight it
|
||||||
|
opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath)
|
||||||
|
|
||||||
|
-- 2. Check the file size, and ignore it if it's too big(preview nothing).
|
||||||
|
filepath = vim.fn.expand(filepath)
|
||||||
|
vim.loop.fs_stat(filepath, function(_, stat)
|
||||||
|
if not stat then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if stat.size > filesize_threshold then
|
||||||
|
return
|
||||||
|
else
|
||||||
|
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
require("telescope").setup({
|
||||||
|
defaults = {
|
||||||
|
buffer_previewer_maker = new_maker,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Configure require("lazy").setup() options
|
-- Configure require("lazy").setup() options
|
||||||
@@ -225,11 +393,12 @@ return {
|
|||||||
performance = {
|
performance = {
|
||||||
rtp = {
|
rtp = {
|
||||||
-- customize default disabled vim plugins
|
-- customize default disabled vim plugins
|
||||||
disabled_plugins = { };
|
disabled_plugins = {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
lsp = {
|
lsp = {
|
||||||
config = {
|
config = {
|
||||||
-- the offset_enconding of clangd will confilicts whit null-ls
|
-- the offset_enconding of clangd will confilicts whit null-ls
|
||||||
@@ -243,34 +412,36 @@ return {
|
|||||||
-- enable servers that installed by home-manager instead of mason
|
-- enable servers that installed by home-manager instead of mason
|
||||||
servers = {
|
servers = {
|
||||||
---- Frontend & NodeJS
|
---- Frontend & NodeJS
|
||||||
"tsserver", -- typescript/javascript language server
|
"tsserver", -- typescript/javascript language server
|
||||||
"tailwindcss", -- tailwindcss language server
|
"tailwindcss", -- tailwindcss language server
|
||||||
"html", -- html language server
|
"html", -- html language server
|
||||||
"cssls", -- css language server
|
"cssls", -- css language server
|
||||||
"prismals", -- prisma language server
|
"prismals", -- prisma language server
|
||||||
"volar", -- vue language server
|
"volar", -- vue language server
|
||||||
---- Configuration Language
|
---- Configuration Language
|
||||||
"marksman", -- markdown ls
|
"marksman", -- markdown ls
|
||||||
"jsonls", -- json language server
|
"jsonls", -- json language server
|
||||||
"yamlls", -- yaml language server
|
"yamlls", -- yaml language server
|
||||||
"taplo", -- toml language server
|
"taplo", -- toml language server
|
||||||
---- Backend
|
---- Backend
|
||||||
"lua_ls", -- lua
|
"lua_ls", -- lua
|
||||||
"gopls", -- go
|
"gopls", -- go
|
||||||
"rust_analyzer", -- rust
|
"rust_analyzer", -- rust
|
||||||
"pyright", -- python
|
"pyright", -- python
|
||||||
"ruff_lsp", -- extremely fast Python linter and code transformation
|
"ruff_lsp", -- extremely fast Python linter and code transformation
|
||||||
"jdtls", -- java
|
"jdtls", -- java
|
||||||
"nil_ls", -- nix language server
|
"nil_ls", -- nix language server
|
||||||
"bufls", -- protocol buffer language server
|
"bufls", -- protocol buffer language server
|
||||||
"zls", -- zig language server
|
"zls", -- zig language server
|
||||||
|
---- HDL
|
||||||
|
"verible", -- verilog language server
|
||||||
---- Operation & Cloud Nativautoindente
|
---- Operation & Cloud Nativautoindente
|
||||||
"bashls", -- bash
|
"bashls", -- bash
|
||||||
"cmake", -- cmake language server
|
"cmake", -- cmake language server
|
||||||
"clangd", -- c/c++
|
"clangd", -- c/c++
|
||||||
"dockerls", -- dockerfile
|
"dockerls", -- dockerfile
|
||||||
"jsonnet_ls", -- jsonnet language server
|
"jsonnet_ls", -- jsonnet language server
|
||||||
"terraformls", -- terraform hcl
|
"terraformls", -- terraform hcl
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
disabled = {},
|
disabled = {},
|
||||||
|
|||||||
@@ -4,18 +4,65 @@
|
|||||||
-- lower level configuration and more robust one. (which-key will
|
-- lower level configuration and more robust one. (which-key will
|
||||||
-- automatically pick-up stored data by this setting.)
|
-- automatically pick-up stored data by this setting.)
|
||||||
local utils = require "astronvim.utils"
|
local utils = require "astronvim.utils"
|
||||||
|
|
||||||
|
require("telescope").load_extension("refactoring")
|
||||||
|
require("telescope").load_extension("yank_history")
|
||||||
|
require("telescope").load_extension("undo")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- first key is the mode
|
-- normal mode
|
||||||
n = {
|
n = {
|
||||||
-- second key is the lefthand side of the map
|
-- second key is the lefthand side of the map
|
||||||
-- mappings seen under group name "Buffer"
|
-- mappings seen under group name "Buffer"
|
||||||
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
||||||
-- quick save
|
-- quick save
|
||||||
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
||||||
["<leader>tp"] = { function() utils.toggle_term_cmd("ipython") end, desc = "ToggleTerm python" },
|
|
||||||
|
-- Terminal
|
||||||
|
-- NOTE: https://neovim.io/doc/user/builtin.html#jobstart()
|
||||||
|
-- 1. If {cmd} is a List it runs directly (no 'shell')
|
||||||
|
-- 2. If {cmd} is a String it runs in the 'shell'
|
||||||
|
["<leader>tp"] = { function() utils.toggle_term_cmd({ cmd = "ipython" }) end, desc = "ToggleTerm python" },
|
||||||
|
|
||||||
|
-- search and replace globally
|
||||||
|
['<leader>ss'] = {'<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" },
|
||||||
|
['<leader>sw'] = {'<cmd>lua require("spectre").open_visual({select_word=true})<CR>', desc = "Search current word" },
|
||||||
|
['<leader>sp'] ={'<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', desc = "Search on current file" },
|
||||||
|
|
||||||
|
-- refactoring
|
||||||
|
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" },
|
||||||
|
["<leader>rb"] = { function() require('refactoring').refactor('Extract Block') end, desc = "Extract Block" },
|
||||||
|
["<leader>rbf"] = { function() require('refactoring').refactor('Extract Block To File') end, desc = "Extract Block To File" },
|
||||||
|
["<leader>rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" },
|
||||||
|
["<leader>rp"] = { function() require('refactoring').debug.printf({below = false}) end, desc = "Insert print statement to mark the calling of a function" },
|
||||||
|
["<leader>rv"] = { function() require('refactoring').debug.print_var() end, desc = "Insert print statement to print a variable" },
|
||||||
|
["<leader>rc"] = { function() require('refactoring').debug.cleanup({}) end, desc = "Cleanup of all generated print statements" },
|
||||||
|
|
||||||
|
-- yank_history
|
||||||
|
["<leader>yh"] = { function() require("telescope").extensions.yank_history.yank_history() end, desc = "Preview Yank History" },
|
||||||
|
|
||||||
|
-- undo history
|
||||||
|
["<leader>uh"] = {"<cmd>Telescope undo<cr>", desc="Telescope undo" },
|
||||||
|
|
||||||
|
-- implementation/definition preview
|
||||||
|
["gpd"] = { "<cmd>lua require('goto-preview').goto_preview_definition()<CR>", desc="goto_preview_definition" },
|
||||||
|
["gpt"] = { "<cmd>lua require('goto-preview').goto_preview_type_definition()<CR>", desc="goto_preview_type_definition" },
|
||||||
|
["gpi"] = { "<cmd>lua require('goto-preview').goto_preview_implementation()<CR>", desc="goto_preview_implementation" },
|
||||||
|
["gP" ] = { "<cmd>lua require('goto-preview').close_all_win()<CR>", desc="close_all_win" },
|
||||||
|
["gpr"] = { "<cmd>lua require('goto-preview').goto_preview_references()<CR>", desc="goto_preview_references" },
|
||||||
},
|
},
|
||||||
t = {
|
-- Visual mode
|
||||||
-- setting a mapping to false will disable it
|
v = {
|
||||||
-- ["<esc>"] = false,
|
-- search and replace globally
|
||||||
|
['<leader>sw'] = {'<esc><cmd>lua require("spectre").open_visual()<CR>', desc = "Search current word" },
|
||||||
|
},
|
||||||
|
-- visual mode(what's the difference between v and x???)
|
||||||
|
x = {
|
||||||
|
-- refactoring
|
||||||
|
["<leader>ri"] = { function() require('refactoring').refactor('Inline Variable') end, desc = "Inverse of extract variable" },
|
||||||
|
["<leader>re"] = { function() require('refactoring').refactor('Extract Function') end, desc = "Extracts the selected code to a separate function" },
|
||||||
|
["<leader>rf"] = { function() require('refactoring').refactor('Extract Function To File') end, desc = "Extract Function To File" },
|
||||||
|
["<leader>rv"] = { function() require('refactoring').refactor('Extract Variable') end, desc = "Extracts occurrences of a selected expression to its own variable" },
|
||||||
|
["<leader>rr"] = { function() require('telescope').extensions.refactoring.refactors() end, desc = "Prompt for a refactor to apply" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,120 +5,17 @@
|
|||||||
}:
|
}:
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# AstroNvim's configuration and all its dependencies
|
# AstroNvim's configuration and all its dependencies(lsp, formatter, etc.)
|
||||||
#
|
|
||||||
# Related folders:
|
|
||||||
# nvim's config: `~/.config/nvim`
|
|
||||||
# astronvim's user configuration: `$XDG_CONFIG_HOME/astronvim/lua/user`
|
|
||||||
# all plugins will be installed into(by lazy.nvim): `~/.local/share/nvim/`
|
|
||||||
#
|
|
||||||
# For details: https://astronvim.com/
|
|
||||||
#
|
|
||||||
# Toggle visual mode: `v`
|
|
||||||
# Toggle visual block mode: `<Ctrl> + v` (select a block(vertically) of text)
|
|
||||||
#
|
|
||||||
# Add at the end of Multiple line: `:normal A<text>`
|
|
||||||
# Note that `:normal` execute `A<text>` on each line.
|
|
||||||
# `A` means append text at the end of the line.
|
|
||||||
# You need to select the lines via visual mode first.
|
|
||||||
#
|
|
||||||
# Add at the end of the visual block: `:A<text>`
|
|
||||||
# You need to select the block via visual block mode first.
|
|
||||||
# And then this command will append text at the end of the block on each line.
|
|
||||||
# If the position exceeds the end of the line, neovim will automatically add spaces
|
|
||||||
#
|
|
||||||
# Commands & shortcuts in AstroNvim
|
|
||||||
# Learn Neovim's Basics: `:Tutor`
|
|
||||||
# Opening file explorer: `<Space> + e`
|
|
||||||
# Focus Neotree to current file: `<Space> + o`
|
|
||||||
# Floating Terminal: `<Space> + tf`
|
|
||||||
# Horizontal Split Terminal: `<Space> + th`
|
|
||||||
# Vertical Split Terminal: `<Space> + tv`
|
|
||||||
# Open IPython REPL: `<Space> + tp`
|
|
||||||
# Opening LSP symbols: `<Space> + lS`
|
|
||||||
# Toggle line wrap: `<Space> + uw`
|
|
||||||
# Show line diagnostics: `gl`
|
|
||||||
# Go to definition: `gd`
|
|
||||||
#
|
|
||||||
# Switching between windows: `<Ctrl> + h/j/k/l`
|
|
||||||
# Resizing windows: `<Ctrl> + Up/Down/Left/Right`
|
|
||||||
# Note that on macOS, this is conflict with system's default shortcuts.
|
|
||||||
# You need disable them in System Preferences -> Keyboard -> Shortcuts -> Mission Control.
|
|
||||||
# Horizontal Split: `\`
|
|
||||||
# Vertical Split: `|`
|
|
||||||
# Next Buffer(Tab): `]b`
|
|
||||||
# Previous Buffer(Tab): `[b`
|
|
||||||
# Close Buffer: `<Space> + c`
|
|
||||||
#
|
|
||||||
# Toggle buffer auto formatting: `<Space> + uf`
|
|
||||||
# Format Document: `<Space> + lf`
|
|
||||||
# Comment Line: `<Space> + /`
|
|
||||||
# Can be used in visual mode
|
|
||||||
# Code Actions: `<Space> + la`
|
|
||||||
# Rename: `<Space> + lr`
|
|
||||||
# Open filepath/URL at cursor: `gx`
|
|
||||||
# This is a neovim builtin command
|
|
||||||
# Find files by name(fzf): `<Space> + ff`
|
|
||||||
# Grep string in files(repgrep): `<Space> + fw`
|
|
||||||
#
|
|
||||||
# Save Session: `<Space> + Ss`
|
|
||||||
# Last Session: `<Space> + Sl`
|
|
||||||
# Delete Session: `<Space> + Sd`
|
|
||||||
# Search Session: `<Space> + Sf`
|
|
||||||
# Load Current Directory Session:`<Space> + S.`
|
|
||||||
#
|
|
||||||
# Debugging: press `<Space> + D` to see the available bindings and options.
|
|
||||||
#
|
|
||||||
# Replace in the selected area: `:s/old/new/g` (will show `:'<,'>s/old/new/g`)
|
|
||||||
# Replace in the current line: The same as above
|
|
||||||
# Replace in the whole file: `:% s/old/new/g`
|
|
||||||
# Replace with regex: `:% s@\vhttp://(\w+)@https://\1@gc`
|
|
||||||
# 1. `\v` means means that in the regex pattern after it can be used without backslash escaping(similar to python's raw string).
|
|
||||||
# 2. `\1` means the first matched group in the pattern.
|
|
||||||
# Replace in the specific lines:
|
|
||||||
# 1. From the 10th line to the end of the file: `:10,$ s/old/new/g`
|
|
||||||
# or `:10,$ s@^@#@g`
|
|
||||||
# 2. From the 10th line to the 20th line: `:10,20 s/old/new/g`
|
|
||||||
#
|
|
||||||
# The postfix(flgas) in the above commands:
|
|
||||||
# 1. `g` means replace all the matched strings in the current line/file.
|
|
||||||
# 2. `c` means ask for confirmation before replacing.
|
|
||||||
# 3. `i` means ignore case.
|
|
||||||
#
|
|
||||||
# Joining a Selection of Lines With Space: `:join`
|
|
||||||
# Joining without spaces: `:join!`
|
|
||||||
#
|
|
||||||
# Toggle text's case: `~`
|
|
||||||
# Convert to uppercase: `U`
|
|
||||||
# Convert to lowercase: `u`
|
|
||||||
#
|
|
||||||
# Save the selected text to a file: `:w filename` (will show `:'<,'>w filename`)
|
|
||||||
#
|
|
||||||
# Search key pattern and Replace in Multiple Files:
|
|
||||||
# sed -ri "s/pattern_str/replace_str/g" $(grep "key_pattern" 'path_pattern' -rl)
|
|
||||||
#
|
|
||||||
# Search file name pattern and Replace in Multiple Files:
|
|
||||||
# sed -ri "s/pattern_str/replace_str/g" $(find . -name "pattern")
|
|
||||||
#
|
|
||||||
# ......
|
|
||||||
# See https://astronvim.com/Basic%20Usage/walkthrough
|
|
||||||
#
|
#
|
||||||
#e#############################################################################
|
#e#############################################################################
|
||||||
{
|
{
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
# base config
|
# astronvim's config
|
||||||
"nvim" = {
|
"nvim".source = astronvim;
|
||||||
# update AstroNvim
|
|
||||||
onChange = "${pkgs.neovim}/bin/nvim --headless +quitall";
|
# my custom astronvim config, astronvim will load it after base config
|
||||||
source = astronvim;
|
|
||||||
};
|
|
||||||
# my cusotom astronvim config, astronvim will load it after base config
|
|
||||||
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
|
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
|
||||||
"astronvim/lua/user" = {
|
"astronvim/lua/user".source = ./astronvim_user;
|
||||||
# update AstroNvim
|
|
||||||
onChange = "${pkgs.neovim}/bin/nvim --headless +quitall";
|
|
||||||
source = ./astronvim_user;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.config = {
|
nixpkgs.config = {
|
||||||
@@ -130,105 +27,130 @@
|
|||||||
programs = {
|
programs = {
|
||||||
neovim = {
|
neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultEditor = true;
|
|
||||||
|
|
||||||
viAlias = false;
|
defaultEditor = true;
|
||||||
|
viAlias = true;
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
|
|
||||||
withPython3 = true;
|
|
||||||
withNodeJs = true;
|
|
||||||
extraPackages = [];
|
|
||||||
|
|
||||||
# currently we use lazy.nvim as neovim's package manager, so comment this one.
|
# currently we use lazy.nvim as neovim's package manager, so comment this one.
|
||||||
plugins = with pkgs.vimPlugins; [
|
# plugins = with pkgs.vimPlugins; [
|
||||||
# search all the plugins using https://search.nixos.org/packages
|
# # search all the plugins using https://search.nixos.org/packages
|
||||||
luasnip
|
# ];
|
||||||
];
|
|
||||||
|
# Extra packages only available to nvim(won't pollute the global home environment)
|
||||||
|
extraPackages = with pkgs;
|
||||||
|
[
|
||||||
|
#-- c/c++
|
||||||
|
cmake
|
||||||
|
cmake-language-server
|
||||||
|
gnumake
|
||||||
|
checkmake
|
||||||
|
gcc # c/c++ compiler, required by nvim-treesitter!
|
||||||
|
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
|
||||||
|
lldb
|
||||||
|
|
||||||
|
#-- python
|
||||||
|
nodePackages.pyright # python language server
|
||||||
|
python3Packages.black # python formatter
|
||||||
|
python3Packages.ruff-lsp
|
||||||
|
(python3.withPackages (
|
||||||
|
ps:
|
||||||
|
with ps; [
|
||||||
|
pynvim # Python client and plugin host for Nvim
|
||||||
|
|
||||||
|
ipython
|
||||||
|
pandas
|
||||||
|
requests
|
||||||
|
pyquery
|
||||||
|
pyyaml
|
||||||
|
]
|
||||||
|
))
|
||||||
|
|
||||||
|
#-- rust
|
||||||
|
rust-analyzer
|
||||||
|
cargo # rust package manager
|
||||||
|
rustfmt
|
||||||
|
|
||||||
|
#-- zig
|
||||||
|
zls
|
||||||
|
|
||||||
|
#-- nix
|
||||||
|
nil
|
||||||
|
rnix-lsp
|
||||||
|
# nixd
|
||||||
|
statix # Lints and suggestions for the nix programming language
|
||||||
|
deadnix # Find and remove unused code in .nix source files
|
||||||
|
alejandra # Nix Code Formatter
|
||||||
|
|
||||||
|
#-- golang
|
||||||
|
go
|
||||||
|
gomodifytags
|
||||||
|
iferr # generate error handling code for go
|
||||||
|
impl # generate function implementation for go
|
||||||
|
gotools # contains tools like: godoc, goimports, etc.
|
||||||
|
gopls # go language server
|
||||||
|
delve # go debugger
|
||||||
|
|
||||||
|
# -- java
|
||||||
|
jdk17
|
||||||
|
gradle
|
||||||
|
maven
|
||||||
|
spring-boot-cli
|
||||||
|
|
||||||
|
#-- lua
|
||||||
|
stylua
|
||||||
|
lua-language-server
|
||||||
|
|
||||||
|
#-- bash
|
||||||
|
nodePackages.bash-language-server
|
||||||
|
shellcheck
|
||||||
|
shfmt
|
||||||
|
|
||||||
|
#-- javascript/typescript --#
|
||||||
|
nodePackages.nodejs
|
||||||
|
nodePackages.typescript
|
||||||
|
nodePackages.typescript-language-server
|
||||||
|
# HTML/CSS/JSON/ESLint language servers extracted from vscode
|
||||||
|
nodePackages.vscode-langservers-extracted
|
||||||
|
nodePackages."@tailwindcss/language-server"
|
||||||
|
|
||||||
|
#-- CloudNative
|
||||||
|
nodePackages.dockerfile-language-server-nodejs
|
||||||
|
# terraform # install via brew on macOS
|
||||||
|
terraform-ls
|
||||||
|
jsonnet
|
||||||
|
jsonnet-language-server
|
||||||
|
hadolint # Dockerfile linter
|
||||||
|
|
||||||
|
#-- Others
|
||||||
|
taplo # TOML language server / formatter / validator
|
||||||
|
nodePackages.yaml-language-server
|
||||||
|
sqlfluff # SQL linter
|
||||||
|
actionlint # GitHub Actions linter
|
||||||
|
buf # protoc plugin for linting and formatting
|
||||||
|
proselint # English prose linter
|
||||||
|
guile # scheme language
|
||||||
|
|
||||||
|
#-- Misc
|
||||||
|
tree-sitter # common language parser/highlighter
|
||||||
|
nodePackages.prettier # common code formatter
|
||||||
|
marksman # language server for markdown
|
||||||
|
glow # markdown previewer
|
||||||
|
fzf
|
||||||
|
|
||||||
|
#-- Optional Requirements:
|
||||||
|
gdu # disk usage analyzer, required by AstroNvim
|
||||||
|
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
||||||
|
]
|
||||||
|
++ (
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then []
|
||||||
|
else [
|
||||||
|
#-- verilog / systemverilog
|
||||||
|
verible
|
||||||
|
gdb
|
||||||
|
]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
home = {
|
|
||||||
packages = with pkgs; [
|
|
||||||
#-- c/c++
|
|
||||||
cmake
|
|
||||||
cmake-language-server
|
|
||||||
gnumake
|
|
||||||
checkmake
|
|
||||||
gcc # c/c++ compiler, required by nvim-treesitter!
|
|
||||||
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
|
|
||||||
gdb
|
|
||||||
lldb
|
|
||||||
|
|
||||||
#-- python
|
|
||||||
nodePackages.pyright # python language server
|
|
||||||
python311Packages.black # python formatter
|
|
||||||
python311Packages.ruff-lsp
|
|
||||||
|
|
||||||
#-- rust
|
|
||||||
rust-analyzer
|
|
||||||
cargo # rust package manager
|
|
||||||
rustfmt
|
|
||||||
|
|
||||||
#-- zig
|
|
||||||
zls
|
|
||||||
|
|
||||||
#-- nix
|
|
||||||
nil
|
|
||||||
rnix-lsp
|
|
||||||
# nixd
|
|
||||||
statix # Lints and suggestions for the nix programming language
|
|
||||||
deadnix # Find and remove unused code in .nix source files
|
|
||||||
alejandra # Nix Code Formatter
|
|
||||||
|
|
||||||
#-- golang
|
|
||||||
go
|
|
||||||
gomodifytags
|
|
||||||
iferr # generate error handling code for go
|
|
||||||
impl # generate function implementation for go
|
|
||||||
gotools # contains tools like: godoc, goimports, etc.
|
|
||||||
gopls # go language server
|
|
||||||
delve # go debugger
|
|
||||||
|
|
||||||
#-- lua
|
|
||||||
stylua
|
|
||||||
lua-language-server
|
|
||||||
|
|
||||||
#-- bash
|
|
||||||
nodePackages.bash-language-server
|
|
||||||
shellcheck
|
|
||||||
shfmt
|
|
||||||
|
|
||||||
#-- javascript/typescript --#
|
|
||||||
nodePackages.typescript
|
|
||||||
nodePackages.typescript-language-server
|
|
||||||
# HTML/CSS/JSON/ESLint language servers extracted from vscode
|
|
||||||
nodePackages.vscode-langservers-extracted
|
|
||||||
nodePackages."@tailwindcss/language-server"
|
|
||||||
|
|
||||||
#-- CloudNative
|
|
||||||
nodePackages.dockerfile-language-server-nodejs
|
|
||||||
terraform
|
|
||||||
terraform-ls
|
|
||||||
jsonnet
|
|
||||||
jsonnet-language-server
|
|
||||||
hadolint # Dockerfile linter
|
|
||||||
|
|
||||||
#-- Others
|
|
||||||
taplo # TOML language server / formatter / validator
|
|
||||||
nodePackages.yaml-language-server
|
|
||||||
sqlfluff # SQL linter
|
|
||||||
actionlint # GitHub Actions linter
|
|
||||||
buf # protoc plugin for linting and formatting
|
|
||||||
proselint # English prose linter
|
|
||||||
|
|
||||||
#-- Misc
|
|
||||||
tree-sitter # common language parser/highlighter
|
|
||||||
nodePackages.prettier # common code formatter
|
|
||||||
marksman # language server for markdown
|
|
||||||
glow # markdown previewer
|
|
||||||
|
|
||||||
#-- Optional Requirements:
|
|
||||||
gdu # disk usage analyzer, required by AstroNvim
|
|
||||||
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ nushell-scripts, ...}: {
|
{nushell-scripts, ...}: {
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
# load the alias file for work
|
# load the alias file for work
|
||||||
bashrcExtra = ''
|
bashrcExtra = ''
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
# Termianl Emulators
|
||||||
|
|
||||||
|
1. kitty: My main terminal emulator.
|
||||||
|
2. wezterm: My secondary terminal emulator.
|
||||||
|
3. alacritty: Standby terminal.
|
||||||
|
|
||||||
|
|
||||||
|
## 'xterm-kitty': unknown terminal type when `ssh` into a remote host or `sudo xxx`
|
||||||
|
|
||||||
|
> https://sw.kovidgoyal.net/kitty/faq/#i-get-errors-about-the-terminal-being-unknown-or-opening-the-terminal-failing-or-functional-keys-like-arrow-keys-don-t-work
|
||||||
|
|
||||||
|
> https://wezfurlong.org/wezterm/config/lua/config/term.html
|
||||||
|
|
||||||
|
kitty set `TERM` to `xterm-kitty` by default, and TUI apps like `viu`, `yazi`, `curses` will try to search in the host's [terminfo(terminal capability data base)](https://linux.die.net/man/5/terminfo) for value of `TERM` to determine the capabilities of the terminal.
|
||||||
|
|
||||||
|
But when you `ssh` into a remote host, the remote host is very likely to not have `xterm-kitty` in its terminfo, so you will get this error:
|
||||||
|
|
||||||
|
```
|
||||||
|
'xterm-kitty': unknown terminal type
|
||||||
|
```
|
||||||
|
|
||||||
|
Or when you `sudo xxx`, `sudo` won't preserve the `TERM` variable, it will be reset to root's default `TERM` value, which is `xterm` or `xterm-256color` in most linux distributions, so you will get this error:
|
||||||
|
|
||||||
|
```
|
||||||
|
'xterm-256color': unknown terminal type
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```
|
||||||
|
Error opening terminal: xterm-kitty.
|
||||||
|
```
|
||||||
|
|
||||||
|
NixOS preserve the `TERMINFO` and `TERMINFO_DIRS` environment variables, for `root` and the `wheel` group: [nixpkgs/nixos/modules/config/terminfo.nix](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/config/terminfo.nix#L18)
|
||||||
|
|
||||||
|
For nix-darwin, take a look at <https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues>
|
||||||
|
|
||||||
|
### Solutions
|
||||||
|
|
||||||
|
Simplest solution, it will automatically copy over the terminfo files and also magically enable shell integration on the remote machine:
|
||||||
|
|
||||||
|
```
|
||||||
|
kitten ssh user@host
|
||||||
|
```
|
||||||
|
|
||||||
|
Or if you do not care about kitty's features(such as true color & graphics protocol), you can simply set `TERM` to `xterm-256color`, which is built-in in most linux distributions:
|
||||||
|
|
||||||
|
```
|
||||||
|
export TERM=xterm-256color
|
||||||
|
```
|
||||||
|
|
||||||
|
If you need kitty's features, but do not like the magic of `kitten`, you can manually install kitty's terminfo on the remote host:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# install on ubuntu / debian
|
||||||
|
sudo apt-get install kitty-terminfo
|
||||||
|
|
||||||
|
# or copy from local machine
|
||||||
|
infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin
|
||||||
|
```
|
||||||
|
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
{pkgs, catppuccin-alacritty, ...}:
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}:
|
||||||
###########################################################
|
###########################################################
|
||||||
#
|
#
|
||||||
# Alacritty Configuration
|
# Alacritty Configuration
|
||||||
@@ -7,18 +11,20 @@
|
|||||||
# 1. Multi-Window: `command + N`
|
# 1. Multi-Window: `command + N`
|
||||||
# 2. Increase Font Size: `command + =` | `command + +`
|
# 2. Increase Font Size: `command + =` | `command + +`
|
||||||
# 3. Decrease Font Size: `command + -` | `command + _`
|
# 3. Decrease Font Size: `command + -` | `command + _`
|
||||||
# 4. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
# 4. Search Text: `command + F`
|
||||||
|
# 5. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
||||||
#
|
#
|
||||||
# Useful Hot Keys for Linux:
|
# Useful Hot Keys for Linux:
|
||||||
# 1. Increase Font Size: `ctrl + shift + =` | `ctrl + shift + +`
|
# 1. Increase Font Size: `ctrl + shift + =` | `ctrl + shift + +`
|
||||||
# 2. Decrease Font Size: `ctrl + shift + -` | `ctrl + shift + _`
|
# 2. Decrease Font Size: `ctrl + shift + -` | `ctrl + shift + _`
|
||||||
# 3. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
# 3. Search Text: `ctrl + shift + N`
|
||||||
|
# 4. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
||||||
#
|
#
|
||||||
# Note: Alacritty do not have support for Tabs, and any graphic protocol.
|
# Note: Alacritty do not have support for Tabs, and any graphic protocol.
|
||||||
#
|
#
|
||||||
###########################################################
|
###########################################################
|
||||||
{
|
{
|
||||||
xdg.configFile."alacritty/theme_catppuccin.yml".source = "${catppuccin-alacritty}/catppuccin-mocha.yml";
|
xdg.configFile."alacritty/theme_catppuccin.yml".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-alacritty}/catppuccin-mocha.yml";
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
@@ -35,7 +41,7 @@
|
|||||||
#
|
#
|
||||||
# Window opacity as a floating point number from `0.0` to `1.0`.
|
# Window opacity as a floating point number from `0.0` to `1.0`.
|
||||||
# The value `0.0` is completely transparent and `1.0` is opaque.
|
# The value `0.0` is completely transparent and `1.0` is opaque.
|
||||||
opacity: 0.95
|
opacity: 0.93
|
||||||
|
|
||||||
# Startup Mode (changes require restart)
|
# Startup Mode (changes require restart)
|
||||||
#
|
#
|
||||||
@@ -46,7 +52,7 @@
|
|||||||
#
|
#
|
||||||
# Values for `startup_mode` (macOS only):
|
# Values for `startup_mode` (macOS only):
|
||||||
# - SimpleFullscreen
|
# - SimpleFullscreen
|
||||||
startup_mode: Windowed
|
startup_mode: Maximized
|
||||||
|
|
||||||
# Allow terminal applications to change Alacritty's window title.
|
# Allow terminal applications to change Alacritty's window title.
|
||||||
dynamic_title: true
|
dynamic_title: true
|
||||||
@@ -81,14 +87,22 @@
|
|||||||
# If the bold italic family is not specified, it will fall back to the
|
# If the bold italic family is not specified, it will fall back to the
|
||||||
# value specified for the normal font.
|
# value specified for the normal font.
|
||||||
family: JetBrainsMono Nerd Font
|
family: JetBrainsMono Nerd Font
|
||||||
|
shell:
|
||||||
|
# To resolve issues:
|
||||||
|
# 1. https://github.com/ryan4yin/nix-config/issues/26
|
||||||
|
# 2. https://github.com/ryan4yin/nix-config/issues/8
|
||||||
|
# Spawn a nushell in login mode via `bash`
|
||||||
|
program: ${pkgs.bash}/bin/bash
|
||||||
|
args:
|
||||||
|
- --login
|
||||||
|
- -c
|
||||||
|
- 'nu --login --interactive'
|
||||||
''
|
''
|
||||||
+ (
|
+ (
|
||||||
if pkgs.stdenv.isDarwin
|
if pkgs.stdenv.isDarwin
|
||||||
then ''
|
then ''
|
||||||
# Point size
|
# Point size
|
||||||
size: 14
|
size: 14
|
||||||
shell: # force nushell as default shell on macOS
|
|
||||||
program: /run/current-system/sw/bin/nu
|
|
||||||
''
|
''
|
||||||
else ''
|
else ''
|
||||||
# holder identation
|
# holder identation
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{...}: {
|
||||||
|
imports = [
|
||||||
|
./alacritty.nix
|
||||||
|
./kitty.nix
|
||||||
|
./wezterm.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
# 4. Increase Font Size: `command + =` | `command + +`
|
# 4. Increase Font Size: `command + =` | `command + +`
|
||||||
# 5. Decrease Font Size: `command + -` | `command + _`
|
# 5. Decrease Font Size: `command + -` | `command + _`
|
||||||
# 6. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
# 6. And Other common shortcuts such as Copy, Paste, Cursor Move, etc.
|
||||||
|
# 7. Search in the current window(show_scrollback): `ctrl + shift + h`
|
||||||
|
# This will open a pager, it's defined by `scrollback_pager`, default is `less`
|
||||||
|
#
|
||||||
#
|
#
|
||||||
# Useful Hot Keys for Linux:
|
# Useful Hot Keys for Linux:
|
||||||
# 1. New Tab: `ctrl + shift + t`
|
# 1. New Tab: `ctrl + shift + t`
|
||||||
@@ -27,7 +30,10 @@
|
|||||||
{
|
{
|
||||||
programs.kitty = {
|
programs.kitty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
theme = "Catppuccin-Mocha"; # kitty has catppuccin theme built-in
|
# kitty has catppuccin theme built-in,
|
||||||
|
# all the built-in themes are packaged into an extra package named `kitty-themes`
|
||||||
|
# and it's installed by home-manager if `theme` is specified.
|
||||||
|
theme = "Catppuccin-Mocha";
|
||||||
font = {
|
font = {
|
||||||
name = "JetBrainsMono Nerd Font";
|
name = "JetBrainsMono Nerd Font";
|
||||||
# use different font size on macOS
|
# use different font size on macOS
|
||||||
@@ -37,23 +43,24 @@
|
|||||||
else 13;
|
else 13;
|
||||||
};
|
};
|
||||||
|
|
||||||
settings =
|
keybindings = {
|
||||||
{
|
"ctrl+shift+m" = "toggle_maximized";
|
||||||
background_opacity = "0.95";
|
};
|
||||||
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
|
||||||
scrollback_lines = 10000;
|
settings = {
|
||||||
enable_audio_bell = false;
|
background_opacity = "0.93";
|
||||||
}
|
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
||||||
// (
|
scrollback_lines = 10000;
|
||||||
if pkgs.stdenv.isDarwin
|
enable_audio_bell = false;
|
||||||
then {
|
tab_bar_edge = "top"; # tab bar on top
|
||||||
# macOS specific settings, force kitty to use nushell as default shell
|
# To resolve issues:
|
||||||
shell = "/run/current-system/sw/bin/nu";
|
# 1. https://github.com/ryan4yin/nix-config/issues/26
|
||||||
}
|
# 2. https://github.com/ryan4yin/nix-config/issues/8
|
||||||
else {}
|
# Spawn a nushell in login mode via `bash`
|
||||||
);
|
shell = "${pkgs.bash}/bin/bash --login -c 'nu --login --interactive'";
|
||||||
|
};
|
||||||
|
|
||||||
# macOS specific settings
|
# macOS specific settings
|
||||||
darwinLaunchOptions = ["--start-as=fullscreen"];
|
darwinLaunchOptions = ["--start-as=maximized"];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
{pkgs, ...}:
|
||||||
|
###########################################################
|
||||||
|
#
|
||||||
|
# Wezterm Configuration
|
||||||
|
#
|
||||||
|
# Default Keybindings: https://wezfurlong.org/wezterm/config/default-keys.html
|
||||||
|
#
|
||||||
|
###########################################################
|
||||||
|
{
|
||||||
|
# wezterm has catppuccin theme built-in,
|
||||||
|
# it's not necessary to install it separately.
|
||||||
|
|
||||||
|
# we can add wezterm as a flake input once this PR is merged:
|
||||||
|
# https://github.com/wez/wezterm/pull/3547
|
||||||
|
|
||||||
|
programs.wezterm =
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# TODO: Fix: https://github.com/wez/wezterm/issues/4483
|
||||||
|
# package = pkgs.wezterm.override { };
|
||||||
|
|
||||||
|
extraConfig = let
|
||||||
|
fontsize =
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then "14.0"
|
||||||
|
else "13.0";
|
||||||
|
in ''
|
||||||
|
-- Pull in the wezterm API
|
||||||
|
local wezterm = require 'wezterm'
|
||||||
|
|
||||||
|
-- This table will hold the configuration.
|
||||||
|
local config = {}
|
||||||
|
|
||||||
|
-- In newer versions of wezterm, use the config_builder which will
|
||||||
|
-- help provide clearer error messages
|
||||||
|
if wezterm.config_builder then
|
||||||
|
config = wezterm.config_builder()
|
||||||
|
end
|
||||||
|
|
||||||
|
wezterm.on('toggle-opacity', function(window, pane)
|
||||||
|
local overrides = window:get_config_overrides() or {}
|
||||||
|
if not overrides.window_background_opacity then
|
||||||
|
overrides.window_background_opacity = 0.93
|
||||||
|
else
|
||||||
|
overrides.window_background_opacity = nil
|
||||||
|
end
|
||||||
|
window:set_config_overrides(overrides)
|
||||||
|
end)
|
||||||
|
|
||||||
|
wezterm.on('toggle-maximize', function(window, pane)
|
||||||
|
window:maximize()
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- This is where you actually apply your config choices
|
||||||
|
config.color_scheme = "Catppuccin Mocha"
|
||||||
|
config.font = wezterm.font_with_fallback {
|
||||||
|
"JetBrainsMono Nerd Font",
|
||||||
|
"FiraCode Nerd Font",
|
||||||
|
|
||||||
|
-- To avoid 'Chinese characters displayed as variant (Japanese) glyphs'
|
||||||
|
"Source Han Sans SC",
|
||||||
|
"Source Han Sans TC"
|
||||||
|
}
|
||||||
|
|
||||||
|
config.hide_tab_bar_if_only_one_tab = true
|
||||||
|
config.scrollback_lines = 10000
|
||||||
|
config.enable_scroll_bar = true
|
||||||
|
|
||||||
|
config.keys = {
|
||||||
|
-- toggle opacity(CTRL + SHIFT + B)
|
||||||
|
{
|
||||||
|
key = 'B',
|
||||||
|
mods = 'CTRL',
|
||||||
|
action = wezterm.action.EmitEvent 'toggle-opacity',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key = 'M',
|
||||||
|
mods = 'CTRL',
|
||||||
|
action = wezterm.action.EmitEvent 'toggle-maximize',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
config.font_size = ${fontsize}
|
||||||
|
|
||||||
|
-- To resolve issues:
|
||||||
|
-- 1. https://github.com/ryan4yin/nix-config/issues/26
|
||||||
|
-- 2. https://github.com/ryan4yin/nix-config/issues/8
|
||||||
|
-- Spawn a nushell in login mode via `bash`
|
||||||
|
config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' }
|
||||||
|
|
||||||
|
return config
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
// (
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then {
|
||||||
|
# install wezterm via homebrew on macOS to avoid compilation, dummy package here.
|
||||||
|
package = pkgs.hello;
|
||||||
|
enableBashIntegration = false;
|
||||||
|
enableZshIntegration = false;
|
||||||
|
}
|
||||||
|
else {}
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{pkgs-unstable, ...}: {
|
||||||
|
# terminal file manager
|
||||||
|
programs.yazi = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs-unstable.yazi;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
# TODO: nushellIntegration is broken on release-23.11, wait for master's fix to be released
|
||||||
|
enableNushellIntegration = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
{...}: {
|
|
||||||
programs.bash = {
|
|
||||||
enable = true;
|
|
||||||
enableCompletion = true;
|
|
||||||
bashrcExtra = ''
|
|
||||||
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
|
||||||
'';
|
|
||||||
|
|
||||||
shellAliases = {
|
|
||||||
k = "kubectl";
|
|
||||||
|
|
||||||
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
|
||||||
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,21 @@
|
|||||||
{ catppuccin-bat, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
# a cat(1) clone with syntax highlighting and Git integration.
|
# a cat(1) clone with syntax highlighting and Git integration.
|
||||||
programs.bat = {
|
programs.bat = {
|
||||||
enable = true;
|
enable = true;
|
||||||
config = {
|
config = {
|
||||||
pager = "less -FR";
|
pager = "less -FR";
|
||||||
theme = "Catppuccin-mocha";
|
theme = "catppuccin-mocha";
|
||||||
};
|
};
|
||||||
themes = {
|
themes = {
|
||||||
# https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme
|
# https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme
|
||||||
Catppuccin-mocha = builtins.readFile "${catppuccin-bat}/Catppuccin-mocha.tmTheme";
|
catppuccin-mocha = {
|
||||||
|
src = nur-ryan4yin.packages.${pkgs.system}.catppuccin-bat;
|
||||||
|
file = "Catppuccin-mocha.tmTheme";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# https://github.com/catppuccin/btop/blob/main/themes/catppuccin_mocha.theme
|
||||||
|
xdg.configFile."btop/themes".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-btop}/themes";
|
||||||
|
|
||||||
|
# replacement of htop/nmon
|
||||||
|
programs.btop = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
color_theme = "catppuccin_mocha";
|
||||||
|
theme_background = false; # make btop transparent
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
+18
-17
@@ -9,11 +9,6 @@
|
|||||||
unzip
|
unzip
|
||||||
p7zip
|
p7zip
|
||||||
|
|
||||||
# utils
|
|
||||||
ripgrep # recursively searches directories for a regex pattern
|
|
||||||
jq # A lightweight and flexible command-line JSON processor
|
|
||||||
yq-go # yaml processer https://github.com/mikefarah/yq
|
|
||||||
|
|
||||||
# networking tools
|
# networking tools
|
||||||
mtr # A network diagnostic tool
|
mtr # A network diagnostic tool
|
||||||
iperf3
|
iperf3
|
||||||
@@ -24,14 +19,27 @@
|
|||||||
nmap # A utility for network discovery and security auditing
|
nmap # A utility for network discovery and security auditing
|
||||||
ipcalc # it is a calculator for the IPv4/v6 addresses
|
ipcalc # it is a calculator for the IPv4/v6 addresses
|
||||||
|
|
||||||
|
# Text Processing
|
||||||
|
# Docs: https://github.com/learnbyexample/Command-line-text-processing
|
||||||
|
gnugrep # GNU grep, provides `grep`/`egrep`/`fgrep`
|
||||||
|
gnused # GNU sed, very powerful(mainly for replacing text in files)
|
||||||
|
gawk # GNU awk, a pattern scanning and processing language
|
||||||
|
ripgrep # recursively searches directories for a regex pattern
|
||||||
|
sad # CLI search and replace, with diff preview, really useful!!!
|
||||||
|
delta # A viewer for git and diff output
|
||||||
|
# A fast and polyglot tool for code searching, linting, rewriting at large scale
|
||||||
|
# supported languages: only some mainstream languages currently(do not support nix/nginx/yaml/toml/...)
|
||||||
|
ast-grep
|
||||||
|
jq # A lightweight and flexible command-line JSON processor
|
||||||
|
yq-go # yaml processer https://github.com/mikefarah/yq
|
||||||
|
|
||||||
# misc
|
# misc
|
||||||
|
tldr
|
||||||
cowsay
|
cowsay
|
||||||
file
|
file
|
||||||
which
|
which
|
||||||
tree
|
tree
|
||||||
gnused
|
|
||||||
gnutar
|
gnutar
|
||||||
gawk
|
|
||||||
zstd
|
zstd
|
||||||
caddy
|
caddy
|
||||||
gnupg
|
gnupg
|
||||||
@@ -49,18 +57,11 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
# modern vim
|
|
||||||
neovim = {
|
|
||||||
enable = true;
|
|
||||||
defaultEditor = true;
|
|
||||||
vimAlias = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# A modern replacement for ‘ls’
|
# A modern replacement for ‘ls’
|
||||||
# useful in bash/zsh prompt, not in nushell.
|
# useful in bash/zsh prompt, not in nushell.
|
||||||
exa = {
|
eza = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableAliases = true;
|
enableAliases = false; # do not enable aliases in nushell!
|
||||||
git = true;
|
git = true;
|
||||||
icons = true;
|
icons = true;
|
||||||
};
|
};
|
||||||
@@ -71,7 +72,7 @@
|
|||||||
# https://github.com/catppuccin/fzf
|
# https://github.com/catppuccin/fzf
|
||||||
# catppuccin-mocha
|
# catppuccin-mocha
|
||||||
colors = {
|
colors = {
|
||||||
"bg+" = "#313244";
|
"bg+" = "#313244";
|
||||||
"bg" = "#1e1e2e";
|
"bg" = "#1e1e2e";
|
||||||
"spinner" = "#f5e0dc";
|
"spinner" = "#f5e0dc";
|
||||||
"hl" = "#f38ba8";
|
"hl" = "#f38ba8";
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
imports = [
|
imports = [
|
||||||
./nushell
|
./shells
|
||||||
./tmux
|
./tmux
|
||||||
./zellij
|
./zellij
|
||||||
|
|
||||||
./bash.nix
|
|
||||||
./bat.nix
|
./bat.nix
|
||||||
|
./btop.nix
|
||||||
./core.nix
|
./core.nix
|
||||||
./git.nix
|
./git.nix
|
||||||
./starship.nix
|
./starship.nix
|
||||||
|
|||||||
+32
-14
@@ -2,7 +2,6 @@
|
|||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
|
||||||
userfullname,
|
userfullname,
|
||||||
useremail,
|
useremail,
|
||||||
...
|
...
|
||||||
@@ -12,9 +11,12 @@
|
|||||||
#
|
#
|
||||||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
|
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
|
||||||
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
||||||
rm -f ~/.gitconfig
|
rm -f ${config.home.homeDirectory}/.gitconfig
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
];
|
||||||
|
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
lfs.enable = true;
|
lfs.enable = true;
|
||||||
@@ -37,15 +39,15 @@
|
|||||||
|
|
||||||
# replace https with ssh
|
# replace https with ssh
|
||||||
url = {
|
url = {
|
||||||
"ssh://git@github.com/" = {
|
"ssh://git@github.com/ryan4yin" = {
|
||||||
insteadOf = "https://github.com/";
|
insteadOf = "https://github.com/ryan4yin";
|
||||||
};
|
|
||||||
"ssh://git@gitlab.com/" = {
|
|
||||||
insteadOf = "https://gitlab.com/";
|
|
||||||
};
|
|
||||||
"ssh://git@bitbucket.com/" = {
|
|
||||||
insteadOf = "https://bitbucket.com/";
|
|
||||||
};
|
};
|
||||||
|
# "ssh://git@gitlab.com/" = {
|
||||||
|
# insteadOf = "https://gitlab.com/";
|
||||||
|
# };
|
||||||
|
# "ssh://git@bitbucket.com/" = {
|
||||||
|
# insteadOf = "https://bitbucket.com/";
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,10 +56,15 @@
|
|||||||
# signByDefault = true;
|
# signByDefault = true;
|
||||||
# };
|
# };
|
||||||
|
|
||||||
|
# A syntax-highlighting pager in Rust(2019 ~ Now)
|
||||||
delta = {
|
delta = {
|
||||||
enable = true;
|
enable = true;
|
||||||
options = {
|
options = {
|
||||||
features = "side-by-side";
|
diff-so-fancy = true;
|
||||||
|
line-numbers = true;
|
||||||
|
true-color = "always";
|
||||||
|
# features => named groups of settings, used to keep related settings organized
|
||||||
|
# features = "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -68,10 +75,21 @@
|
|||||||
st = "status";
|
st = "status";
|
||||||
ls = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate";
|
ls = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate";
|
||||||
ll = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --numstat";
|
ll = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --numstat";
|
||||||
cm = "commit -m";
|
cm = "commit -m"; # commit via `git cm <message>`
|
||||||
ca = "commit -am";
|
ca = "commit -am"; # commit all changes via `git ca <message>`
|
||||||
dc = "diff --cached";
|
dc = "diff --cached";
|
||||||
amend = "commit --amend -m";
|
|
||||||
|
amend = "commit --amend -m"; # amend commit message via `git amend <message>`
|
||||||
|
unstage = "reset HEAD --"; # unstage file via `git unstage <file>`
|
||||||
|
merged = "branch --merged"; # list merged(into HEAD) branches via `git merged`
|
||||||
|
unmerged = "branch --no-merged"; # list unmerged(into HEAD) branches via `git unmerged`
|
||||||
|
nonexist = "remote prune origin --dry-run"; # list non-exist(remote) branches via `git nonexist`
|
||||||
|
|
||||||
|
# delete merged branches except master & dev & staging
|
||||||
|
# `!` indicates it's a shell script, not a git subcommand
|
||||||
|
delmerged = ''! git branch --merged | egrep -v "(^\*|main|master|dev|staging)" | xargs git branch -d'';
|
||||||
|
# delete non-exist(remote) branches
|
||||||
|
delnonexist = "remote prune origin";
|
||||||
|
|
||||||
# aliases for submodule
|
# aliases for submodule
|
||||||
update = "submodule update --init --recursive";
|
update = "submodule update --init --recursive";
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
{ config, ...}: {
|
|
||||||
programs.nushell = {
|
|
||||||
enable = true;
|
|
||||||
configFile.source = ./config.nu;
|
|
||||||
|
|
||||||
extraConfig = ''
|
|
||||||
let-env PATH = ([
|
|
||||||
"${config.home.homeDirectory}/bin"
|
|
||||||
"${config.home.homeDirectory}/.local/bin"
|
|
||||||
"${config.home.homeDirectory}/go/bin"
|
|
||||||
|
|
||||||
($env.PATH | split row (char esep))
|
|
||||||
] | flatten)
|
|
||||||
'';
|
|
||||||
|
|
||||||
# home-manager will merge the cotent in `environmentVariables` with the `envFile.source`
|
|
||||||
# but basically, I set all environment variables via the shell-independent way, so I don't need to use those two options
|
|
||||||
#
|
|
||||||
# envFile.source = ./env.nu;
|
|
||||||
# environmentVariables = { FOO="bar"; };
|
|
||||||
|
|
||||||
shellAliases = {
|
|
||||||
k = "kubectl";
|
|
||||||
|
|
||||||
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
|
||||||
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -71,7 +71,7 @@ let catppuccin_theme = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# The default config record. This is where much of your global configuration is setup.
|
# The default config record. This is where much of your global configuration is setup.
|
||||||
let-env config = {
|
$env.config = {
|
||||||
color_config: $catppuccin_theme # <-- this is the theme
|
color_config: $catppuccin_theme # <-- this is the theme
|
||||||
use_ansi_coloring: true
|
use_ansi_coloring: true
|
||||||
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
let
|
||||||
|
shellAliases = {
|
||||||
|
k = "kubectl";
|
||||||
|
|
||||||
|
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
||||||
|
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
# only works in bash/zsh, not nushell
|
||||||
|
home.shellAliases = shellAliases;
|
||||||
|
|
||||||
|
programs.nushell = {
|
||||||
|
enable = true;
|
||||||
|
configFile.source = ./config.nu;
|
||||||
|
shellAliases = shellAliases;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.bash = {
|
||||||
|
enable = true;
|
||||||
|
enableCompletion = true;
|
||||||
|
bashrcExtra = ''
|
||||||
|
export PATH="$HOME/.local/bin:$HOME/go/bin:$PATH"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
{ catppuccin-starship, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
programs.starship = {
|
programs.starship = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
@@ -6,22 +10,24 @@
|
|||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
enableNushellIntegration = true;
|
enableNushellIntegration = true;
|
||||||
|
|
||||||
settings = {
|
settings =
|
||||||
character = {
|
{
|
||||||
success_symbol = "[›](bold green)";
|
character = {
|
||||||
error_symbol = "[›](bold red)";
|
success_symbol = "[›](bold green)";
|
||||||
};
|
error_symbol = "[›](bold red)";
|
||||||
aws = {
|
};
|
||||||
symbol = "🅰 ";
|
aws = {
|
||||||
};
|
symbol = "🅰 ";
|
||||||
gcloud = {
|
};
|
||||||
# do not show the account/project's info
|
gcloud = {
|
||||||
# to avoid the leak of sensitive information when sharing the terminal
|
# do not show the account/project's info
|
||||||
format = "on [$symbol$active(\($region\))]($style) ";
|
# to avoid the leak of sensitive information when sharing the terminal
|
||||||
symbol = "🅶 ️";
|
format = "on [$symbol$active(\($region\))]($style) ";
|
||||||
};
|
symbol = "🅶 ️";
|
||||||
|
};
|
||||||
|
|
||||||
palette = "catppuccin_mocha";
|
palette = "catppuccin_mocha";
|
||||||
} // builtins.fromTOML (builtins.readFile "${catppuccin-starship}/palettes/mocha.toml");
|
}
|
||||||
|
// builtins.fromTOML (builtins.readFile "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-starship}/palettes/mocha.toml");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
{pkgs, ...}: let
|
|
||||||
buildTmuxPlugin = pkgs.tmuxPlugins.mkTmuxPlugin;
|
|
||||||
in {
|
|
||||||
draculaTheme = buildTmuxPlugin {
|
|
||||||
pluginName = "dracula";
|
|
||||||
version = "v2.2.0";
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
name = "dracula-tmux-v2.2.0";
|
|
||||||
url = "https://github.com/dracula/tmux/archive/refs/tags/v2.2.0.tar.gz";
|
|
||||||
sha256 = "sha256:0v2k994yy4xx2iw8qxg7qphw46gq2qmg496i3a3h9b6jgwxqm7zn";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
{
|
{pkgs, ...}: {
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
plugins = pkgs.tmuxPlugins // pkgs.callPackage ./custom-plugins.nix {};
|
|
||||||
in {
|
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
shell = "${pkgs.nushell}/bin/nu";
|
shell = "${pkgs.nushell}/bin/nu";
|
||||||
@@ -17,26 +11,33 @@ in {
|
|||||||
# tmux-sensible overwrites default tmux shortcuts, makes them more sane.
|
# tmux-sensible overwrites default tmux shortcuts, makes them more sane.
|
||||||
sensibleOnTop = true;
|
sensibleOnTop = true;
|
||||||
|
|
||||||
# extraConfig = builtins.readFile ./tmux.conf;
|
# https://github.com/sxyazi/yazi/wiki/Image-preview-within-tmux
|
||||||
|
extraConfig = ''
|
||||||
|
set -g allow-passthrough on
|
||||||
|
|
||||||
|
set -ga update-environment TERM
|
||||||
|
set -ga update-environment TERM_PROGRAM
|
||||||
|
'';
|
||||||
# keyMode = "vi"; # default is emacs
|
# keyMode = "vi"; # default is emacs
|
||||||
|
|
||||||
baseIndex = 1; # start index from 1
|
baseIndex = 1; # start index from 1
|
||||||
escapeTime = 0; # do not wait for escape key
|
escapeTime = 0; # do not wait for escape key
|
||||||
terminal = "xterm-256color";
|
|
||||||
|
|
||||||
plugins = with plugins; [
|
plugins = with pkgs.tmuxPlugins; [
|
||||||
draculaTheme # theme
|
|
||||||
{
|
{
|
||||||
# https://github.com/tmux-plugins/tmux-continuum
|
# theme
|
||||||
# Continuous saving of tmux environment. Automatic restore when tmux is started.
|
# https://github.com/catppuccin/tmux
|
||||||
plugin = continuum;
|
plugin = catppuccin;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
set -g @continuum-save-interval '15'
|
set -g @catppuccin_flavour 'mocha' # or frappe, macchiato, mocha
|
||||||
|
set -g @catppuccin_window_status_enable "yes"
|
||||||
# Option to display current status of tmux continuum in tmux status line.
|
|
||||||
set -g status-right 'Continuum status: #{continuum_status}'
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# https://github.com/tmux-plugins/tmux-yank
|
||||||
|
# Enables copying to system clipboard.
|
||||||
|
yank
|
||||||
|
|
||||||
{
|
{
|
||||||
# https://github.com/tmux-plugins/tmux-resurrect
|
# https://github.com/tmux-plugins/tmux-resurrect
|
||||||
# Manually persists tmux environment across system restarts.
|
# Manually persists tmux environment across system restarts.
|
||||||
@@ -47,11 +48,7 @@ in {
|
|||||||
# Restore Neovim sessions
|
# Restore Neovim sessions
|
||||||
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
# https://github.com/tmux-plugins/tmux-yank
|
|
||||||
# Enables copying to system clipboard.
|
|
||||||
plugin = yank;
|
|
||||||
}
|
|
||||||
# set -g @plugin 'tmux-plugins/tmux-cpu'
|
# set -g @plugin 'tmux-plugins/tmux-cpu'
|
||||||
{
|
{
|
||||||
plugin = cpu;
|
plugin = cpu;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{...}: {
|
_: {
|
||||||
programs.zellij = {
|
programs.zellij = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".config/zellij/config.kdl".source = ./config.kdl;
|
xdg.configFile."zellij/config.kdl".source = ./config.kdl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,10 +40,5 @@
|
|||||||
# required to prevent sending default identity files first.
|
# required to prevent sending default identity files first.
|
||||||
IdentitiesOnly yes
|
IdentitiesOnly yes
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# use ssh-agent so we only need to input passphrase once
|
|
||||||
# run `ssh-add /path/to/key` for every identity file
|
|
||||||
# check imported keys by `ssh-add -l`
|
|
||||||
# TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login.
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
{ username, ... }: {
|
{username, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
../base/desktop
|
../base/desktop
|
||||||
|
|
||||||
|
./proxychains
|
||||||
./core.nix
|
./core.nix
|
||||||
./nushell.nix
|
|
||||||
./rime-squirrel.nix
|
./rime-squirrel.nix
|
||||||
|
./shell.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Home Manager needs a bit of information about you and the
|
# Home Manager needs a bit of information about you and the
|
||||||
# paths it should manage.
|
# paths it should manage.
|
||||||
home = {
|
home = {
|
||||||
username = username;
|
inherit username;
|
||||||
# set homeDirectory make build fail
|
# set homeDirectory make build fail
|
||||||
homeDirectory = "/Users/${username}";
|
homeDirectory = "/Users/${username}";
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@
|
|||||||
# You can update Home Manager without changing this value. See
|
# You can update Home Manager without changing this value. See
|
||||||
# the Home Manager release notes for a list of state version
|
# the Home Manager release notes for a list of state version
|
||||||
# changes in each release.
|
# changes in each release.
|
||||||
stateVersion = "22.11";
|
stateVersion = "23.11";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
{config, ...}: {
|
|
||||||
# nix-darwin do not set PATH for nushell! so we need to do it manually
|
|
||||||
# this is a workaround to add nix's PATH to nushell
|
|
||||||
programs.nushell.extraConfig = ''
|
|
||||||
let-env PATH = ([
|
|
||||||
"${config.home.homeDirectory}/bin"
|
|
||||||
"${config.home.homeDirectory}/.local/bin"
|
|
||||||
"${config.home.homeDirectory}/go/bin"
|
|
||||||
"/usr/local/bin"
|
|
||||||
"${config.home.homeDirectory}/.nix-profile/bin"
|
|
||||||
"/etc/profiles/per-user/${config.home.username}/bin"
|
|
||||||
"/run/current-system/sw/bin"
|
|
||||||
"/nix/var/nix/profiles/default/bin"
|
|
||||||
|
|
||||||
($env.PATH | split row (char esep))
|
|
||||||
] | flatten)
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
home.file.".proxychains/proxychains.conf".source = ./proxychains.conf;
|
||||||
|
}
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
|
||||||
|
# proxychains.conf VER 4.x
|
||||||
|
#
|
||||||
|
# HTTP, SOCKS4a, SOCKS5 tunneling proxifier with DNS.
|
||||||
|
|
||||||
|
|
||||||
|
# The option below identifies how the ProxyList is treated.
|
||||||
|
# only one option should be uncommented at time,
|
||||||
|
# otherwise the last appearing option will be accepted
|
||||||
|
#
|
||||||
|
#dynamic_chain
|
||||||
|
#
|
||||||
|
# Dynamic - Each connection will be done via chained proxies
|
||||||
|
# all proxies chained in the order as they appear in the list
|
||||||
|
# at least one proxy must be online to play in chain
|
||||||
|
# (dead proxies are skipped)
|
||||||
|
# otherwise EINTR is returned to the app
|
||||||
|
#
|
||||||
|
strict_chain
|
||||||
|
#
|
||||||
|
# Strict - Each connection will be done via chained proxies
|
||||||
|
# all proxies chained in the order as they appear in the list
|
||||||
|
# all proxies must be online to play in chain
|
||||||
|
# otherwise EINTR is returned to the app
|
||||||
|
#
|
||||||
|
#round_robin_chain
|
||||||
|
#
|
||||||
|
# Round Robin - Each connection will be done via chained proxies
|
||||||
|
# of chain_len length
|
||||||
|
# all proxies chained in the order as they appear in the list
|
||||||
|
# at least one proxy must be online to play in chain
|
||||||
|
# (dead proxies are skipped).
|
||||||
|
# the start of the current proxy chain is the proxy after the last
|
||||||
|
# proxy in the previously invoked proxy chain.
|
||||||
|
# if the end of the proxy chain is reached while looking for proxies
|
||||||
|
# start at the beginning again.
|
||||||
|
# otherwise EINTR is returned to the app
|
||||||
|
# These semantics are not guaranteed in a multithreaded environment.
|
||||||
|
#
|
||||||
|
#random_chain
|
||||||
|
#
|
||||||
|
# Random - Each connection will be done via random proxy
|
||||||
|
# (or proxy chain, see chain_len) from the list.
|
||||||
|
# this option is good to test your IDS :)
|
||||||
|
|
||||||
|
# Make sense only if random_chain or round_robin_chain
|
||||||
|
#chain_len = 2
|
||||||
|
|
||||||
|
# Quiet mode (no output from library)
|
||||||
|
#quiet_mode
|
||||||
|
|
||||||
|
## Proxy DNS requests - no leak for DNS data
|
||||||
|
# (disable all of the 3 items below to not proxy your DNS requests)
|
||||||
|
|
||||||
|
# method 1. this uses the proxychains4 style method to do remote dns:
|
||||||
|
# a thread is spawned that serves DNS requests and hands down an ip
|
||||||
|
# assigned from an internal list (via remote_dns_subnet).
|
||||||
|
# this is the easiest (setup-wise) and fastest method, however on
|
||||||
|
# systems with buggy libcs and very complex software like webbrowsers
|
||||||
|
# this might not work and/or cause crashes.
|
||||||
|
proxy_dns
|
||||||
|
|
||||||
|
# method 2. use the old proxyresolv script to proxy DNS requests
|
||||||
|
# in proxychains 3.1 style. requires `proxyresolv` in $PATH
|
||||||
|
# plus a dynamically linked `dig` binary.
|
||||||
|
# this is a lot slower than `proxy_dns`, doesn't support .onion URLs,
|
||||||
|
# but might be more compatible with complex software like webbrowsers.
|
||||||
|
#proxy_dns_old
|
||||||
|
|
||||||
|
# method 3. use proxychains4-daemon process to serve remote DNS requests.
|
||||||
|
# this is similar to the threaded `proxy_dns` method, however it requires
|
||||||
|
# that proxychains4-daemon is already running on the specified address.
|
||||||
|
# on the plus side it doesn't do malloc/threads so it should be quite
|
||||||
|
# compatible with complex, async-unsafe software.
|
||||||
|
# note that if you don't start proxychains4-daemon before using this,
|
||||||
|
# the process will simply hang.
|
||||||
|
#proxy_dns_daemon 127.0.0.1:1053
|
||||||
|
|
||||||
|
# set the class A subnet number to use for the internal remote DNS mapping
|
||||||
|
# we use the reserved 224.x.x.x range by default,
|
||||||
|
# if the proxified app does a DNS request, we will return an IP from that range.
|
||||||
|
# on further accesses to this ip we will send the saved DNS name to the proxy.
|
||||||
|
# in case some control-freak app checks the returned ip, and denies to
|
||||||
|
# connect, you can use another subnet, e.g. 10.x.x.x or 127.x.x.x.
|
||||||
|
# of course you should make sure that the proxified app does not need
|
||||||
|
# *real* access to this subnet.
|
||||||
|
# i.e. dont use the same subnet then in the localnet section
|
||||||
|
#remote_dns_subnet 127
|
||||||
|
#remote_dns_subnet 10
|
||||||
|
remote_dns_subnet 224
|
||||||
|
|
||||||
|
# Some timeouts in milliseconds
|
||||||
|
tcp_read_time_out 15000
|
||||||
|
tcp_connect_time_out 8000
|
||||||
|
|
||||||
|
### Examples for localnet exclusion
|
||||||
|
## localnet ranges will *not* use a proxy to connect.
|
||||||
|
## note that localnet works only when plain IP addresses are passed to the app,
|
||||||
|
## the hostname resolves via /etc/hosts, or proxy_dns is disabled or proxy_dns_old used.
|
||||||
|
|
||||||
|
## Exclude connections to 192.168.1.0/24 with port 80
|
||||||
|
# localnet 192.168.1.0:80/255.255.255.0
|
||||||
|
|
||||||
|
## Exclude connections to 192.168.100.0/24
|
||||||
|
# localnet 192.168.100.0/255.255.255.0
|
||||||
|
|
||||||
|
## Exclude connections to ANYwhere with port 80
|
||||||
|
# localnet 0.0.0.0:80/0.0.0.0
|
||||||
|
# localnet [::]:80/0
|
||||||
|
|
||||||
|
## RFC6890 Loopback address range
|
||||||
|
## if you enable this, you have to make sure remote_dns_subnet is not 127
|
||||||
|
## you'll need to enable it if you want to use an application that
|
||||||
|
## connects to localhost.
|
||||||
|
# localnet 127.0.0.0/255.0.0.0
|
||||||
|
# localnet ::1/128
|
||||||
|
|
||||||
|
## RFC1918 Private Address Ranges
|
||||||
|
# localnet 10.0.0.0/255.0.0.0
|
||||||
|
# localnet 172.16.0.0/255.240.0.0
|
||||||
|
# localnet 192.168.0.0/255.255.0.0
|
||||||
|
|
||||||
|
### Examples for dnat
|
||||||
|
## Trying to proxy connections to destinations which are dnatted,
|
||||||
|
## will result in proxying connections to the new given destinations.
|
||||||
|
## Whenever I connect to 1.1.1.1 on port 1234 actually connect to 1.1.1.2 on port 443
|
||||||
|
# dnat 1.1.1.1:1234 1.1.1.2:443
|
||||||
|
|
||||||
|
## Whenever I connect to 1.1.1.1 on port 443 actually connect to 1.1.1.2 on port 443
|
||||||
|
## (no need to write :443 again)
|
||||||
|
# dnat 1.1.1.2:443 1.1.1.2
|
||||||
|
|
||||||
|
## No matter what port I connect to on 1.1.1.1 port actually connect to 1.1.1.2 on port 443
|
||||||
|
# dnat 1.1.1.1 1.1.1.2:443
|
||||||
|
|
||||||
|
## Always, instead of connecting to 1.1.1.1, connect to 1.1.1.2
|
||||||
|
# dnat 1.1.1.1 1.1.1.2
|
||||||
|
|
||||||
|
# ProxyList format
|
||||||
|
# type ip port [user pass]
|
||||||
|
# (values separated by 'tab' or 'blank')
|
||||||
|
#
|
||||||
|
# only numeric ipv4 addresses are valid
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
#
|
||||||
|
# socks5 192.168.67.78 1080 lamer secret
|
||||||
|
# http 192.168.89.3 8080 justu hidden
|
||||||
|
# socks4 192.168.1.49 1080
|
||||||
|
# http 192.168.39.93 8080
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# proxy types: http, socks4, socks5, raw
|
||||||
|
# * raw: The traffic is simply forwarded to the proxy without modification.
|
||||||
|
# ( auth types supported: "basic"-http "user/pass"-socks )
|
||||||
|
#
|
||||||
|
[ProxyList]
|
||||||
|
# add proxy here ...
|
||||||
|
# set to clash's http/socks5 port
|
||||||
|
socks5 127.0.0.1 7890
|
||||||
@@ -1,17 +1,11 @@
|
|||||||
{
|
{pkgs, ...}: {
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
# remove existing rime data (squirrel)
|
|
||||||
home.activation.removeExistingRimeData = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
|
||||||
rm -rf "~/Library/Rime/build/flypy.prism.bin"
|
|
||||||
'';
|
|
||||||
|
|
||||||
# Squirrel Input Method
|
# Squirrel Input Method
|
||||||
home.file."Library/Rime" = {
|
home.file."Library/Rime" = {
|
||||||
# my custom squirrel data (flypy input method)
|
# my custom squirrel data (flypy input method)
|
||||||
source = "${pkgs.flypy-squirrel}/share/rime-data";
|
source = "${pkgs.flypy-squirrel}/share/rime-data";
|
||||||
recursive = true;
|
recursive = true;
|
||||||
|
# overwrite possible existing data dynamically generated by squirrel
|
||||||
|
# https://github.com/nix-community/home-manager/blob/release-23.05/modules/lib/file-type.nix#L101-L111
|
||||||
|
force = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
_: {
|
||||||
|
# Homebrew's default install location:
|
||||||
|
# /opt/homebrew for Apple Silicon
|
||||||
|
# /usr/local for macOS Intel
|
||||||
|
# The prefix /opt/homebrew was chosen to allow installations
|
||||||
|
# in /opt/homebrew for Apple Silicon and /usr/local for Rosetta 2 to coexist and use bottles.
|
||||||
|
programs.bash.bashrcExtra = ''
|
||||||
|
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||||
|
'';
|
||||||
|
programs.zsh.envExtra = ''
|
||||||
|
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
{ catppuccin-btop, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
# https://github.com/catppuccin/btop/blob/main/themes/catppuccin_mocha.theme
|
|
||||||
home.file.".config/btop/themes".source = "${catppuccin-btop}/themes";
|
|
||||||
|
|
||||||
# replacement of htop/nmon
|
|
||||||
programs.btop = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
color_theme = "catppuccin_mocha";
|
|
||||||
theme_background = false; # make btop transparent
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./btop.nix
|
|
||||||
./shell.nix
|
./shell.nix
|
||||||
./system-tools.nix
|
./system-tools.nix
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
{config, nushell-scripts, ...}: let
|
{
|
||||||
|
config,
|
||||||
|
nushell-scripts,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
d = config.xdg.dataHome;
|
d = config.xdg.dataHome;
|
||||||
c = config.xdg.configHome;
|
c = config.xdg.configHome;
|
||||||
cache = config.xdg.cacheHome;
|
cache = config.xdg.cacheHome;
|
||||||
@@ -17,7 +21,6 @@ in rec {
|
|||||||
|
|
||||||
# set default applications
|
# set default applications
|
||||||
BROWSER = "firefox";
|
BROWSER = "firefox";
|
||||||
TERM = "xterm-256color";
|
|
||||||
|
|
||||||
# enable scrolling in git diff
|
# enable scrolling in git diff
|
||||||
DELTA_PAGER = "less -R";
|
DELTA_PAGER = "less -R";
|
||||||
|
|||||||
@@ -9,14 +9,11 @@
|
|||||||
libnotify
|
libnotify
|
||||||
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
||||||
|
|
||||||
# need to run `conda-install` before using it
|
|
||||||
# need to run `conda-shell` before using command `conda`
|
|
||||||
# conda is not available for MacOS
|
|
||||||
conda
|
|
||||||
|
|
||||||
# system call monitoring
|
# system call monitoring
|
||||||
strace # system call monitoring
|
strace # system call monitoring
|
||||||
ltrace # library call monitoring
|
ltrace # library call monitoring
|
||||||
|
bpftrace # powerful tracing tool
|
||||||
|
tcpdump # network sniffer
|
||||||
lsof # list open files
|
lsof # list open files
|
||||||
|
|
||||||
# system tools
|
# system tools
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ username, ... }: {
|
{username, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
../base/desktop
|
../base/desktop
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
# Home Manager needs a bit of information about you and the
|
# Home Manager needs a bit of information about you and the
|
||||||
# paths it should manage.
|
# paths it should manage.
|
||||||
home = {
|
home = {
|
||||||
username = username;
|
inherit username;
|
||||||
homeDirectory = "/home/${username}";
|
homeDirectory = "/home/${username}";
|
||||||
|
|
||||||
# This value determines the Home Manager release that your
|
# This value determines the Home Manager release that your
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
# You can update Home Manager without changing this value. See
|
# You can update Home Manager without changing this value. See
|
||||||
# the Home Manager release notes for a list of state version
|
# the Home Manager release notes for a list of state version
|
||||||
# changes in each release.
|
# changes in each release.
|
||||||
stateVersion = "22.11";
|
stateVersion = "23.11";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ username, ... }: {
|
{username, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
../base/desktop
|
../base/desktop
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
# Home Manager needs a bit of information about you and the
|
# Home Manager needs a bit of information about you and the
|
||||||
# paths it should manage.
|
# paths it should manage.
|
||||||
home = {
|
home = {
|
||||||
username = username;
|
inherit username;
|
||||||
homeDirectory = "/home/${username}";
|
homeDirectory = "/home/${username}";
|
||||||
|
|
||||||
# This value determines the Home Manager release that your
|
# This value determines the Home Manager release that your
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
# You can update Home Manager without changing this value. See
|
# You can update Home Manager without changing this value. See
|
||||||
# the Home Manager release notes for a list of state version
|
# the Home Manager release notes for a list of state version
|
||||||
# changes in each release.
|
# changes in each release.
|
||||||
stateVersion = "22.11";
|
stateVersion = "23.11";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
|
|||||||
@@ -1,15 +1,28 @@
|
|||||||
{pkgs, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
pkgs-unstable,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# creative
|
# creative
|
||||||
# blender # 3d modeling
|
blender # 3d modeling
|
||||||
# gimp # image editing, I prefer using figma in browser instead of this one
|
# gimp # image editing, I prefer using figma in browser instead of this one
|
||||||
inkscape # vector graphics
|
inkscape # vector graphics
|
||||||
krita # digital painting
|
krita # digital painting
|
||||||
musescore # music notation
|
musescore # music notation
|
||||||
reaper # audio production
|
# reaper # audio production
|
||||||
|
pkgs-unstable.sonic-pi # music programming
|
||||||
|
|
||||||
# this app consumes a lot of storage, so do not install it currently
|
# this app consumes a lot of storage, so do not install it currently
|
||||||
# kicad # 3d printing, eletrical engineering
|
# kicad # 3d printing, eletrical engineering
|
||||||
|
|
||||||
|
# fpga
|
||||||
|
pkgs-unstable.python311Packages.apycula # gowin fpga
|
||||||
|
pkgs-unstable.yosys # fpga synthesis
|
||||||
|
pkgs-unstable.nextpnr # fpga place and route
|
||||||
|
pkgs-unstable.openfpgaloader # fpga programming
|
||||||
|
nur-ryan4yin.packages.${pkgs.system}.gowin-eda-edu-ide # app: `gowin-env` => `gw_ide` / `gw_pack` / ...
|
||||||
];
|
];
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
./creative.nix
|
./creative.nix
|
||||||
|
./gtk.nix
|
||||||
./immutable-file.nix
|
./immutable-file.nix
|
||||||
./media.nix
|
./media.nix
|
||||||
./ssh.nix
|
./ssh.nix
|
||||||
./wallpaper.nix
|
./wallpaper.nix
|
||||||
./xdg.nix
|
./xdg.nix
|
||||||
|
./eye-protection.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# GUI apps
|
# GUI apps
|
||||||
insomnia # REST client
|
|
||||||
wireshark # network analyzer
|
|
||||||
|
|
||||||
# e-book viewer(.epub/.mobi/...)
|
# e-book viewer(.epub/.mobi/...)
|
||||||
# do not support .pdf
|
# do not support .pdf
|
||||||
foliate
|
foliate
|
||||||
@@ -28,6 +27,7 @@
|
|||||||
|
|
||||||
# misc
|
# misc
|
||||||
flameshot
|
flameshot
|
||||||
|
ventoy # multi-boot usb creator
|
||||||
];
|
];
|
||||||
|
|
||||||
# GitHub CLI tool
|
# GitHub CLI tool
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# Adjust the color temperature(& brightness) of your screen according to
|
||||||
|
# your surroundings. This may help your eyes hurt less if you are
|
||||||
|
# working in front of the screen at night.
|
||||||
|
#
|
||||||
|
# works fine with both x11 & wayland(hyprland)
|
||||||
|
#
|
||||||
|
# https://gitlab.com/chinstrap/gammastep
|
||||||
|
services.gammastep = {
|
||||||
|
enable = true;
|
||||||
|
# add a gammastep icon in the system tray
|
||||||
|
# has problem with wayland, so disable it
|
||||||
|
tray = false;
|
||||||
|
temperature = {
|
||||||
|
day = 5700;
|
||||||
|
night = 4000;
|
||||||
|
};
|
||||||
|
# https://gitlab.com/chinstrap/gammastep/-/blob/master/gammastep.conf.sample?ref_type=heads
|
||||||
|
settings = {
|
||||||
|
general = {
|
||||||
|
fade = "1"; # gradually apply the new screen temperature/brightness over a couple of seconds.
|
||||||
|
# it is a fake brightness adjustment obtained by manipulating the gamma ramps,
|
||||||
|
# which means that it does not reduce the backlight of the screen.
|
||||||
|
# Preferably only use it if your normal backlight adjustment is too coarse-grained.
|
||||||
|
brightness-day = "1.0";
|
||||||
|
brightness-night = "0.8";
|
||||||
|
location-provider = "manual";
|
||||||
|
|
||||||
|
# by default, Redshift will use the current elevation of the sun
|
||||||
|
# to determine whether it is daytime, night or in transition (dawn/dusk).
|
||||||
|
# dawn-time = "6:00-8:45";
|
||||||
|
# dusk-time = "18:35-20:15";
|
||||||
|
};
|
||||||
|
manual = {
|
||||||
|
# China, Shenzhen
|
||||||
|
lat = "22.5"; # latitude
|
||||||
|
lon = "114.1"; # longitude
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# If your themes for mouse cursor, icons or windows don’t load correctly,
|
||||||
|
# try setting them with home.pointerCursor and gtk.theme,
|
||||||
|
# which enable a bunch of compatibility options that should make the themes load in all situations.
|
||||||
|
|
||||||
|
home.pointerCursor = {
|
||||||
|
gtk.enable = true;
|
||||||
|
x11.enable = true;
|
||||||
|
package = pkgs.bibata-cursors;
|
||||||
|
name = "Bibata-Modern-Classic";
|
||||||
|
size = 24;
|
||||||
|
};
|
||||||
|
|
||||||
|
# set dpi for 4k monitor
|
||||||
|
xresources.properties = {
|
||||||
|
# dpi for Xorg's font
|
||||||
|
"Xft.dpi" = 150;
|
||||||
|
# or set a generic dpi
|
||||||
|
"*.dpi" = 150;
|
||||||
|
};
|
||||||
|
|
||||||
|
# gtk's theme settings, generate files:
|
||||||
|
# 1. ~/.gtkrc-2.0
|
||||||
|
# 2. ~/.config/gtk-3.0/settings.ini
|
||||||
|
# 3. ~/.config/gtk-4.0/settings.ini
|
||||||
|
gtk = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
font = {
|
||||||
|
name = "Noto Sans";
|
||||||
|
package = pkgs.noto-fonts;
|
||||||
|
size = 11;
|
||||||
|
};
|
||||||
|
|
||||||
|
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
|
||||||
|
|
||||||
|
iconTheme = {
|
||||||
|
name = "Papirus-Dark";
|
||||||
|
package = pkgs.papirus-icon-theme;
|
||||||
|
};
|
||||||
|
|
||||||
|
theme = {
|
||||||
|
# https://github.com/catppuccin/gtk
|
||||||
|
name = "Catppuccin-Macchiato-Compact-Pink-dark";
|
||||||
|
package = pkgs.catppuccin-gtk.override {
|
||||||
|
# https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix
|
||||||
|
accents = ["pink"];
|
||||||
|
size = "compact";
|
||||||
|
variant = "mocha";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
##############################################################################################
|
##############################################################################################
|
||||||
with lib; let
|
with lib; let
|
||||||
cfg = config.home.immutable-file;
|
cfg = config.home.immutable-file;
|
||||||
immutableFileOpts = {...}: {
|
immutableFileOpts = _: {
|
||||||
options = {
|
options = {
|
||||||
src = mkOption {
|
src = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
catppuccin-cava,
|
pkgs-unstable,
|
||||||
|
nur-ryan4yin,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# media - control and enjoy audio/video
|
# media - control and enjoy audio/video
|
||||||
@@ -23,9 +24,11 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
# https://github.com/catppuccin/cava
|
# https://github.com/catppuccin/cava
|
||||||
home.file.".config/cava/config".text = ''
|
xdg.configFile."cava/config".text =
|
||||||
# custom cava config
|
''
|
||||||
'' + builtins.readFile "${catppuccin-cava}/mocha.cava";
|
# custom cava config
|
||||||
|
''
|
||||||
|
+ builtins.readFile "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-cava}/mocha.cava";
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
mpv = {
|
mpv = {
|
||||||
|
|||||||
@@ -41,11 +41,24 @@
|
|||||||
Host s500plus
|
Host s500plus
|
||||||
HostName 192.168.5.174
|
HostName 192.168.5.174
|
||||||
Port 22
|
Port 22
|
||||||
'';
|
|
||||||
|
|
||||||
# use ssh-agent so we only need to input passphrase once
|
Host k8s-main
|
||||||
# run `ssh-add /path/to/key` for every identity file
|
HostName 192.168.5.181
|
||||||
# check imported keys by `ssh-add -l`
|
ForwardAgent yes
|
||||||
# TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login.
|
IdentityFile ~/.ssh/romantic
|
||||||
|
IdentitiesOnly yes
|
||||||
|
|
||||||
|
Host k8s-data1
|
||||||
|
HostName 192.168.5.182
|
||||||
|
ForwardAgent yes
|
||||||
|
IdentityFile ~/.ssh/romantic
|
||||||
|
IdentitiesOnly yes
|
||||||
|
|
||||||
|
Host k8s-data2
|
||||||
|
HostName 192.168.5.183
|
||||||
|
ForwardAgent yes
|
||||||
|
IdentityFile ~/.ssh/romantic
|
||||||
|
IdentitiesOnly yes
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
{ wallpapers, ... }:
|
{wallpapers, ...}: {
|
||||||
|
|
||||||
{
|
|
||||||
# https://github.com/ryan4yin/wallpapers
|
# https://github.com/ryan4yin/wallpapers
|
||||||
home.file.".config/wallpapers".source = wallpapers;
|
xdg.configFile."wallpapers".source = wallpapers;
|
||||||
home.file.".local/bin/wallpaper_random" = {
|
home.file.".local/bin/wallpaper_random" = {
|
||||||
source = "${wallpapers}/wallpaper_random.py";
|
source = "${wallpapers}/wallpaper_random.py";
|
||||||
executable = true;
|
executable = true;
|
||||||
|
|||||||
@@ -62,10 +62,9 @@
|
|||||||
"image/webp" = ["imv.desktop"];
|
"image/webp" = ["imv.desktop"];
|
||||||
};
|
};
|
||||||
|
|
||||||
associations.removed =
|
associations.removed = {
|
||||||
{
|
# ......
|
||||||
# ......
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
userDirs = {
|
userDirs = {
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
nur-ryan4yin,
|
||||||
lib,
|
|
||||||
catppuccin-fcitx5,
|
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
home.file.".config/fcitx5/profile".source = ./profile;
|
home.file.".local/share/fcitx5/themes".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-fcitx5}/src";
|
||||||
|
|
||||||
# color schema
|
xdg.configFile = {
|
||||||
home.file.".local/share/fcitx5/themes".source = "${catppuccin-fcitx5}/src";
|
"fcitx5/profile" = {
|
||||||
home.file.".config/fcitx5/conf/classicui.conf".source = ./classicui.conf;
|
source = ./profile;
|
||||||
|
# every time fcitx5 switch input method, it will modify ~/.config/fcitx5/profile,
|
||||||
# every time fcitx5 switch input method, it will modify ~/.config/fcitx5/profile file,
|
# so we need to force replace it in every rebuild to avoid file conflict.
|
||||||
# which will override my config managed by home-manager
|
force = true;
|
||||||
# so we need to remove it before everytime we rebuild the config
|
};
|
||||||
home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
"fcitx5/conf/classicui.conf".source = ./classicui.conf;
|
||||||
rm -f "${config.xdg.configHome}/fcitx5/profile"
|
};
|
||||||
'';
|
|
||||||
|
|
||||||
i18n.inputMethod = {
|
i18n.inputMethod = {
|
||||||
enabled = "fcitx5";
|
enabled = "fcitx5";
|
||||||
@@ -30,14 +27,4 @@
|
|||||||
fcitx5-gtk # gtk im module
|
fcitx5-gtk # gtk im module
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.sessionVariables = {
|
|
||||||
# copy from https://github.com/nix-community/home-manager/blob/master/modules/i18n/input-method/fcitx5.nix
|
|
||||||
GLFW_IM_MODULE = "fcitx";
|
|
||||||
GTK_IM_MODULE = "fcitx";
|
|
||||||
QT_IM_MODULE = "fcitx";
|
|
||||||
XMODIFIERS = "@im=fcitx";
|
|
||||||
INPUT_METHOD = "fcitx";
|
|
||||||
IMSETTINGS_MODULE = "fcitx";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
anyrun,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [
|
||||||
|
anyrun.homeManagerModules.default
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.anyrun = {
|
||||||
|
enable = true;
|
||||||
|
config = {
|
||||||
|
plugins = with anyrun.packages.${pkgs.system}; [
|
||||||
|
applications
|
||||||
|
randr
|
||||||
|
rink
|
||||||
|
shell
|
||||||
|
symbols
|
||||||
|
translate
|
||||||
|
];
|
||||||
|
|
||||||
|
width.fraction = 0.3;
|
||||||
|
y.absolute = 15;
|
||||||
|
hidePluginInfo = true;
|
||||||
|
closeOnClick = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# custom css for anyrun, based on catppuccin-mocha
|
||||||
|
extraCss = ''
|
||||||
|
@define-color bg-col rgba(30, 30, 46, 0.7);
|
||||||
|
@define-color bg-col-light rgba(150, 220, 235, 0.7);
|
||||||
|
@define-color border-col rgba(30, 30, 46, 0.7);
|
||||||
|
@define-color selected-col rgba(150, 205, 251, 0.7);
|
||||||
|
@define-color fg-col #D9E0EE;
|
||||||
|
@define-color fg-col2 #F28FAD;
|
||||||
|
|
||||||
|
* {
|
||||||
|
transition: 200ms ease;
|
||||||
|
font-family: "JetBrainsMono Nerd Font";
|
||||||
|
font-size: 1.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#window {
|
||||||
|
background: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
#plugin,
|
||||||
|
#main {
|
||||||
|
border: 3px solid @border-col;
|
||||||
|
color: @fg-col;
|
||||||
|
background-color: @bg-col;
|
||||||
|
}
|
||||||
|
/* anyrun's input window - Text */
|
||||||
|
#entry {
|
||||||
|
color: @fg-col;
|
||||||
|
background-color: @bg-col;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* anyrun's ouput matches entries - Base */
|
||||||
|
#match {
|
||||||
|
color: @fg-col;
|
||||||
|
background: @bg-col;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* anyrun's selected entry - Red */
|
||||||
|
#match:selected {
|
||||||
|
color: @fg-col2;
|
||||||
|
background: @selected-col;
|
||||||
|
}
|
||||||
|
|
||||||
|
#match {
|
||||||
|
padding: 3px;
|
||||||
|
border-radius: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#entry, #plugin:hover {
|
||||||
|
border-radius: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
box#main {
|
||||||
|
background: rgba(30, 30, 46, 0.7);
|
||||||
|
border: 1px solid @border-col;
|
||||||
|
border-radius: 15px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,43 +1,55 @@
|
|||||||
{pkgs, catppuccin-hyprland, ...}: {
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
hyprland,
|
||||||
|
nur-ryan4yin,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
imports = [
|
imports = [
|
||||||
|
./anyrun.nix
|
||||||
./wayland-apps.nix
|
./wayland-apps.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
# Only available on home-manager's master branch(2023/7/25)
|
# NOTE:
|
||||||
# wayland.windowManager.hyprland = {
|
# (Required) NixOS Module: enables critical components needed to run Hyprland properly
|
||||||
# enable = true;
|
# (Optional) Home-manager module: lets you declaratively configure Hyprland
|
||||||
# };
|
wayland.windowManager.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
package = hyprland.packages.${pkgs.system}.hyprland;
|
||||||
|
settings = lib.mkForce {};
|
||||||
|
extraConfig = builtins.readFile ./hypr-conf/hyprland.conf;
|
||||||
|
# programs.grammastep need this to be enabled.
|
||||||
|
systemd.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
# hyprland configs, based on https://github.com/notwidow/hyprland
|
# hyprland configs, based on https://github.com/notwidow/hyprland
|
||||||
home.file.".config/hypr" = {
|
xdg.configFile = {
|
||||||
source = ./hypr-conf;
|
"hypr/mako" = {
|
||||||
# copy the scripts directory recursively
|
source = ./hypr-conf/mako;
|
||||||
recursive = true;
|
recursive = true;
|
||||||
};
|
};
|
||||||
home.file.".config/hypr/themes".source = "${catppuccin-hyprland}/themes";
|
"hypr/scripts" = {
|
||||||
|
source = ./hypr-conf/scripts;
|
||||||
# gtk's theme settings, generate files:
|
recursive = true;
|
||||||
# 1. ~/.gtkrc-2.0
|
};
|
||||||
# 2. ~/.config/gtk-3.0/settings.ini
|
"hypr/waybar" = {
|
||||||
# 3. ~/.config/gtk-4.0/settings.ini
|
source = ./hypr-conf/waybar;
|
||||||
gtk = {
|
recursive = true;
|
||||||
enable = true;
|
};
|
||||||
theme = {
|
"hypr/wlogout" = {
|
||||||
# https://github.com/catppuccin/gtk
|
source = ./hypr-conf/wlogout;
|
||||||
name = "Catppuccin-Macchiato-Compact-Pink-dark";
|
recursive = true;
|
||||||
package = pkgs.catppuccin-gtk.override {
|
};
|
||||||
accents = [ "pink" ];
|
"hypr/themes" = {
|
||||||
size = "compact";
|
source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-hyprland}/themes";
|
||||||
tweaks = [ "rimless" "black" ];
|
recursive = true;
|
||||||
variant = "macchiato";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
# music player - mpd
|
# music player - mpd
|
||||||
home.file.".config/mpd" = {
|
"mpd" = {
|
||||||
source = ./mpd;
|
source = ./mpd;
|
||||||
recursive = true;
|
recursive = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# allow fontconfig to discover fonts and configurations installed through home.packages
|
# allow fontconfig to discover fonts and configurations installed through home.packages
|
||||||
@@ -56,17 +68,4 @@
|
|||||||
"WLR_NO_HARDWARE_CURSORS" = "1";
|
"WLR_NO_HARDWARE_CURSORS" = "1";
|
||||||
"WLR_EGL_NO_MODIFIRES" = "1";
|
"WLR_EGL_NO_MODIFIRES" = "1";
|
||||||
};
|
};
|
||||||
|
|
||||||
# this is for xwayland
|
|
||||||
# set dpi for 4k monitor
|
|
||||||
xresources.properties = {
|
|
||||||
"Xft.dpi" = 162;
|
|
||||||
};
|
|
||||||
|
|
||||||
# set Xcursor.theme & Xcursor.size in ~/.Xresources automatically
|
|
||||||
home.pointerCursor = {
|
|
||||||
name = "Qogir-dark";
|
|
||||||
package = pkgs.qogir-theme;
|
|
||||||
size = 64;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,11 @@
|
|||||||
# color-scheme: cappuccin-mocha
|
# color-scheme: cappuccin-mocha
|
||||||
source=~/.config/hypr/themes/mocha.conf
|
source=~/.config/hypr/themes/mocha.conf
|
||||||
|
|
||||||
|
env = _JAVA_AWT_WM_NONREPARENTING,1
|
||||||
|
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
|
||||||
|
# fix https://github.com/hyprwm/Hyprland/issues/1520
|
||||||
|
env = WLR_NO_HARDWARE_CURSORS,1
|
||||||
|
|
||||||
#-- Output ----------------------------------------------------
|
#-- Output ----------------------------------------------------
|
||||||
# Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info.
|
# Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info.
|
||||||
|
|
||||||
@@ -45,16 +50,17 @@ general {
|
|||||||
# Decoration settings like Rounded Corners, Opacity, Blur, etc.
|
# Decoration settings like Rounded Corners, Opacity, Blur, etc.
|
||||||
decoration {
|
decoration {
|
||||||
rounding=8 # Original: rounding=-1
|
rounding=8 # Original: rounding=-1
|
||||||
multisample_edges=0
|
|
||||||
|
|
||||||
active_opacity=1.0
|
active_opacity=1.0
|
||||||
inactive_opacity=0.9
|
inactive_opacity=0.9
|
||||||
fullscreen_opacity=1.0
|
fullscreen_opacity=1.0
|
||||||
|
|
||||||
blur=0
|
blur {
|
||||||
blur_size=3 # minimum 1
|
enabled=true
|
||||||
blur_passes=1 # minimum 1, more passes = more resource intensive.
|
size=3 # minimum 1
|
||||||
blur_ignore_opacity=0
|
passes=1 # minimum 1, more passes = more resource intensive.
|
||||||
|
ignore_opacity=false
|
||||||
|
}
|
||||||
|
|
||||||
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
|
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
|
||||||
# if you want heavy blur, you need to up the blur_passes.
|
# if you want heavy blur, you need to up the blur_passes.
|
||||||
@@ -103,13 +109,12 @@ $lockscreen = ~/.config/hypr/scripts/lockscreen
|
|||||||
$wlogout = ~/.config/hypr/scripts/wlogout
|
$wlogout = ~/.config/hypr/scripts/wlogout
|
||||||
$colorpicker = ~/.config/hypr/scripts/colorpicker
|
$colorpicker = ~/.config/hypr/scripts/colorpicker
|
||||||
$files = thunar
|
$files = thunar
|
||||||
$editor = code # vscode
|
|
||||||
$browser = firefox
|
$browser = firefox
|
||||||
|
|
||||||
# -- Terminal --
|
# -- Terminal --
|
||||||
bind=SUPER,Return,exec,$term
|
bind=SUPER,Return,exec,$term
|
||||||
|
|
||||||
# -- Wofi --
|
# -- App Launcher --
|
||||||
bind=SUPER,D,exec,$app_launcher
|
bind=SUPER,D,exec,$app_launcher
|
||||||
|
|
||||||
# -- Hyprland --
|
# -- Hyprland --
|
||||||
@@ -201,6 +206,10 @@ exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore
|
|||||||
exec-once=fcitx5 -d --replace # start fcitx5 daemon
|
exec-once=fcitx5 -d --replace # start fcitx5 daemon
|
||||||
bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r
|
bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r
|
||||||
|
|
||||||
|
# fix xwayland apps
|
||||||
|
windowrulev2 = rounding 0, xwayland:1, floating:1
|
||||||
|
windowrulev2 = center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$
|
||||||
|
windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$
|
||||||
|
|
||||||
# -- Fix input method in vscode
|
# -- Fix input method in vscode
|
||||||
exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24
|
exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24
|
||||||
@@ -208,7 +217,16 @@ exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24
|
|||||||
# xwayland 窗口先渲染到 200% 再降到 hyprland config 里 monitor 设置的值,看上去和原生没啥区别
|
# xwayland 窗口先渲染到 200% 再降到 hyprland config 里 monitor 设置的值,看上去和原生没啥区别
|
||||||
# 相比较一开始的方案输入法字体大小也正确了.唯一有点问题的可能是 xwayland 窗口下的鼠标指针大小不对
|
# 相比较一开始的方案输入法字体大小也正确了.唯一有点问题的可能是 xwayland 窗口下的鼠标指针大小不对
|
||||||
exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
|
exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
|
||||||
exec-once = xrdb -merge ~/.Xresources
|
|
||||||
# env = GDK_SCALE,2
|
-- Fix HiDPI - xwayland
|
||||||
env = XCURSOR_SIZE,48
|
# change monitor to high resolution, the last argument is the scale factor
|
||||||
env = XCURSOR_THEME,"Bibata-Modern-Ice"
|
monitor=,highres,auto,2
|
||||||
|
|
||||||
|
# unscale XWayland
|
||||||
|
xwayland {
|
||||||
|
force_zero_scaling = true
|
||||||
|
}
|
||||||
|
|
||||||
|
# toolkit-specific scale
|
||||||
|
env = GDK_SCALE,2
|
||||||
|
env = XCURSOR_SIZE,32
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
## launch wofi with alt config
|
if [[ ! $(pidof anyrun) ]]; then
|
||||||
|
anyrun
|
||||||
CONFIG="$HOME/.config/hypr/wofi/config"
|
|
||||||
STYLE="$HOME/.config/hypr/wofi/style.css"
|
|
||||||
COLORS="$HOME/.config/hypr/wofi/colors"
|
|
||||||
|
|
||||||
if [[ ! $(pidof wofi) ]]; then
|
|
||||||
wofi --show drun --prompt 'Search...' --conf ${CONFIG} --style ${STYLE} --color ${COLORS}
|
|
||||||
else
|
else
|
||||||
pkill wofi
|
pkill anyrun
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## launch waybar with alt config
|
## launch waybar with alt config
|
||||||
|
|
||||||
CONFIG="$HOME/.config/hypr/waybar/config.json"
|
CONFIG="$HOME/.config/hypr/waybar/config.jsonc"
|
||||||
STYLE="$HOME/.config/hypr/waybar/style.css"
|
STYLE="$HOME/.config/hypr/waybar/style.css"
|
||||||
|
|
||||||
if [[ ! $(pidof waybar) ]]; then
|
if [[ ! $(pidof waybar) ]]; then
|
||||||
|
|||||||
+22
-3
@@ -5,6 +5,7 @@
|
|||||||
"modules-left": [
|
"modules-left": [
|
||||||
"custom/launcher",
|
"custom/launcher",
|
||||||
"temperature",
|
"temperature",
|
||||||
|
"backlight",
|
||||||
"wlr/workspaces"
|
"wlr/workspaces"
|
||||||
],
|
],
|
||||||
"modules-center": [
|
"modules-center": [
|
||||||
@@ -13,11 +14,11 @@
|
|||||||
"modules-right": [
|
"modules-right": [
|
||||||
"mpd",
|
"mpd",
|
||||||
"pulseaudio",
|
"pulseaudio",
|
||||||
"backlight",
|
|
||||||
"memory",
|
"memory",
|
||||||
"cpu",
|
"cpu",
|
||||||
"network",
|
"network",
|
||||||
"clock",
|
"clock",
|
||||||
|
"idle_inhibitor",
|
||||||
"custom/powermenu",
|
"custom/powermenu",
|
||||||
"tray"
|
"tray"
|
||||||
],
|
],
|
||||||
@@ -50,7 +51,9 @@
|
|||||||
},
|
},
|
||||||
"cpu": {
|
"cpu": {
|
||||||
"format": "\udb80\udf5b {usage}%",
|
"format": "\udb80\udf5b {usage}%",
|
||||||
"interval": 1
|
"interval": 1,
|
||||||
|
"on-click-middle": "kitty btop",
|
||||||
|
"on-click-right": "kitty btop"
|
||||||
},
|
},
|
||||||
"custom/launcher": {
|
"custom/launcher": {
|
||||||
"format": "\uf313 ",
|
"format": "\uf313 ",
|
||||||
@@ -122,8 +125,10 @@
|
|||||||
"format-linked": " {ifname} (No IP)",
|
"format-linked": " {ifname} (No IP)",
|
||||||
"format-disconnected": "睊 Disconnected",
|
"format-disconnected": "睊 Disconnected",
|
||||||
"format-disabled": "睊 Disabled",
|
"format-disabled": "睊 Disabled",
|
||||||
"format-alt": " {bandwidthUpBits} | {bandwidthDownBits}",
|
"format-alt": " {bandwidthUpBytes} | {bandwidthDownBytes}",
|
||||||
"tooltip-format": " {ifname} via {gwaddr}",
|
"tooltip-format": " {ifname} via {gwaddr}",
|
||||||
|
"on-click-middle": "nm-connection-editor",
|
||||||
|
"on-click-right": "kitty nmtui"
|
||||||
},
|
},
|
||||||
"pulseaudio": {
|
"pulseaudio": {
|
||||||
//"format": "{volume}% {icon} {format_source}",
|
//"format": "{volume}% {icon} {format_source}",
|
||||||
@@ -156,6 +161,20 @@
|
|||||||
"format": "\uf2c9 {temperatureC}\u00b0C",
|
"format": "\uf2c9 {temperatureC}\u00b0C",
|
||||||
"tooltip": false
|
"tooltip": false
|
||||||
},
|
},
|
||||||
|
"backlight": {
|
||||||
|
"format": "{icon} {percent}%",
|
||||||
|
"format-icons": [
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
]
|
||||||
|
},
|
||||||
"tray": {
|
"tray": {
|
||||||
"icon-size": 15,
|
"icon-size": 15,
|
||||||
"spacing": 5
|
"spacing": 5
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#1e1e2e
|
|
||||||
#262636
|
|
||||||
#d9e0ee
|
|
||||||
#89b4fa
|
|
||||||
#f38ba8
|
|
||||||
#cba6f7
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
## Wofi Config
|
|
||||||
|
|
||||||
## General
|
|
||||||
show=drun
|
|
||||||
prompt=Apps
|
|
||||||
normal_window=true
|
|
||||||
layer=top
|
|
||||||
term=alacritty
|
|
||||||
|
|
||||||
## Geometry
|
|
||||||
width=500px
|
|
||||||
height=305px
|
|
||||||
location=0
|
|
||||||
orientation=vertical
|
|
||||||
halign=fill
|
|
||||||
line_wrap=off
|
|
||||||
dynamic_lines=false
|
|
||||||
|
|
||||||
## Images
|
|
||||||
allow_markup=true
|
|
||||||
allow_images=true
|
|
||||||
image_size=24
|
|
||||||
|
|
||||||
## Search
|
|
||||||
exec_search=false
|
|
||||||
hide_search=false
|
|
||||||
parse_search=false
|
|
||||||
insensitive=false
|
|
||||||
|
|
||||||
## Other
|
|
||||||
hide_scroll=true
|
|
||||||
no_actions=true
|
|
||||||
sort_order=default
|
|
||||||
gtk_dark=true
|
|
||||||
filter_rate=100
|
|
||||||
|
|
||||||
## Keys
|
|
||||||
key_expand=Tab
|
|
||||||
key_exit=Escape
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
/** ********** Fonts ********** **/
|
|
||||||
* {
|
|
||||||
font-family: "JetBrains Mono", "Iosevka Nerd Font", sans-serif;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#window {
|
|
||||||
background-color: --wofi-color0;
|
|
||||||
color: --wofi-color2;
|
|
||||||
border: 2px solid --wofi-color1;
|
|
||||||
border-radius: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#outer-box {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#input {
|
|
||||||
background-color: --wofi-color1;
|
|
||||||
border: 0px solid --wofi-color3;
|
|
||||||
padding: 8px 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#scroll {
|
|
||||||
margin-top: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#inner-box {
|
|
||||||
}
|
|
||||||
|
|
||||||
#img {
|
|
||||||
padding-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#text {
|
|
||||||
color: --wofi-color2;
|
|
||||||
}
|
|
||||||
|
|
||||||
#text:selected {
|
|
||||||
color: --wofi-color0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#entry {
|
|
||||||
padding: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#entry:selected {
|
|
||||||
background-color: --wofi-color3;
|
|
||||||
color: --wofi-color0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#unselected {
|
|
||||||
}
|
|
||||||
|
|
||||||
#selected {
|
|
||||||
}
|
|
||||||
|
|
||||||
#input, #entry:selected {
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
|
||||||
@@ -8,9 +8,11 @@
|
|||||||
commandLineArgs = [
|
commandLineArgs = [
|
||||||
# make it use GTK_IM_MODULE if it runs with Gtk4, so fcitx5 can work with it.
|
# make it use GTK_IM_MODULE if it runs with Gtk4, so fcitx5 can work with it.
|
||||||
# (only supported by chromium/chrome at this time, not electron)
|
# (only supported by chromium/chrome at this time, not electron)
|
||||||
"--gtk-version=4"
|
"--gtk-version=5"
|
||||||
|
"--enable-features=UseOzonePlatform"
|
||||||
|
"--ozone-platform=wayland"
|
||||||
# make it use text-input-v1, which works for kwin 5.27 and weston
|
# make it use text-input-v1, which works for kwin 5.27 and weston
|
||||||
# "--enable-wayland-ime"
|
"--enable-wayland-ime"
|
||||||
|
|
||||||
# enable hardware acceleration - vulkan api
|
# enable hardware acceleration - vulkan api
|
||||||
# "--enable-features=Vulkan"
|
# "--enable-features=Vulkan"
|
||||||
@@ -22,19 +24,5 @@
|
|||||||
enableGnomeExtensions = false;
|
enableGnomeExtensions = false;
|
||||||
package = pkgs.firefox-wayland; # firefox with wayland support
|
package = pkgs.firefox-wayland; # firefox with wayland support
|
||||||
};
|
};
|
||||||
|
|
||||||
vscode = {
|
|
||||||
enable = true;
|
|
||||||
# use the stable version
|
|
||||||
# package = pkgs.vscode.override {
|
|
||||||
# commandLineArgs = [
|
|
||||||
# # make it use text-input-v1, which works for kwin 5.27 and weston
|
|
||||||
# # "--enable-wayland-ime"
|
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
|
|
||||||
# let vscode sync and update its configuration & extensions across devices, using github account.
|
|
||||||
# userSettings = {};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
# i3 window manager's config, based on https://github.com/endeavouros-team/endeavouros-i3wm-setup
|
# i3 window manager's config, based on https://github.com/endeavouros-team/endeavouros-i3wm-setup
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
@@ -43,19 +43,4 @@
|
|||||||
"GBM_BACKEND" = "nvidia-drm";
|
"GBM_BACKEND" = "nvidia-drm";
|
||||||
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
|
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
|
||||||
};
|
};
|
||||||
|
|
||||||
# set dpi for 4k monitor
|
|
||||||
xresources.properties = {
|
|
||||||
# dpi for Xorg's font
|
|
||||||
"Xft.dpi" = 162;
|
|
||||||
# or set a generic dpi
|
|
||||||
"*.dpi" = 162;
|
|
||||||
};
|
|
||||||
|
|
||||||
# set Xcursor.theme & Xcursor.size in ~/.Xresources automatically
|
|
||||||
home.pointerCursor = {
|
|
||||||
name = "Qogir-dark";
|
|
||||||
package = pkgs.qogir-theme;
|
|
||||||
size = 64;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,17 +17,5 @@
|
|||||||
# commandLineArgs = [
|
# commandLineArgs = [
|
||||||
# ];
|
# ];
|
||||||
};
|
};
|
||||||
|
|
||||||
vscode = {
|
|
||||||
enable = true;
|
|
||||||
# use the stable version
|
|
||||||
# package = pkgs.vscode.override {
|
|
||||||
# commandLineArgs = [
|
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
|
|
||||||
# let vscode sync and update its configuration & extensions across devices, using github account.
|
|
||||||
# userSettings = {};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{username, ...}: {
|
||||||
|
imports = [
|
||||||
|
];
|
||||||
|
|
||||||
|
# Home Manager needs a bit of information about you and the
|
||||||
|
# paths it should manage.
|
||||||
|
home = {
|
||||||
|
inherit username;
|
||||||
|
homeDirectory = "/home/${username}";
|
||||||
|
|
||||||
|
# This value determines the Home Manager release that your
|
||||||
|
# configuration is compatible with. This helps avoid breakage
|
||||||
|
# when a new Home Manager release introduces backwards
|
||||||
|
# incompatible changes.
|
||||||
|
#
|
||||||
|
# You can update Home Manager without changing this value. See
|
||||||
|
# the Home Manager release notes for a list of state version
|
||||||
|
# changes in each release.
|
||||||
|
stateVersion = "23.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Let Home Manager install and manage itself.
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{ username, ... }: {
|
{username, ...}: {
|
||||||
imports = [
|
imports = [
|
||||||
../base/server
|
../base/server
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
# Home Manager needs a bit of information about you and the
|
# Home Manager needs a bit of information about you and the
|
||||||
# paths it should manage.
|
# paths it should manage.
|
||||||
home = {
|
home = {
|
||||||
username = username;
|
inherit username;
|
||||||
homeDirectory = "/home/${username}";
|
homeDirectory = "/home/${username}";
|
||||||
|
|
||||||
# This value determines the Home Manager release that your
|
# This value determines the Home Manager release that your
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
# You can update Home Manager without changing this value. See
|
# You can update Home Manager without changing this value. See
|
||||||
# the Home Manager release notes for a list of state version
|
# the Home Manager release notes for a list of state version
|
||||||
# changes in each release.
|
# changes in each release.
|
||||||
stateVersion = "22.11";
|
stateVersion = "23.11";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
# Let Home Manager install and manage itself.
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
username,
|
||||||
|
nixos-rk3588,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
#############################################################
|
||||||
|
#
|
||||||
|
# Aquamarine - A NixOS VM running on Proxmox
|
||||||
|
#
|
||||||
|
#############################################################
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
# import the rk3588 module, which contains the configuration for bootloader/kernel/firmware
|
||||||
|
nixos-rk3588.nixosModules.orangepi5
|
||||||
|
];
|
||||||
|
|
||||||
|
users.users.root.openssh.authorizedKeys.keys = config.users.users."${username}".openssh.authorizedKeys.keys;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
hostName = "suzu"; # Define your hostname.
|
||||||
|
wireless.enable = false; # Enables wireless support via wpa_supplicant.
|
||||||
|
networkmanager.enable = false;
|
||||||
|
|
||||||
|
# Configure network proxy if necessary
|
||||||
|
# proxy.default = "http://user:password@proxy:port/";
|
||||||
|
# proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||||
|
|
||||||
|
interfaces.end1 = {
|
||||||
|
useDHCP = false;
|
||||||
|
ipv4.addresses = [
|
||||||
|
{
|
||||||
|
address = "192.168.5.107";
|
||||||
|
prefixLength = 24;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
defaultGateway = "192.168.5.201";
|
||||||
|
nameservers = [
|
||||||
|
"119.29.29.29" # DNSPod
|
||||||
|
"223.5.5.5" # AliDNS
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# This value determines the NixOS release from which the default
|
||||||
|
# settings for stateful data, like file locations and database versions
|
||||||
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
|
# this value at the release version of the first install of this system.
|
||||||
|
# Before changing this value read the documentation for this option
|
||||||
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
|
system.stateVersion = "23.11"; # Did you read the comment?
|
||||||
|
}
|
||||||
+25
-2
@@ -1,11 +1,20 @@
|
|||||||
# Hosts
|
# Hosts
|
||||||
|
|
||||||
1. `harmonica`: My MacBook Pro 2020 13-inch, for work.
|
1. macOS
|
||||||
|
1. `fern`: MacBook Pro 2022 13-inch M2 16G, mainly for business.
|
||||||
|
1. `harmonica`: MacBook Pro 2020 13-inch i5 16G, for personal use.
|
||||||
2. `idols`
|
2. `idols`
|
||||||
1. `ai`: My main computer, with NixOS + I5-13600KF + RTX 4090 GPU, for gaming & daily use.
|
1. `ai`: My main computer, with NixOS + I5-13600KF + RTX 4090 GPU, for gaming & daily use.
|
||||||
2. `aquamarine`: My NixOS virtual machine with R9-5900HX(8C16T), for distributed building & testing.
|
2. `aquamarine`: My NixOS virtual machine with R9-5900HX(8C16T), for distributed building & testing.
|
||||||
3. `kana`: Yet another NixOS vm on another physical machine with R5-5625U(6C12T).
|
3. `kana`: Yet another NixOS vm on another physical machine with R5-5625U(6C12T).
|
||||||
4. `ruby`: Another NixOS vm on another physical machine with R7-5825U(8C16T).
|
4. `ruby`: Another NixOS vm on another physical machine with R7-5825U(8C16T).
|
||||||
|
3. `rolling_girls`: My RISCV64 hosts.
|
||||||
|
1. `nozomi`: Lichee Pi 4A, TH1520(4xC910@2.0G), 8GB RAM + 32G eMMC + 64G SD Card.
|
||||||
|
2. `yukina`: Lichee Pi 4A(Internal Test Version), TH1520(4xC910@2.0G), 8GB RAM + 8G eMMC + 128G SD Card.
|
||||||
|
3. `chiaya`: Milk-V Mars, JH7110(4xU74@1.5 GHz), 4G RAM + No eMMC + 64G SD Card.
|
||||||
|
4. `12kingdoms`: Currently only one aarch64 host
|
||||||
|
1. `suzu`: Orange Pi 5, RK3588s(4xA76 + 4xA55), GPU(4Cores, Mail-G610), NPU(6Tops@int8), 8G RAM + 256G SSD.
|
||||||
|
|
||||||
|
|
||||||
# idols - Oshi no Ko
|
# idols - Oshi no Ko
|
||||||
|
|
||||||
@@ -18,10 +27,24 @@ When building some packages for riscv64 or aarch64, I often have no cache availa
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## rolling girls
|
||||||
|
|
||||||
|
My All RISCV64 hosts.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
|
[Oshi no Ko 【推しの子】 - Wikipedia](https://en.wikipedia.org/wiki/Oshi_no_Ko):
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
|
|
||||||
See [Oshi no Ko 【推しの子】 - Wikipedia](https://en.wikipedia.org/wiki/Oshi_no_Ko) for more information.
|
[The Rolling Girls【ローリング☆ガールズ】 - Wikipedia](https://en.wikipedia.org/wiki/The_Rolling_Girls):
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
[List of Twelve Kingdoms characters](https://en.wikipedia.org/wiki/List_of_Twelve_Kingdoms_characters)
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{username, ...} @ args:
|
||||||
|
#############################################################
|
||||||
|
#
|
||||||
|
# Fern - MacBook Pro 2022 13-inch M2 16G, mainly for business.
|
||||||
|
#
|
||||||
|
#############################################################
|
||||||
|
let
|
||||||
|
hostname = "fern";
|
||||||
|
in {
|
||||||
|
networking.hostName = hostname;
|
||||||
|
networking.computerName = hostname;
|
||||||
|
system.defaults.smb.NetBIOSName = hostname;
|
||||||
|
|
||||||
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
|
users.users."${username}" = {
|
||||||
|
home = "/Users/${username}";
|
||||||
|
description = username;
|
||||||
|
|
||||||
|
# set user's default shell back to zsh
|
||||||
|
# `chsh -s /bin/zsh`
|
||||||
|
# DO NOT change the system's default shell to nushell! it will break some apps!
|
||||||
|
# It's better to change only starship/alacritty/vscode's shell to nushell!
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,20 +1,12 @@
|
|||||||
{ username, ... } @ args:
|
{username, ...} @ args:
|
||||||
#############################################################
|
#############################################################
|
||||||
#
|
#
|
||||||
# Harmonica - my MacBook Pro 2020 13-inch, mainly for business.
|
# Harmonica - MacBook Pro 2020 13-inch i5 16G, mainly for personal use
|
||||||
#
|
#
|
||||||
#############################################################
|
#############################################################
|
||||||
let
|
let
|
||||||
hostname = "harmonica";
|
hostname = "harmonica";
|
||||||
in {
|
in {
|
||||||
imports = [
|
|
||||||
../../modules/darwin
|
|
||||||
|
|
||||||
../../secrets/darwin.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
nixpkgs.overlays = import ../../overlays args;
|
|
||||||
|
|
||||||
networking.hostName = hostname;
|
networking.hostName = hostname;
|
||||||
networking.computerName = hostname;
|
networking.computerName = hostname;
|
||||||
system.defaults.smb.NetBIOSName = hostname;
|
system.defaults.smb.NetBIOSName = hostname;
|
||||||
@@ -29,6 +21,4 @@ in {
|
|||||||
# DO NOT change the system's default shell to nushell! it will break some apps!
|
# DO NOT change the system's default shell to nushell! it will break some apps!
|
||||||
# It's better to change only starship/alacritty/vscode's shell to nushell!
|
# It's better to change only starship/alacritty/vscode's shell to nushell!
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.settings.trusted-users = [username];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
# Host - AI
|
||||||
|
|
||||||
|
disk status & mountpoints:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
› df -Th
|
||||||
|
Filesystem Type Size Used Avail Use% Mounted on
|
||||||
|
devtmpfs devtmpfs 1.6G 0 1.6G 0% /dev
|
||||||
|
tmpfs tmpfs 16G 8.0K 16G 1% /dev/shm
|
||||||
|
tmpfs tmpfs 7.8G 7.9M 7.8G 1% /run
|
||||||
|
tmpfs tmpfs 16G 1.1M 16G 1% /run/wrappers
|
||||||
|
tmpfs tmpfs 16G 87M 16G 1% /
|
||||||
|
/dev/mapper/crypted-nixos btrfs 1.9T 630G 1.3T 34% /persistent
|
||||||
|
/dev/mapper/crypted-nixos btrfs 1.9T 630G 1.3T 34% /nix
|
||||||
|
tmpfs tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup
|
||||||
|
efivarfs efivarfs 256K 108K 144K 43% /sys/firmware/efi/efivars
|
||||||
|
/dev/mapper/crypted-nixos btrfs 1.9T 630G 1.3T 34% /snapshots
|
||||||
|
/dev/mapper/crypted-nixos btrfs 1.9T 630G 1.3T 34% /swap
|
||||||
|
/dev/nvme0n1p1 vfat 597M 108M 490M 19% /boot
|
||||||
|
tmpfs tmpfs 3.2G 48K 3.2G 1% /run/user/1000
|
||||||
|
//192.168.5.194/Downloads cifs 3.7T 3.0T 699G 82% /home/ryan/SMB-Downloads
|
||||||
|
tmpfs tmpfs 100K 0 100K 0% /var/lib/lxd/shmounts
|
||||||
|
tmpfs tmpfs 100K 0 100K 0% /var/lib/lxd/devlxd
|
||||||
|
/dev/mapper/crypted-nixos btrfs 1.9T 630G 1.3T 34% /tmp
|
||||||
|
|
||||||
|
~
|
||||||
|
› lsblk
|
||||||
|
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
|
||||||
|
zram0 253:0 0 15.6G 0 disk [SWAP]
|
||||||
|
nvme0n1 259:0 0 1.8T 0 disk
|
||||||
|
├─nvme0n1p1 259:2 0 598M 0 part /boot
|
||||||
|
└─nvme0n1p2 259:3 0 1.8T 0 part
|
||||||
|
└─crypted-nixos 254:0 0 1.8T 0 crypt /tmp
|
||||||
|
/swap/swapfile
|
||||||
|
/swap
|
||||||
|
/snapshots
|
||||||
|
/home/ryan/tmp
|
||||||
|
/home/ryan/nix-config
|
||||||
|
/home/ryan/go
|
||||||
|
/home/ryan/codes
|
||||||
|
/home/ryan/Videos
|
||||||
|
/home/ryan/Pictures
|
||||||
|
/home/ryan/Music
|
||||||
|
/home/ryan/Downloads
|
||||||
|
/home/ryan/Documents
|
||||||
|
/home/ryan/.wakatime
|
||||||
|
/home/ryan/.ssh
|
||||||
|
/home/ryan/.pki
|
||||||
|
/home/ryan/.npm
|
||||||
|
/home/ryan/.mozilla
|
||||||
|
/home/ryan/.local/state
|
||||||
|
/home/ryan/.local/share
|
||||||
|
/home/ryan/.kube
|
||||||
|
/home/ryan/.gnupg
|
||||||
|
/home/ryan/.docker
|
||||||
|
/home/ryan/.config/remmina
|
||||||
|
/home/ryan/.config/pulse
|
||||||
|
/home/ryan/.config/google-chrome
|
||||||
|
/home/ryan/.config/github-copilot
|
||||||
|
/home/ryan/.config/freerdp
|
||||||
|
/home/ryan/.aws
|
||||||
|
/etc/ssh
|
||||||
|
/etc/secureboot
|
||||||
|
/etc/nix/inputs
|
||||||
|
/etc/agenix
|
||||||
|
/etc/NetworkManager/system-connections
|
||||||
|
/etc/machine-id
|
||||||
|
/home/ryan/.config/nushell/history.txt
|
||||||
|
/home/ryan/.wakatime.cfg
|
||||||
|
/nix/store
|
||||||
|
/var/log
|
||||||
|
/var/lib
|
||||||
|
/nix
|
||||||
|
/persistent
|
||||||
|
```
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
pkgs,
|
|
||||||
|
|
||||||
username,
|
username,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
{config, ...} @ args:
|
|
||||||
#############################################################
|
#############################################################
|
||||||
#
|
#
|
||||||
# Ai - my main computer, with NixOS + I5-13600KF + RTX 4090 GPU, for gaming & daily use.
|
# Ai - my main computer, with NixOS + I5-13600KF + RTX 4090 GPU, for gaming & daily use.
|
||||||
@@ -10,41 +9,10 @@
|
|||||||
# Include the results of the hardware scan.
|
# Include the results of the hardware scan.
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|
||||||
../../../modules/nixos/fhs-fonts.nix
|
./impermanence.nix
|
||||||
../../../modules/nixos/libvirt.nix
|
./secureboot.nix
|
||||||
../../../modules/nixos/core-desktop.nix
|
|
||||||
# ../../../modules/nixos/remote-building.nix
|
|
||||||
../../../modules/nixos/user-group.nix
|
|
||||||
|
|
||||||
../../../secrets/nixos.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
nixpkgs.overlays = import ../../../overlays args;
|
|
||||||
|
|
||||||
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
|
|
||||||
boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"];
|
|
||||||
# supported fil systems, so we can mount any removable disks with these filesystems
|
|
||||||
boot.supportedFilesystems = [
|
|
||||||
"ext4"
|
|
||||||
"btrfs"
|
|
||||||
"xfs"
|
|
||||||
#"zfs"
|
|
||||||
"ntfs"
|
|
||||||
"fat"
|
|
||||||
"vfat"
|
|
||||||
"exfat"
|
|
||||||
"cifs" # mount windows share
|
|
||||||
];
|
|
||||||
|
|
||||||
# Bootloader.
|
|
||||||
boot.loader = {
|
|
||||||
efi = {
|
|
||||||
canTouchEfiVariables = true;
|
|
||||||
efiSysMountPoint = "/boot/efi"; # ← use the same mount point here.
|
|
||||||
};
|
|
||||||
systemd-boot.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
networking = {
|
networking = {
|
||||||
hostName = "ai";
|
hostName = "ai";
|
||||||
wireless.enable = false; # Enables wireless support via wpa_supplicant.
|
wireless.enable = false; # Enables wireless support via wpa_supplicant.
|
||||||
@@ -72,20 +40,17 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualisation.docker.storageDriver = "btrfs";
|
# conflict with feature: containerd-snapshotter
|
||||||
|
# virtualisation.docker.storageDriver = "btrfs";
|
||||||
|
|
||||||
# for Nvidia GPU
|
# for Nvidia GPU
|
||||||
services.xserver.videoDrivers = ["nvidia"]; # will install nvidia-vaapi-driver by default
|
services.xserver.videoDrivers = ["nvidia"]; # will install nvidia-vaapi-driver by default
|
||||||
hardware.nvidia = {
|
hardware.nvidia = {
|
||||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
# package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
|
|
||||||
# Modesetting is needed for most Wayland compositors
|
# required by most wayland compositors!
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
# Use the open source version of the kernel module
|
|
||||||
# Only available on driver 515.43.04+
|
|
||||||
open = false;
|
|
||||||
|
|
||||||
powerManagement.enable = true;
|
powerManagement.enable = true;
|
||||||
};
|
};
|
||||||
virtualisation.docker.enableNvidia = true; # for nvidia-docker
|
virtualisation.docker.enableNvidia = true; # for nvidia-docker
|
||||||
@@ -104,5 +69,5 @@
|
|||||||
# 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 = "22.11"; # Did you read the comment?
|
system.stateVersion = "23.11"; # Did you read the comment?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,23 +12,109 @@
|
|||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Use the EFI boot loader.
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
# depending on how you configured your disk mounts, change this to /boot or /boot/efi.
|
||||||
|
boot.loader.efi.efiSysMountPoint = "/boot";
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
|
||||||
|
# boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||||
|
boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
|
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
|
||||||
boot.initrd.kernelModules = [];
|
boot.initrd.kernelModules = [];
|
||||||
boot.kernelModules = ["kvm-intel"];
|
boot.kernelModules = ["kvm-intel"];
|
||||||
|
boot.kernelParams = ["nvidia.NVreg_PreserveVideoMemoryAllocations=1"];
|
||||||
boot.extraModulePackages = [];
|
boot.extraModulePackages = [];
|
||||||
|
# clear /tmp on boot to get a stateless /tmp directory.
|
||||||
|
boot.tmp.cleanOnBoot = true;
|
||||||
|
|
||||||
fileSystems."/" = {
|
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
|
||||||
device = "/dev/disk/by-uuid/231466f6-cdf3-40e1-b9d2-6b4e8d10a4d3";
|
boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"];
|
||||||
fsType = "btrfs";
|
# supported fil systems, so we can mount any removable disks with these filesystems
|
||||||
options = ["subvol=@"];
|
boot.supportedFilesystems = [
|
||||||
|
"ext4"
|
||||||
|
"btrfs"
|
||||||
|
"xfs"
|
||||||
|
"ntfs"
|
||||||
|
"fat"
|
||||||
|
"vfat"
|
||||||
|
"cifs" # mount windows share
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd = {
|
||||||
|
# unlocked luks devices via a keyfile or prompt a passphrase.
|
||||||
|
luks.devices."crypted-nixos" = {
|
||||||
|
device = "/dev/nvme0n1p2";
|
||||||
|
# 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.
|
||||||
|
#keyFile = "/root-part.key";
|
||||||
|
|
||||||
|
# whether to allow TRIM requests to the underlying device.
|
||||||
|
# it's less secure, but faster.
|
||||||
|
allowDiscards = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/boot/efi" = {
|
# equal to `mount -t tmpfs tmpfs /`
|
||||||
device = "/dev/disk/by-uuid/87ED-8B2E";
|
fileSystems."/" = {
|
||||||
|
device = "tmpfs";
|
||||||
|
fsType = "tmpfs";
|
||||||
|
# set mode to 755, otherwise systemd will set it to 777, which cause problems.
|
||||||
|
options = ["relatime" "mode=755"];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/nix" = {
|
||||||
|
device = "/dev/disk/by-uuid/1167076c-dee1-486c-83c1-4b1af37555cd";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=@nix" "noatime" "compress-force=zstd:1"];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/persistent" = {
|
||||||
|
device = "/dev/disk/by-uuid/1167076c-dee1-486c-83c1-4b1af37555cd";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=@persistent" "compress-force=zstd:1"];
|
||||||
|
# impermanence's data is required for booting.
|
||||||
|
neededForBoot = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/snapshots" = {
|
||||||
|
device = "/dev/disk/by-uuid/1167076c-dee1-486c-83c1-4b1af37555cd";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=@snapshots" "compress-force=zstd:1"];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/tmp" = {
|
||||||
|
device = "/dev/disk/by-uuid/1167076c-dee1-486c-83c1-4b1af37555cd";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=@tmp" "compress-force=zstd:1"];
|
||||||
|
};
|
||||||
|
|
||||||
|
# mount swap subvolume in readonly mode.
|
||||||
|
fileSystems."/swap" = {
|
||||||
|
device = "/dev/disk/by-uuid/1167076c-dee1-486c-83c1-4b1af37555cd";
|
||||||
|
fsType = "btrfs";
|
||||||
|
options = ["subvol=@swap" "ro"];
|
||||||
|
};
|
||||||
|
|
||||||
|
# remount swapfile in read-write mode
|
||||||
|
fileSystems."/swap/swapfile" = {
|
||||||
|
# the swapfile is located in /swap subvolume, so we need to mount /swap first.
|
||||||
|
depends = ["/swap"];
|
||||||
|
|
||||||
|
device = "/swap/swapfile";
|
||||||
|
fsType = "none";
|
||||||
|
options = ["bind" "rw"];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/nvme0n1p1";
|
||||||
fsType = "vfat";
|
fsType = "vfat";
|
||||||
};
|
};
|
||||||
|
|
||||||
swapDevices = [{device = "/dev/disk/by-uuid/17391ca0-8cdb-4598-a40b-fd9548fd9b37";}];
|
swapDevices = [
|
||||||
|
{device = "/swap/swapfile";}
|
||||||
|
];
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
{
|
||||||
|
impermanence,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
imports = [
|
||||||
|
impermanence.nixosModules.impermanence
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
# `sudo ncdu -x /`
|
||||||
|
pkgs.ncdu
|
||||||
|
];
|
||||||
|
|
||||||
|
# There are two ways to clear the root filesystem on every boot:
|
||||||
|
## 1. use tmpfs for /
|
||||||
|
## 2. (btrfs/zfs only)take a blank snapshot of the root filesystem and revert to it on every boot via:
|
||||||
|
## boot.initrd.postDeviceCommands = ''
|
||||||
|
## mkdir -p /run/mymount
|
||||||
|
## mount -o subvol=/ /dev/disk/by-uuid/UUID /run/mymount
|
||||||
|
## btrfs subvolume delete /run/mymount
|
||||||
|
## btrfs subvolume snapshot / /run/mymount
|
||||||
|
## '';
|
||||||
|
#
|
||||||
|
# See also https://grahamc.com/blog/erase-your-darlings/
|
||||||
|
|
||||||
|
# NOTE: impermanence only mounts the directory/file list below to /persistent
|
||||||
|
# If the directory/file already exists in the root filesystem, you should
|
||||||
|
# move those files/directories to /persistent first!
|
||||||
|
environment.persistence."/persistent" = {
|
||||||
|
# sets the mount option x-gvfs-hide on all the bind mounts
|
||||||
|
# to hide them from the file manager
|
||||||
|
hideMounts = true;
|
||||||
|
directories = [
|
||||||
|
"/etc/NetworkManager/system-connections"
|
||||||
|
"/etc/ssh"
|
||||||
|
"/etc/nix/inputs"
|
||||||
|
"/etc/secureboot" # lanzaboote - secure boot
|
||||||
|
# my secrets
|
||||||
|
"/etc/agenix/"
|
||||||
|
|
||||||
|
"/var/log"
|
||||||
|
"/var/lib"
|
||||||
|
|
||||||
|
# created by modules/nixos/misc/fhs-fonts.nix
|
||||||
|
# for flatpak apps
|
||||||
|
# "/usr/share/fonts"
|
||||||
|
# "/usr/share/icons"
|
||||||
|
];
|
||||||
|
files = [
|
||||||
|
"/etc/machine-id"
|
||||||
|
];
|
||||||
|
|
||||||
|
# the following directories will be passed to /persistent/home/$USER
|
||||||
|
users.ryan = {
|
||||||
|
directories = [
|
||||||
|
"codes"
|
||||||
|
"nix-config"
|
||||||
|
"tmp"
|
||||||
|
|
||||||
|
"Downloads"
|
||||||
|
"Music"
|
||||||
|
"Pictures"
|
||||||
|
"Documents"
|
||||||
|
"Videos"
|
||||||
|
|
||||||
|
{
|
||||||
|
directory = ".gnupg";
|
||||||
|
mode = "0700";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
directory = ".ssh";
|
||||||
|
mode = "0700";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
directory = ".aws";
|
||||||
|
mode = "0700";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
directory = ".docker";
|
||||||
|
mode = "0700";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
directory = ".kube";
|
||||||
|
mode = "0700";
|
||||||
|
}
|
||||||
|
|
||||||
|
# misc
|
||||||
|
".config/pulse"
|
||||||
|
".pki"
|
||||||
|
|
||||||
|
# remote desktop
|
||||||
|
".config/remmina"
|
||||||
|
".config/freerdp"
|
||||||
|
|
||||||
|
# browsers
|
||||||
|
".mozilla"
|
||||||
|
".config/google-chrome"
|
||||||
|
|
||||||
|
# neovim / remmina / flatpak / ...
|
||||||
|
".local/share"
|
||||||
|
".local/state"
|
||||||
|
|
||||||
|
# language package managers
|
||||||
|
".npm"
|
||||||
|
"go"
|
||||||
|
|
||||||
|
# neovim plugins(wakatime & copilot)
|
||||||
|
".wakatime"
|
||||||
|
".config/github-copilot"
|
||||||
|
];
|
||||||
|
files = [
|
||||||
|
".wakatime.cfg"
|
||||||
|
".config/nushell/history.txt"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
result
|
||||||
|
result/
|
||||||
|
.DS_Store
|
||||||
@@ -0,0 +1,243 @@
|
|||||||
|
# Nix Environment for Deploying my NixOS Configuration
|
||||||
|
|
||||||
|
This flake prepares a Nix environment for setting my desktop [/hosts/idols/ai](/hosts/idols/ai/)(on main flake) up on a new machine.
|
||||||
|
|
||||||
|
TODOs:
|
||||||
|
|
||||||
|
- [ ] dcalarative disk partitioning with [disko](https://github.com/nix-community/disko)
|
||||||
|
|
||||||
|
## Why an extra flake is needed?
|
||||||
|
|
||||||
|
The configuration of the main flake, [/flake.nix](/flake.nix), is heavy, and it takes time to debug & deploy.
|
||||||
|
This simplified flake is tiny and can be deployed very quickly, it helps me to:
|
||||||
|
|
||||||
|
1. Adjust & verify my `hardware-configuration.nix` modification quickly before deploying the `main` flake.
|
||||||
|
2. Test some new filesystem related features on a NixOS virtual machine, such as impermanence, Secure Boot, TMP2, Encryption, etc.
|
||||||
|
|
||||||
|
## Steps to Deploying the `main` flake
|
||||||
|
|
||||||
|
First, create a USB install medium from NixOS's official ISO image and boot from it.
|
||||||
|
|
||||||
|
### 1. Encrypting with LUKS(everything except ESP)
|
||||||
|
|
||||||
|
> https://nixos.org/manual/nixos/stable/#sec-installation-manual-partitioning
|
||||||
|
|
||||||
|
> [dm-crypt/Encrypting an entire system - Arch Wiki](https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system)
|
||||||
|
|
||||||
|
> [Encrypted /boot - GRUB2 - Arch Wiki](https://wiki.archlinux.org/title/GRUB#Encrypted_/boot)
|
||||||
|
|
||||||
|
> [Frequently asked questions (FAQ) - cryptsetup](https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions)
|
||||||
|
|
||||||
|
Securing a root file system is where dm-crypt excels, feature and performance-wise.
|
||||||
|
An encrypted root file system protects everything on the system, it make the system a black box to the attacker.
|
||||||
|
|
||||||
|
1. The EFI system partition(ESP) must be left unencrypted, and is mounted at `/boot`
|
||||||
|
1. Since the UEFI firmware can only load boot loaders from unencrypted partitions.
|
||||||
|
2. Secure Boot is enabled, everything in ESP is signed.
|
||||||
|
3. The BTRFS file system with subvolumes is used for the root partition, and the swap area is a swapfile on a dedicated BTRFS subvolume, thus the swap area is also encrypted.
|
||||||
|
|
||||||
|
And the boot flow is:
|
||||||
|
|
||||||
|
1. The UEFI firmware loads the boot loader from the ESP(`/boot`).
|
||||||
|
2. The boot loader loads the kernel and initrd from the ESP(`/boot`).
|
||||||
|
3. **The initrd prompts for the passphrase to unlock the root partition**.
|
||||||
|
4. The initrd unlocks the root partition and mounts it at `/`.
|
||||||
|
5. The initrd continues the boot process, and hands over the control to the kernel.
|
||||||
|
|
||||||
|
Partitioning the disk:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Create a GPT partition table
|
||||||
|
parted /dev/nvme0n1 -- mklabel gpt
|
||||||
|
|
||||||
|
# NixOS by default uses the ESP (EFI system partition) as its /boot partition
|
||||||
|
# Create a 512MB EFI system partition
|
||||||
|
parted /dev/nvme0n1 -- mkpart ESP fat32 2MB 629MB
|
||||||
|
|
||||||
|
# set the boot flag on the ESP partition
|
||||||
|
# Format:
|
||||||
|
# set partition flag state
|
||||||
|
parted /dev/nvme0n1 -- set 1 esp on
|
||||||
|
|
||||||
|
# Create the root partition using the rest of the disk
|
||||||
|
# Format:
|
||||||
|
# mkpart [part-type name fs-type] start end
|
||||||
|
parted /dev/nvme0n1 -- mkpart primary 630MB 100%
|
||||||
|
|
||||||
|
# show disk status
|
||||||
|
lsblk
|
||||||
|
```
|
||||||
|
|
||||||
|
Encrypting the root partition:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
lsblk
|
||||||
|
# show cryptsetup's compiled in defualts
|
||||||
|
cryptsetup --help
|
||||||
|
|
||||||
|
# encrypt the root partition with luks2 and argon2id, will prompt for a passphrase, which will be used to unlock the partition.
|
||||||
|
cryptsetup luksFormat --type luks2 --pbkdf argon2id --cipher aes-xts-plain64 --key-size 512 --hash sha512 /dev/nvme0n1p2
|
||||||
|
|
||||||
|
# show status
|
||||||
|
cryptsetup luksDump /dev/nvme0n1p2
|
||||||
|
|
||||||
|
# open(unlock) the device with the passphrase you just set
|
||||||
|
cryptsetup luksOpen /dev/nvme0n1p2 crypted-nixos
|
||||||
|
|
||||||
|
# show disk status
|
||||||
|
lsblk
|
||||||
|
```
|
||||||
|
|
||||||
|
Formatting the root partition:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkfs.fat -F 32 -n ESP /dev/nvme0n1p1
|
||||||
|
# format the root partition with btrfs and label it
|
||||||
|
mkfs.btrfs -L crypted-nixos /dev/mapper/crypted-nixos
|
||||||
|
|
||||||
|
# mount the root partition and create subvolumes
|
||||||
|
mount /dev/mapper/crypted-nixos /mnt
|
||||||
|
btrfs subvolume create /mnt/@nix
|
||||||
|
btrfs subvolume create /mnt/@tmp
|
||||||
|
btrfs subvolume create /mnt/@swap
|
||||||
|
btrfs subvolume create /mnt/@persistent
|
||||||
|
btrfs subvolume create /mnt/@snapshots
|
||||||
|
umount /mnt
|
||||||
|
|
||||||
|
# Use tmpfs for root - stateless
|
||||||
|
mount -t tmpfs tmpfs /mnt
|
||||||
|
|
||||||
|
# Remount the root partition with the subvolumes you just created
|
||||||
|
#
|
||||||
|
# Enable zstd compression to:
|
||||||
|
# 1. Reduce the read/write operations, which helps to:
|
||||||
|
# 1. Extend the life of the SSD.
|
||||||
|
# 2. improve the performance of disks with low IOPS / RW throughput, such as HDD and SATA SSD.
|
||||||
|
# 2. Save the disk space.
|
||||||
|
mkdir /mnt/{nix,tmp,swap,persistent,snapshots,boot}
|
||||||
|
mount -o compress-force=zstd:1,noatime,subvol=@nix /dev/mapper/crypted-nixos /mnt/nix
|
||||||
|
mount -o compress-force=zstd:1,subvol=@tmp /dev/mapper/crypted-nixos /mnt/tmp
|
||||||
|
mount -o subvol=@swap /dev/mapper/crypted-nixos /mnt/swap
|
||||||
|
mount -o compress-force=zstd:1,noatime,subvol=@persistent /dev/mapper/crypted-nixos /mnt/persistent
|
||||||
|
mount -o compress-force=zstd:1,noatime,subvol=@snapshots /dev/mapper/crypted-nixos /mnt/snapshots
|
||||||
|
mount /dev/nvme0n1p1 /mnt/boot
|
||||||
|
|
||||||
|
# create a swapfile on btrfs file system
|
||||||
|
# This command will disable CoW / compression on the swap subvolume and then create a swapfile.
|
||||||
|
# because the linux kernel requires that swapfile must not be compressed or have copy-on-write(CoW) enabled.
|
||||||
|
btrfs filesystem mkswapfile --size 96g --uuid clear /mnt/swap/swapfile
|
||||||
|
|
||||||
|
# check whether the swap subvolume has CoW disabled
|
||||||
|
# the output of `lsattr` for the swap subvolume should be:
|
||||||
|
# ---------------C------ /swap/swapfile
|
||||||
|
# if not, delete the swapfile, and rerun the commands above.
|
||||||
|
lsattr /mnt/swap
|
||||||
|
|
||||||
|
# mount the swapfile as swap area
|
||||||
|
swapon swapfile
|
||||||
|
```
|
||||||
|
|
||||||
|
Now, the disk status should be:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# show disk status
|
||||||
|
$ lsblk
|
||||||
|
nvme0n1 259:0 0 1.8T 0 disk
|
||||||
|
├─nvme0n1p1 259:2 0 600M 0 part /mnt/boot
|
||||||
|
└─nvme0n1p2 259:3 0 1.8T 0 part
|
||||||
|
└─crypted-nixos 254:0 0 1.8T 0 crypt /mnt/swap
|
||||||
|
/mnt/persistent
|
||||||
|
/mnt/snapshots
|
||||||
|
/mnt/nix
|
||||||
|
/mnt/tmp
|
||||||
|
|
||||||
|
# show swap status
|
||||||
|
$ swapon -s
|
||||||
|
Filename Type Size Used Priority
|
||||||
|
/swap/swapfile file 100663292 0 -2
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Generating the NixOS Configuration and Installing NixOS
|
||||||
|
|
||||||
|
Clone this repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# enter an shell with git/vim/ssh-agent/gnumake available
|
||||||
|
nix-shell -p git vim gnumake
|
||||||
|
|
||||||
|
# clone this repository
|
||||||
|
git clone https://github.com/ryan4yin/nix-config.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, generate the NixOS configuration:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# nixos configurations
|
||||||
|
nixos-generate-config --root /mnt
|
||||||
|
|
||||||
|
# we need to update our filesystem configs in old hardware-configuration.nix according to the generated one.
|
||||||
|
cp /etc/nixos/hardware-configuration.nix ./nix-config/hosts/idols/ai/hardware-configuration-new.nix
|
||||||
|
vim .
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, Install NixOS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/nix-config
|
||||||
|
|
||||||
|
# run this command if you're retrying to run nixos-install
|
||||||
|
rm -rf /mnt/etc
|
||||||
|
|
||||||
|
# install nixos
|
||||||
|
# NOTE: the root password you set here will be discarded when reboot
|
||||||
|
nixos-install --root /mnt --flake .#ai --no-root-password
|
||||||
|
|
||||||
|
# if you want to use a cache mirror, run this command instead
|
||||||
|
# replace the mirror url with your own
|
||||||
|
nixos-install --root /mnt --flake .#ai --no-root-password --option substituters "https://mirror.sjtu.edu.cn/nix-channels/store"
|
||||||
|
|
||||||
|
# enter into the installed system, check password & users
|
||||||
|
nixos-enter
|
||||||
|
|
||||||
|
# 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/
|
||||||
|
|
||||||
|
|
||||||
|
# delte the generated configuration after editing
|
||||||
|
rm -f /mnt/etc/nixos
|
||||||
|
rm ~/nix-config/hosts/idols/ai/hardware-configuration-new.nix
|
||||||
|
|
||||||
|
# commit the changes after installing nixos successfully
|
||||||
|
git config --global user.email "ryan4yin@linux.com"
|
||||||
|
git config --global user.name "Ryan Yin"
|
||||||
|
git commit -am "feat: update hardware-configuration"
|
||||||
|
|
||||||
|
# copy our configuration to the installed file system
|
||||||
|
cp -r ../nix-config /mnt/etc/nixos
|
||||||
|
```
|
||||||
|
|
||||||
|
And then reboot.
|
||||||
|
|
||||||
|
|
||||||
|
## Deploying the main flake's NixOS configuration
|
||||||
|
|
||||||
|
After rebooting, we can deploy the main flake's NixOS configuration by running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Add the ssh key to the ssh-agent, so that nixos-rebuild can use it to pull my private git repositories.
|
||||||
|
ssh-add ~/.ssh/xxx
|
||||||
|
|
||||||
|
sudo mv /etc/nixos ~/nix-config
|
||||||
|
chown -R ryan:ryan ~/nix-config
|
||||||
|
|
||||||
|
cd ~/nix-config
|
||||||
|
|
||||||
|
# deploy the configuration
|
||||||
|
make hypr
|
||||||
|
```
|
||||||
|
|
||||||
|
Finally, to enable secure boot, follow the instructions in [lanzaboote - Quick Start](https://github.com/nix-community/lanzaboote/blob/master/docs/QUICK_START.md) and [nix-config/ai/secure-boot.nix](https://github.com/ryan4yin/nix-config/blob/main/hosts/idols/ai/secureboot.nix)
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
_: {
|
||||||
|
networking = {
|
||||||
|
hostName = "ai";
|
||||||
|
defaultGateway = "192.168.5.201";
|
||||||
|
networkmanager.enable = true;
|
||||||
|
};
|
||||||
|
system.stateVersion = "23.11";
|
||||||
|
}
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"impermanence": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1697303681,
|
||||||
|
"narHash": "sha256-caJ0rXeagaih+xTgRduYtYKL1rZ9ylh06CIrt1w5B4g=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "impermanence",
|
||||||
|
"rev": "0f317c2e9e56550ce12323eb39302d251618f5b5",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "impermanence",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1701389149,
|
||||||
|
"narHash": "sha256-rU1suTIEd5DGCaAXKW6yHoCfR1mnYjOXQFOaH7M23js=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "5de0b32be6e85dc1a9404c75131316e4ffbc634c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-23.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"impermanence": "impermanence",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
description = "NixOS configuration of Ryan Yin";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||||
|
impermanence.url = "github:nix-community/impermanence";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs @ {nixpkgs, ...}: {
|
||||||
|
nixosConfigurations = {
|
||||||
|
ai = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
specialArgs = inputs;
|
||||||
|
modules = [
|
||||||
|
./configuration.nix
|
||||||
|
./system.nix
|
||||||
|
|
||||||
|
../hardware-configuration.nix
|
||||||
|
../impermanence.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
{pkgs, ...}: {
|
||||||
|
# Set your time zone.
|
||||||
|
time.timeZone = "Asia/Shanghai";
|
||||||
|
|
||||||
|
# Select internationalisation properties.
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
|
||||||
|
i18n.extraLocaleSettings = {
|
||||||
|
LC_ADDRESS = "zh_CN.UTF-8";
|
||||||
|
LC_IDENTIFICATION = "zh_CN.UTF-8";
|
||||||
|
LC_MEASUREMENT = "zh_CN.UTF-8";
|
||||||
|
LC_MONETARY = "zh_CN.UTF-8";
|
||||||
|
LC_NAME = "zh_CN.UTF-8";
|
||||||
|
LC_NUMERIC = "zh_CN.UTF-8";
|
||||||
|
LC_PAPER = "zh_CN.UTF-8";
|
||||||
|
LC_TELEPHONE = "zh_CN.UTF-8";
|
||||||
|
LC_TIME = "zh_CN.UTF-8";
|
||||||
|
};
|
||||||
|
|
||||||
|
# ssh-agent is used to pull my private secrets repo from github when depoloying my nixos config.
|
||||||
|
programs.ssh.startAgent = true;
|
||||||
|
|
||||||
|
# List packages installed in system profile. To search, run:
|
||||||
|
# $ nix search wget
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||||
|
git
|
||||||
|
gnumake
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
nix-output-monitor
|
||||||
|
];
|
||||||
|
|
||||||
|
users.groups = {
|
||||||
|
"ryan" = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Don't allow mutation of users outside the config.
|
||||||
|
users = {
|
||||||
|
mutableUsers = false;
|
||||||
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
|
users = {
|
||||||
|
ryan = {
|
||||||
|
# generated by `mkpasswd -m scrypt`
|
||||||
|
# we have to use initialHashedPassword here, if your'are using tmpfs for /
|
||||||
|
initialHashedPassword = "$7$CU..../....Sdl/JRH..9eIvZ6mE/52r.$xeR6lyvTcVVKt28Owcoc/vPOOECcYSiq1xjw/QCz2t0";
|
||||||
|
isNormalUser = true;
|
||||||
|
description = "ryan";
|
||||||
|
extraGroups = ["ryan" "networkmanager" "wheel"];
|
||||||
|
};
|
||||||
|
root.initialHashedPassword = "$7$CU..../....X6uvZYnFD.i1CqqFFNl4./$4vgqzIPyw5XBr0aCDFbY/UIRRJr7h5SMGoQ/ZvX3FP2";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# make ryan a trusted user so he can set custom nix substituters url(cache mirror) to speed up nixos-rebuild.
|
||||||
|
nix.settings.trusted-users = ["ryan"];
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
lanzaboote,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
# How to enter setup mode - msi motherboard
|
||||||
|
## 1. enter BIOS via [Del] Key
|
||||||
|
## 2. <Advance mode> => <Settings> => <Security> => <Secure Boot>
|
||||||
|
## 3. enable <Secure Boot>
|
||||||
|
## 4. set <Secure Boot Mode> to <Custom>
|
||||||
|
## 5. enter <Key Management>
|
||||||
|
## 6. select <Delete All Secure Boot Variables>, and then select <No> for <Reboot Without Saving>
|
||||||
|
## 7. Press F10 to saving and reboot.
|
||||||
|
imports = [
|
||||||
|
lanzaboote.nixosModules.lanzaboote
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
# For debugging and troubleshooting Secure Boot.
|
||||||
|
pkgs.sbctl
|
||||||
|
];
|
||||||
|
|
||||||
|
# Lanzaboote currently replaces the systemd-boot module.
|
||||||
|
# This setting is usually set to true in configuration.nix
|
||||||
|
# generated at installation time. So we force it to false
|
||||||
|
# for now.
|
||||||
|
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||||
|
|
||||||
|
boot.lanzaboote = {
|
||||||
|
enable = true;
|
||||||
|
pkiBundle = "/etc/secureboot";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,19 +1,9 @@
|
|||||||
{...} @ args:
|
|
||||||
#############################################################
|
#############################################################
|
||||||
#
|
#
|
||||||
# Aquamarine - A NixOS VM running on Proxmox
|
# Aquamarine - A NixOS VM running on Proxmox
|
||||||
#
|
#
|
||||||
#############################################################
|
#############################################################
|
||||||
{
|
{
|
||||||
imports = [
|
|
||||||
../../../modules/nixos/proxmox-hardware-configuration.nix
|
|
||||||
|
|
||||||
../../../modules/nixos/core-server.nix
|
|
||||||
../../../modules/nixos/user-group.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
nixpkgs.overlays = import ../../../overlays args;
|
|
||||||
|
|
||||||
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
|
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
|
||||||
boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"];
|
boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"];
|
||||||
# supported fil systems, so we can mount any removable disks with these filesystems
|
# supported fil systems, so we can mount any removable disks with these filesystems
|
||||||
@@ -60,5 +50,5 @@
|
|||||||
# 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 = "22.11"; # Did you read the comment?
|
system.stateVersion = "23.11"; # Did you read the comment?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,9 @@
|
|||||||
{...} @ args:
|
|
||||||
#############################################################
|
#############################################################
|
||||||
#
|
#
|
||||||
# Kana - a NixOS VM running on Proxmox
|
# Kana - a NixOS VM running on Proxmox
|
||||||
#
|
#
|
||||||
#############################################################
|
#############################################################
|
||||||
{
|
{
|
||||||
imports = [
|
|
||||||
../../../modules/nixos/proxmox-hardware-configuration.nix
|
|
||||||
|
|
||||||
../../../modules/nixos/core-server.nix
|
|
||||||
../../../modules/nixos/user-group.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
nixpkgs.overlays = import ../../../overlays args;
|
|
||||||
|
|
||||||
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
|
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
|
||||||
boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"];
|
boot.binfmt.emulatedSystems = ["aarch64-linux" "riscv64-linux"];
|
||||||
# supported fil systems, so we can mount any removable disks with these filesystems
|
# supported fil systems, so we can mount any removable disks with these filesystems
|
||||||
@@ -60,5 +50,5 @@
|
|||||||
# 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.05"; # Did you read the comment?
|
system.stateVersion = "23.11"; # Did you read the comment?
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user