Compare commits

...

97 Commits

Author SHA1 Message Date
Ryan Yin 1d6ffd7785 Merge pull request #33 from ryan4yin/modular-home
feat: Modular home
2023-12-25 00:10:56 +08:00
Ryan Yin 647f56d213 chore: remove useless config in hyprland 2023-12-25 00:08:11 +08:00
Ryan Yin 210aa544fc fix: user environment variables do not take effects 2023-12-25 00:01:15 +08:00
Ryan Yin 5e83259bcb fix: enable nvidia on idol-ai 2023-12-24 23:32:08 +08:00
Ryan Yin 0a2aae246a fix: neovim fzf 2023-12-24 23:05:58 +08:00
Ryan Yin 30881f356a feat: modular i3's configurations 2023-12-24 22:51:32 +08:00
Ryan Yin 3aaaeb49ca feat: modular hyprland's configurations 2023-12-24 22:39:27 +08:00
Ryan Yin 55e12cddaf feat: modular ssh config 2023-12-24 21:43:14 +08:00
Ryan Yin ac4f625768 feat: modular home 2023-12-24 20:56:44 +08:00
Ryan Yin 2d44bc6006 Merge pull request #32 from ryan4yin/apple-t2
feat: new host - shoukei
2023-12-24 19:29:38 +08:00
Ryan Yin 03c1d14ed9 feat: new host - shoukei 2023-12-24 19:27:31 +08:00
Ryan Yin 73a746cebd fix: darwin 2023-12-24 01:00:56 +08:00
Ryan Yin 1e9dc4df4b feat: share openssh's authorizedKeys between darwin & NixOS 2023-12-23 22:00:40 +08:00
Ryan Yin 7dd55a5de9 chore: nix fmt 2023-12-23 21:39:51 +08:00
Ryan Yin e61116140d Merge pull request #31 from ryan4yin/modular
feat: refactoring configuration with `options` to make it more modular
2023-12-23 21:36:09 +08:00
Ryan Yin b75b79057b feat: refactoring configuration with options to make it more modular 2023-12-23 21:35:12 +08:00
Ryan Yin 1f08d10ac7 fix: man page show odd characters 2023-12-23 19:57:57 +08:00
Ryan Yin b2cf885637 fix: missing hyprland's packages 2023-12-23 19:31:37 +08:00
Ryan Yin 44eb487df9 refactor: home-manager 2023-12-23 17:43:57 +08:00
Ryan Yin 006bf56fd7 docs: why install i3/hyprland in home-manager instead of NixOS 2023-12-23 17:36:07 +08:00
Ryan Yin 73e3707570 refactor: start i3/hyprland in home-manager instead of NixOS 2023-12-23 17:23:25 +08:00
Ryan Yin 82cfa4c6f7 feat: my custom libAttrs 2023-12-23 11:06:50 +08:00
Ryan Yin 27dd5ebb13 docs: update README 2023-12-23 11:06:50 +08:00
Ryan Yin a589feee7b feat: homebrew - darwin 2023-12-22 21:23:23 +08:00
Ryan Yin a9459e7606 feat: darwin 2023-12-22 21:20:02 +08:00
Ryan Yin ad86ed60dc feat: update PATH 2023-12-22 21:03:25 +08:00
Ryan Yin 2a42da46ad fix: mitmproxy on macOS 2023-12-22 17:01:30 +08:00
Ryan Yin 1817f41423 feat: update for shells 2023-12-22 16:59:56 +08:00
Ryan Yin 217057612c feat: migrate yazi into base 2023-12-22 16:43:37 +08:00
Ryan Yin a1b5572eea refactor: via statix 2023-12-22 12:07:37 +08:00
Ryan Yin cddd8101c7 fix: darwin fern 2023-12-22 09:49:09 +08:00
Ryan Yin d6f6154a22 fix: suzu - orangepi5 2023-12-22 01:49:28 +08:00
Ryan Yin 8ac24e4f13 refactor: replace mapAttrs' with mapAttrs 2023-12-22 01:43:28 +08:00
Ryan Yin e4abf62ec3 refactor: replace listToAttrs with mapAttrs' to get a cleaner definition 2023-12-22 01:28:48 +08:00
Ryan Yin 05aa451895 refactor: systems 2023-12-22 01:18:25 +08:00
Ryan Yin c49a96ae29 docs: update docs for idols - ai 2023-12-22 00:18:04 +08:00
Ryan Yin ac3c05545f fix: typo 2023-12-22 00:15:30 +08:00
Ryan Yin b12af73ff6 fix: increase of tmpfs's size by mount a btrfs subvolume for it
feat: migrate nixos-installer from a separate branch into a folder
2023-12-22 00:13:21 +08:00
Ryan Yin 45b52845f7 feat: disable flake_check in ci 2023-12-21 17:48:18 +08:00
Ryan Yin 434b3bfe81 feat: enable zram 2023-12-21 17:10:11 +08:00
Ryan Yin 6c1cd365a0 feat: enable zram 2023-12-21 17:09:34 +08:00
Ryan Yin b1d9bbc26e feat: enable zram 2023-12-21 17:08:39 +08:00
Ryan Yin 76b0b1c68d fix: disable flake_check in ci temporarily 2023-12-21 15:37:28 +08:00
Ryan Yin 6dca4d1492 docs: README 2023-12-21 15:32:28 +08:00
Ryan Yin a237c108d1 fix: bash in mkShell 2023-12-21 14:46:20 +08:00
Ryan Yin 9832a955e4 feat: darwin - homebrew mirror, replace iglance with stats 2023-12-21 12:24:12 +08:00
Ryan Yin c90bb514d0 feat: new aarch64-darwin host - fern 2023-12-21 12:03:16 +08:00
Ryan Yin 932e1a236c Merge pull request #30 from ryan4yin/fern
feat: new aarch64-darwin host - fern
2023-12-20 23:02:46 +08:00
Ryan Yin e70f7269f4 feat: new aarch64-darwin host - fern 2023-12-20 21:43:16 +08:00
Ryan Yin a07dfbe36a feat: replace agenix with ragenix 2023-12-20 15:37:33 +08:00
Ryan Yin d57e3ff61b fix: fcitx5 theme 2023-12-20 13:29:25 +08:00
Ryan Yin 6f38faef79 fix: ci 2023-12-20 13:25:42 +08:00
Ryan Yin 50d9301e13 feat: migrate capptuccin themes into my nur-packages, add nix's access-tokens into secrets 2023-12-20 13:13:54 +08:00
Ryan Yin 58b02a6b16 feat: replace home.activation.xxx via home.file.<name>.force 2023-12-20 10:45:01 +08:00
Ryan Yin 29511fa574 feat: refactor flake.nix 2023-12-20 02:19:40 +08:00
Ryan Yin 809a68fa27 feat: add github workflow - flake_check 2023-12-19 21:03:59 +08:00
Ryan Yin 2ac43c8a33 feat: add github workflow - flake_check 2023-12-19 20:45:53 +08:00
Ryan Yin 802e9e6e39 feat: auto nix develop - direnv 2023-12-19 20:45:27 +08:00
Ryan Yin 625691084a fix: The following files have unrecognized content and would be overwritten: /etc/bashrc /etc/zshrc /etc/zshenv 2023-12-18 15:09:43 +08:00
Ryan Yin 38e7a45bb8 fix: agenix on nix-darwin 2023-12-18 14:42:03 +08:00
Ryan Yin dbe62811c7 fix: agenix on nix-darwin, update flake.nix 2023-12-18 14:05:45 +08:00
Ryan Yin 8d83ded0fb feat: update git pre-commit checks 2023-12-18 11:14:17 +08:00
Ryan Yin 74cec7dd8e feat: nix fmt 2023-12-18 01:06:28 +08:00
Ryan Yin b2f75a37dc feat: nix fmt 2023-12-18 00:36:59 +08:00
Ryan Yin a04a058077 feat: refactor, hyprland - greet with autologin 2023-12-18 00:32:41 +08:00
Ryan Yin 7d03e63bdd feat: upgrade system.stateVersion
feat: autologin - hyprland / i3
feat: 256color for console tty
2023-12-17 05:59:22 +08:00
Ryan Yin 1cf34add85 fix: fcitx - macOS 2023-12-17 00:09:13 +08:00
Ryan Yin 20b6aa07af feat: update flake.lock, add eye-protection.nix 2023-12-17 00:08:54 +08:00
Ryan Yin ab5a68ce9d feat: change linux kernel to xanmod 2023-12-16 21:44:05 +08:00
Ryan Yin da729c1ade feat: add aws ssm plugin 2023-12-13 18:10:05 +08:00
Ryan Yin f899d59da9 docs: impermanence - ai 2023-12-13 12:23:21 +08:00
Ryan Yin ca8f0dc166 feat: disable nix channel 2023-12-13 11:57:59 +08:00
Ryan Yin 393338a23d fix: disable docker storageDriver 2023-12-12 23:39:35 +08:00
Ryan Yin 5ca251646a feat: docker - pulling using containerd 2023-12-12 22:08:32 +08:00
Ryan Yin 75ef84913f fix: agenix failed to decrypt secrets when booting 2023-12-12 20:37:03 +08:00
Ryan Yin b92537e264 fix: nix-darwin 2023-12-12 11:28:24 +08:00
Ryan Yin e3a17925f2 fix: nix optimise storage 2023-12-09 16:37:54 +08:00
Ryan Yin c170e251ac fix: nixConfig.extra-sbustituers https://github.com/ryan4yin/nixos-and-flakes-book/discussions/62#discussioncomment-7805510 2023-12-09 14:18:19 +08:00
Ryan Yin ec1747707b fix: terminfo 2023-12-08 17:50:32 +08:00
Ryan Yin 56f2abc737 fix: terminfo error on macOS 2023-12-08 14:24:44 +08:00
Ryan Yin cb6f46aea8 fix: syntax error, optimise tmux 2023-12-07 22:38:04 +08:00
Ryan Yin dfab5ddacc fix: TERM and TERMINFO 2023-12-07 22:02:01 +08:00
Ryan Yin 0e2faec44f docs: wezterm crash with the latest hyprland 2023-12-07 21:12:17 +08:00
Ryan Yin 88671c40e7 Merge pull request #27 from ryan4yin/fix-nushell-neovim
fix: environment variables missed in nushell
2023-12-07 20:10:01 +08:00
Ryan Yin 9f59301a0e fix: environment variables missed in nushell
fix: https://github.com/ryan4yin/nix-config/issues/26
2023-12-07 13:10:15 +08:00
Ryan Yin d13a353921 revert: shell wrapper for neovim's terminal still useless on macOS 2023-12-07 10:47:08 +08:00
Ryan Yin 989989ecc6 docs: update comments 2023-12-07 10:39:03 +08:00
Ryan Yin 0a66a3b0a3 docs: comment for nvim-shell 2023-12-07 00:27:30 +08:00
Ryan Yin be036118ca feat: optimise autosave.nvim 2023-12-06 23:50:07 +08:00
Ryan Yin 601fcafd31 fix: autosave.nvim & yazi 2023-12-06 23:07:01 +08:00
Ryan Yin 087d38487c feat: access extraPackages in neovim's terminal - add a shell wrapper 2023-12-06 22:39:10 +08:00
Ryan Yin b0e481a1f1 fix: package collisions 2023-12-06 11:45:26 +08:00
Ryan Yin 1ca7607814 feat: update yazi, add tools for java development 2023-12-05 21:05:37 +08:00
Ryan Yin 59ea29a7ab feat: auto chmod agenix's secrets on darwin 2023-12-05 12:12:32 +08:00
Ryan Yin 486a3b343c feat: disable flatpak 2023-12-05 12:01:07 +08:00
Ryan Yin 3b7772712e docs: update README 2023-12-05 11:44:19 +08:00
Ryan Yin 37b34beca4 feat: enable waydroid & lxd 2023-12-05 11:18:15 +08:00
225 changed files with 4287 additions and 2626 deletions
+1
View File
@@ -0,0 +1 @@
use flake
+24
View File
@@ -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
+2
View File
@@ -1,3 +1,5 @@
result result
result/ result/
.direnv/
.DS_Store .DS_Store
.pre-commit-config.yaml
+24 -6
View File
@@ -13,9 +13,15 @@
i3: i3:
nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo
s-i3:
nixos-rebuild switch --flake .#shoukei_i3 --use-remote-sudo
hypr: hypr:
nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo
s-hypr:
nixos-rebuild switch --flake .#shoukei_hyprland --use-remote-sudo
i3-debug: i3-debug:
nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo --show-trace --verbose nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo --show-trace --verbose
@@ -33,12 +39,15 @@ upp:
history: history:
nix profile history --profile /nix/var/nix/profiles/system nix profile history --profile /nix/var/nix/profiles/system
repl:
nix repl -f flake:nixpkgs
gc: gc:
# remove all generations older than 7 days # remove all generations older than 7 days
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
# garbage collect all unused nix store entries # garbage collect all unused nix store entries
sudo nix store gc --debug # sudo nix store gc --debug
############################################################################ ############################################################################
# #
@@ -48,15 +57,27 @@ gc:
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
############################################################################ ############################################################################
# #
@@ -138,6 +159,3 @@ fmt:
# format the nix files in this repo # format the nix files in this repo
nix fmt nix fmt
.PHONY: clean
clean:
rm -rf result
+47 -51
View File
@@ -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** | [anyrun][anyrun] | [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] | [imv][imv] | | **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
@@ -69,7 +73,6 @@ See [./home/base/desktop/neovim](./home/base/desktop/neovim) for details.
See [./hosts](./hosts) for details. See [./hosts](./hosts) for details.
## Secrets Management ## Secrets Management
See [./secrets](./secrets) for details. See [./secrets](./secrets) for details.
@@ -78,18 +81,10 @@ See [./secrets](./secrets) for details.
> :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. > :red_circle: **IMPORTANT**: **You should NOT deploy this flake directly on your machine:exclamation: It will not succeed.** this flake contains my hardware configuration(such as [hardware-configuration.nix](hosts/idols/ai/hardware-configuration.nix), [cifs-mount.nix](https://github.com/ryan4yin/nix-config/blob/v0.1.1/hosts/idols/ai/cifs-mount.nix), [Nvidia Support](https://github.com/ryan4yin/nix-config/blob/v0.1.1/hosts/idols/ai/default.nix#L77-L91), etc.) which is not suitable for your hardware, and my private secrets repository [ryan4yin/nix-secrets](https://github.com/ryan4yin/nix-config/tree/main/secrets) that only I have access to. You may use this repo as a reference to build your own configuration.
For MacOS:
```bash
# deploy the darwin configuration(harmonicia)
make ha
# deploy with details
make ha-debug
```
For NixOS: For NixOS:
> To deploy this flake from NixOS's official ISO image(purest installation method), please refer to [./nixos-installer/](./nixos-installer/)
> Need to restart the machine when switching between `wayland` and `xorg`. > Need to restart the machine when switching between `wayland` and `xorg`.
```bash ```bash
@@ -106,27 +101,22 @@ make i3-debug
# make hypr-debug # make hypr-debug
``` ```
To deploy this flake from NixOS's official ISO image(purest installation method), please refer to [ryan4yin/nix-config/nixos-install](https://github.com/ryan4yin/nix-config/tree/nixos-install) For macOS:
## Install Apps from Flatpak
We can install apps from flathub, which has a lot of apps that are not supported well in nixpkgs.
```bash ```bash
# Add the Flathub repository # deploy harmonicia's configuration(macOS Intel)
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo make ha
# install apps from flathub # deploy fern's configuration(Apple Silicon)
flatpak install netease-cloud-music-gtk make fe
# install 3d printer slicer - cura # deploy with details
flatpak install flathub com.ultimaker.cura make ha-debug
# make fe
# or you can search apps from flathub
flatpak search <keyword>
# search on website is also supported: https://flathub.org/
``` ```
> [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...)
## How to create & managage VM from this flake? ## How to create & managage VM from this flake?
use `aquamarine` as an example, we can create a virtual machine with the following command: use `aquamarine` as an example, we can create a virtual machine with the following command:
@@ -169,6 +159,9 @@ Other dotfiles that inspired me:
- [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)
- [fufexan/dotfiles](https://github.com/fufexan/dotfiles): gtk theme, xdg, git, media, anyrun, etc. - [fufexan/dotfiles](https://github.com/fufexan/dotfiles): gtk theme, xdg, git, media, anyrun, etc.
- Modularized NixOS Configuration
- [hlissner/dotfiles](https://github.com/hlissner/dotfiles)
- [viperML/dotfiles](https://github.com/viperML/dotfiles)
- Hyprland(wayland) - Hyprland(wayland)
- [notwidow/hyprland](https://github.com/notwidow/hyprland): This is where I start my hyprland journey. - [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. - [HeinzDev/Hyprland-dotfiles](https://github.com/HeinzDev/Hyprland-dotfiles): Refer to the waybar configuration here.
@@ -213,3 +206,6 @@ Other dotfiles that inspired me:
[thunar]: https://gitlab.xfce.org/xfce/thunar [thunar]: https://gitlab.xfce.org/xfce/thunar
[ranger]: https://github.com/ranger/ranger [ranger]: https://github.com/ranger/ranger
[Catppuccin]: https://github.com/catppuccin/catppuccin [Catppuccin]: https://github.com/catppuccin/catppuccin
[Btrfs]: https://btrfs.readthedocs.io
[LUKS]: https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system
[lanzaboote]: https://github.com/nix-community/lanzaboote
+17
View File
@@ -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
+264 -450
View File
File diff suppressed because it is too large Load Diff
+77 -320
View File
@@ -16,258 +16,72 @@
outputs = inputs @ { outputs = inputs @ {
self, self,
nixpkgs, nixpkgs,
nixpkgs-unstable, pre-commit-hooks,
nix-darwin,
home-manager,
nixos-generators,
nixos-licheepi4a,
nixos-rk3588,
... ...
}: 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);
riscv64_system = "riscv64-linux";
aarch64_system = "aarch64-linux";
allSystems = [x64_system x64_darwin riscv64_system aarch64_system];
nixosSystem = import ./lib/nixosSystem.nix; allSystemConfigurations = import ./systems {inherit self inputs constants;};
macosSystem = import ./lib/macosSystem.nix; in
colmenaSystem = import ./lib/colmenaSystem.nix; allSystemConfigurations
// {
# 星野 アイ, 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;
};
idol_aquamarine_tags = ["dist-build" "aqua"];
# 星野 瑠美衣, Hoshino Rubii
idol_ruby_modules = {
nixos-modules = [
./hosts/idols/ruby
];
home-module = import ./home/linux/server.nix;
};
idol_ruby_tags = ["dist-build" "ruby"];
# 有馬 かな, Arima Kana
idol_kana_modules = {
nixos-modules = [
./hosts/idols/kana
];
home-module = import ./home/linux/server.nix;
};
idol_kana_tags = ["dist-build" "kana"];
# 森友 望未, Moritomo Nozomi
rolling_nozomi_modules = {
nixos-modules = [
./hosts/rolling_girls/nozomi
];
# home-module = import ./home/linux/server-riscv64.nix;
};
rolling_nozomi_tags = ["riscv" "nozomi"];
# 小坂 結季奈, Kosaka Yukina
rolling_yukina_modules = {
nixos-modules = [
./hosts/rolling_girls/yukina
];
# home-module = import ./home/linux/server-riscv64.nix;
};
rolling_yukina_tags = ["riscv" "yukina"];
# 大木 鈴, Ōki Suzu
_12kingdoms_suzu_modules = {
nixos-modules = [
./hosts/12kingdoms/suzu
];
# home-module = import ./home/linux/server.nix;
};
_12kingdoms_suzu_tags = ["aarch" "suzu"];
x64_specialArgs =
{
inherit username userfullname useremail;
# use unstable branch for some packages to get the latest updates
pkgs-unstable = import nixpkgs-unstable {
system = x64_system; # refer the `system` parameter form outer scope recursively
# To use chrome, we need to allow the installation of non-free software
config.allowUnfree = true;
};
}
// inputs;
in {
nixosConfigurations = let
base_args = {
inherit home-manager nixos-generators;
nixpkgs = nixpkgs; # or nixpkgs-unstable
system = x64_system;
specialArgs = x64_specialArgs;
};
in {
# ai with i3 window manager
ai_i3 = nixosSystem (idol_ai_modules_i3 // base_args);
# ai with hyprland compositor
ai_hyprland = nixosSystem (idol_ai_modules_hyprland // base_args);
# three virtual machines without desktop environment.
aquamarine = nixosSystem (idol_aquamarine_modules // base_args);
ruby = nixosSystem (idol_ruby_modules // base_args);
kana = nixosSystem (idol_kana_modules // base_args);
};
# colmena - remote deployment via SSH
colmena = let
# x86_64 related
x64_base_args = {
inherit home-manager;
nixpkgs = nixpkgs; # or nixpkgs-unstable
specialArgs = x64_specialArgs;
};
# riscv64 related
# using the same nixpkgs as nixos-licheepi4a to utilize the cross-compilation cache.
lpi4a_pkgs = import nixos-licheepi4a.inputs.nixpkgs {system = x64_system;};
lpi4a_specialArgs =
{
inherit username userfullname useremail;
pkgsKernel = nixos-licheepi4a.packages.${x64_system}.pkgsKernelCross;
}
// inputs;
lpi4a_base_args = {
inherit home-manager;
nixpkgs = nixos-licheepi4a.inputs.nixpkgs; # or nixpkgs-unstable
specialArgs = lpi4a_specialArgs;
targetUser = "root";
};
# aarch64 related
# using the same nixpkgs as nixos-rk3588 to utilize the cross-compilation cache.
rk3588_pkgs = import nixos-rk3588.inputs.nixpkgs {system = x64_system;};
rk3588_specialArgs =
{
inherit username userfullname useremail;
}
// nixos-rk3588.inputs;
rk3588_base_args = {
inherit home-manager;
nixpkgs = nixos-rk3588.inputs.nixpkgs; # or nixpkgs-unstable
specialArgs = rk3588_specialArgs;
targetUser = "root";
};
in {
meta = {
nixpkgs = import nixpkgs {system = x64_system;};
specialArgs = x64_specialArgs;
nodeSpecialArgs = {
# riscv64 SBCs
nozomi = lpi4a_specialArgs;
yukina = lpi4a_specialArgs;
# aarch64 SBCs
suzu = rk3588_specialArgs;
};
nodeNixpkgs = {
nozomi = lpi4a_pkgs;
yukina = lpi4a_pkgs;
# aarch64 SBCs
suzu = rk3588_pkgs;
};
};
# proxmox virtual machines(x86_64)
aquamarine = colmenaSystem (idol_aquamarine_modules // x64_base_args // {host_tags = idol_aquamarine_tags;});
ruby = colmenaSystem (idol_ruby_modules // x64_base_args // {host_tags = idol_ruby_tags;});
kana = colmenaSystem (idol_kana_modules // x64_base_args // {host_tags = idol_kana_tags;});
# riscv64 SBCs
nozomi = colmenaSystem (rolling_nozomi_modules // lpi4a_base_args // {host_tags = rolling_nozomi_tags;});
yukina = colmenaSystem (rolling_yukina_modules // lpi4a_base_args // {host_tags = rolling_yukina_tags;});
# aarch64 SBCs
suzu = colmenaSystem (_12kingdoms_suzu_modules // rk3588_base_args // {host_tags = _12kingdoms_suzu_tags;});
};
# take system images for idols
# https://github.com/nix-community/nixos-generators
packages."${x64_system}" =
# genAttrs returns an attribute set with the given keys and values(host => image).
nixpkgs.lib.genAttrs [
"ai_i3"
"ai_hyprland"
] (
# generate iso image for hosts with desktop environment
host:
self.nixosConfigurations.${host}.config.formats.iso
)
// nixpkgs.lib.genAttrs [
"aquamarine"
"ruby"
"kana"
] (
# generate proxmox image for virtual machines without desktop environment
host:
self.nixosConfigurations.${host}.config.formats.proxmox
); );
# macOS's configuration, for work. # 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 nixpkgs; 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
// { nixpkgs.legacyPackages.${system}.bashInteractive
darwin-modules = [ ];
./hosts/harmonica name = "dots";
]; shellHook = ''
home-module = import ./home/darwin; ${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,
@@ -287,6 +101,7 @@
url = "github:lnl7/nix-darwin"; url = "github:lnl7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs-darwin"; inputs.nixpkgs.follows = "nixpkgs-darwin";
}; };
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# home-manager, used for managing user configuration # home-manager, used for managing user configuration
home-manager = { home-manager = {
@@ -306,10 +121,13 @@
impermanence.url = "github:nix-community/impermanence"; impermanence.url = "github:nix-community/impermanence";
# modern window compositor hyprland = {
hyprland.url = "github:hyprwm/Hyprland/v0.32.3"; url = "github:hyprwm/Hyprland/v0.33.1";
inputs.nixpkgs.follows = "nixpkgs";
};
# community wayland nixpkgs # community wayland nixpkgs
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; # nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
# anyrun - a wayland launcher # anyrun - a wayland launcher
anyrun = { anyrun = {
url = "github:Kirottu/anyrun"; url = "github:Kirottu/anyrun";
@@ -321,15 +139,26 @@
url = "github:nix-community/nixos-generators"; url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
# secrets management
agenix = {
# lock with git commit at 0.14.0
url = "github:ryantm/agenix/54693c91d923fecb4cf04c4535e3d84f8dec7919";
# replaced with a type-safe reimplementation to get a better error message and less bugs.
# url = "github:ryan4yin/ragenix";
inputs.nixpkgs.follows = "nixpkgs";
};
# secrets management, lock with git commit at 2023/7/15 # add git hooks to format nix code before commit
agenix.url = "github:ryantm/agenix/0d8c5325fc81daf00532e3e26c6752f7bcde1143"; pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
######################## Some non-flake repositories ######################################### ######################## Some non-flake repositories #########################################
# AstroNvim is an aesthetic and feature-rich neovim config. # AstroNvim is an aesthetic and feature-rich neovim config.
astronvim = { astronvim = {
url = "github:AstroNvim/AstroNvim/v3.37.12"; url = "github:AstroNvim/AstroNvim/v3.40.3";
flake = false; flake = false;
}; };
@@ -365,77 +194,5 @@
# aarch64 SBCs # aarch64 SBCs
nixos-rk3588.url = "github:ryan4yin/nixos-rk3588"; nixos-rk3588.url = "github:ryan4yin/nixos-rk3588";
######################## Color Schemes #########################################
# color scheme - catppuccin
catppuccin-btop = {
url = "github:catppuccin/btop";
flake = false;
};
catppuccin-fcitx5 = {
url = "github:catppuccin/fcitx5";
flake = false;
};
catppuccin-bat = {
url = "github:catppuccin/bat";
flake = false;
};
catppuccin-alacritty = {
url = "github:catppuccin/alacritty";
flake = false;
};
catppuccin-helix = {
url = "github:catppuccin/helix";
flake = false;
};
catppuccin-starship = {
url = "github:catppuccin/starship";
flake = false;
};
catppuccin-hyprland = {
url = "github:catppuccin/hyprland";
flake = false;
};
catppuccin-cava = {
url = "github:catppuccin/cava";
flake = false;
};
cattppuccin-k9s = {
url = "github:catppuccin/k9s";
flake = false;
};
};
# the nixConfig here only affects the flake itself, not the system configuration!
nixConfig = {
substituters = [
# cache mirror located in China
# status: https://mirror.sjtu.edu.cn/
"https://mirror.sjtu.edu.cn/nix-channels/store"
# status: https://mirrors.ustc.edu.cn/status/
# "https://mirrors.ustc.edu.cn/nix-channels/store"
# my own cache server
"https://ryan4yin.cachix.org"
"https://anyrun.cachix.org"
"https://hyprland.cachix.org"
"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 = [
"ryan4yin.cachix.org-1:Gbk27ZU5AYpGS9i3ssoLlwdvMIh0NxG0w8it/cv9kbU="
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
}; };
} }
@@ -1,12 +1,9 @@
{ username, ... }: { {username, ...}: {
imports = [
];
# Home Manager needs a bit of information about you and the # Home Manager needs a bit of information about you and the
# paths it should manage. # paths it should manage.
home = { home = {
username = username; inherit username;
homeDirectory = "/home/${username}";
# This value determines the Home Manager release that your # This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage # configuration is compatible with. This helps avoid breakage
@@ -16,7 +13,7 @@
# You can update Home Manager without changing this value. See # You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version # the Home Manager release notes for a list of state version
# changes in each release. # changes in each release.
stateVersion = "23.05"; stateVersion = "23.11";
}; };
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
+25 -20
View File
@@ -1,23 +1,28 @@
{ {pkgs, ...}: {
pkgs, home.packages = with pkgs;
... [
}: { # general tools
home.packages = with pkgs; [ pulumi
# general tools pulumictl
pulumi # istioctl
pulumictl
# istioctl
# aws # aws
awscli2 awscli2
aws-iam-authenticator ssm-session-manager-plugin # Amazon SSM Session Manager Plugin
eksctl aws-iam-authenticator
istioctl eksctl
istioctl
# aliyun # aliyun
aliyun-cli aliyun-cli
]; ]
++ (
programs = { if pkgs.stdenv.isLinux
}; then [
# cloud tools that nix do not have cache for.
terraform
terraformer # generate terraform configs from existing cloud resources
]
else []
);
} }
+1 -1
View File
@@ -7,7 +7,7 @@
skopeo skopeo
docker-compose docker-compose
dive # explore docker layers dive # explore docker layers
]; ];
programs = { programs = {
}; };
+2 -5
View File
@@ -1,6 +1,3 @@
{ ... }: { {mylib, ...}: {
imports = [ imports = mylib.scanPaths ./.;
./container.nix
./kubernetes.nix
];
} }
+15 -16
View File
@@ -1,7 +1,6 @@
{ {
pkgs, pkgs,
pkgs-unstable, nur-ryan4yin,
cattppuccin-k9s,
... ...
}: { }: {
home.packages = with pkgs; [ home.packages = with pkgs; [
@@ -12,20 +11,20 @@
programs = { programs = {
k9s = { k9s = {
enable = true; enable = true;
skin = skin = let
let skin_file = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-k9s}/dist/mocha.yml"; # theme - catppuccin mocha
skin_file = "${cattppuccin-k9s}/dist/mocha.yml"; # theme - cattppuccin mocha skin_attr = builtins.fromJSON (
skin_attr = builtins.fromJSON (builtins.readFile builtins.readFile
# replace 'base: &base "#1e1e2e"' with 'base: &base "default"' # replace 'base: &base "#1e1e2e"' with 'base: &base "default"'
# to make fg/bg color transparent. "default" means transparent in k9s skin. # to make fg/bg color transparent. "default" means transparent in k9s skin.
(pkgs.runCommandNoCC "get-skin-json" {} '' (pkgs.runCommandNoCC "get-skin-json" {} ''
cat ${skin_file} \ cat ${skin_file} \
| sed -E 's@(base: &base ).+@\1 "default"@g' \ | sed -E 's@(base: &base ).+@\1 "default"@g' \
| ${pkgs.yj}/bin/yj > $out | ${pkgs.yj}/bin/yj > $out
'') '')
); );
in in
skin_attr; skin_attr;
}; };
}; };
} }
+2 -14
View File
@@ -1,15 +1,3 @@
{...}: { {mylib, ...}: {
imports = [ imports = mylib.scanPaths ./.;
../server
./cloud
./container
./neovim
./terminal
./development.nix
./helix.nix
./media.nix
./shell.nix
];
} }
+56 -31
View File
@@ -8,46 +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
]
))
# DO NOT install build tools for C/C++ and others, set it per project by devShell instead cargo # rust package manager
gnumake # used by this repo, to simplify the deployment go
jdk17 # used to run some java based tools(.jar) jdk17
guile # scheme language
# scheme related # db related
guile dbeaver
mycli
pgcli
mongosh
sqlite
# python # embedded development
(python311.withPackages (ps: minicom
with ps; [
ipython
pandas
requests
pyquery
pyyaml
]))
# db related # ai related
dbeaver python311Packages.huggingface-hub # huggingface-cli
mycli
pgcli
mongosh
sqlite
# embedded development # misc
minicom pkgs-unstable.devbox
glow # markdown previewer
fzf
gdu # disk usage analyzer, required by AstroNvim
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
bfg-repo-cleaner # remove large files from git history
k6 # load testing tool
protobuf # protocol buffer compiler
]
++ (
if pkgs.stdenv.isLinux
then [
# Automatically trims your branches whose tracking remote refs are merged or gone
# It's really useful when you work on a project for a long time.
git-trim
# other tools # need to run `conda-install` before using it
bfg-repo-cleaner # remove large files from git history # need to run `conda-shell` before using command `conda`
k6 # load testing tool # conda is not available for MacOS
protobuf # protocol buffer compiler conda
];
mitmproxy # http/https proxy tool
insomnia # REST client
wireshark # network analyzer
]
else []
);
programs = { programs = {
direnv = { direnv = {
+11 -7
View File
@@ -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"];
}; };
}; };
}; };
+145 -106
View File
@@ -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
}, },
}, },
@@ -17,14 +17,13 @@ return {
{ import = "astrocommunity.colorscheme.catppuccin" }, { import = "astrocommunity.colorscheme.catppuccin" },
-- Highly experimental plugin that completely replaces -- Highly experimental plugin that completely replaces
-- the UI for messages, cmdline and the popupmenu. -- the UI for messages, cmdline and the popupmenu.
{ import = "astrocommunity.utility.noice-nvim" }, -- { import = "astrocommunity.utility.noice-nvim" },
-- Fully featured & enhanced replacement for copilot.vim -- Fully featured & enhanced replacement for copilot.vim
-- <Tab> work with both auto completion in cmp and copilot -- <Tab> work with both auto completion in cmp and copilot
{ import = "astrocommunity.media.vim-wakatime" }, { import = "astrocommunity.media.vim-wakatime" },
{ import = "astrocommunity.motion.leap-nvim" }, { import = "astrocommunity.motion.leap-nvim" },
{ import = "astrocommunity.motion.flit-nvim" }, { import = "astrocommunity.motion.flit-nvim" },
{ import = "astrocommunity.scrolling.nvim-scrollbar" }, { import = "astrocommunity.scrolling.nvim-scrollbar" },
{ import = "astrocommunity.editing-support.auto-save-nvim" },
{ import = "astrocommunity.editing-support.todo-comments-nvim" }, { import = "astrocommunity.editing-support.todo-comments-nvim" },
-- Language Support -- Language Support
---- Frontend & NodeJS ---- Frontend & NodeJS
@@ -57,7 +56,7 @@ return {
-- https://github.com/echasnovski/mini.ai -- https://github.com/echasnovski/mini.ai
{ import = "astrocommunity.motion.mini-ai" }, { import = "astrocommunity.motion.mini-ai" },
{ import = "astrocommunity.motion.flash-nvim" }, { import = "astrocommunity.motion.flash-nvim" },
{ "folke/flash.nvim", vscode = false }, { "folke/flash.nvim", vscode = false },
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation. -- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
{ import = "astrocommunity.motion.nvim-spider" }, { import = "astrocommunity.motion.nvim-spider" },
-- AI Assistant -- AI Assistant
@@ -67,22 +66,31 @@ 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,
}, },
{
"0x00-ketsu/autosave.nvim",
-- lazy-loading on events
event = { "InsertLeave", "TextChanged" },
opts = function(_, opts)
opts.prompt_style = "stdout" -- notify or stdout
end,
},
-- markdown preview -- markdown preview
{ {
'0x00-ketsu/markdown-preview.nvim', "0x00-ketsu/markdown-preview.nvim",
ft = {'md', 'markdown', 'mkd', 'mkdn', 'mdwn', 'mdown', 'mdtxt', 'mdtext', 'rmd', 'wiki'}, ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" },
config = function() config = function()
require('markdown-preview').setup { require("markdown-preview").setup({
-- your configuration comes here -- your configuration comes here
-- or leave it empty to use the default settings -- or leave it empty to use the default settings
-- refer to the setup section below -- refer to the setup section below
} })
end, end,
}, },
@@ -90,7 +98,7 @@ return {
{ {
"gbprod/yanky.nvim", "gbprod/yanky.nvim",
opts = function() opts = function()
local mapping = require "yanky.telescope.mapping" local mapping = require("yanky.telescope.mapping")
local mappings = mapping.get_defaults() local mappings = mapping.get_defaults()
mappings.i["<c-p>"] = nil mappings.i["<c-p>"] = nil
return { return {
@@ -104,23 +112,48 @@ return {
} }
end, end,
keys = { keys = {
{ "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank text" }, {
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after cursor" }, "y",
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before cursor" }, "<Plug>(YankyYank)",
{ "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after selection" }, mode = { "n", "x" },
{ "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before selection" }, desc = "Yank text",
{ "[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",
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, "<Plug>(YankyPutAfter)",
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" }, mode = { "n", "x" },
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" }, desc = "Put yanked text after cursor",
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" }, },
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" }, {
"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>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" }, { "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" }, { "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" }, { "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
}, },
}, },
@@ -140,11 +173,12 @@ return {
-- joining blocks of code into oneline, or splitting one line into multiple lines. -- joining blocks of code into oneline, or splitting one line into multiple lines.
{ {
'Wansmer/treesj', "Wansmer/treesj",
keys = { '<space>m', '<space>j', '<space>s' }, keys = { "<space>m", "<space>j", "<space>s" },
dependencies = { 'nvim-treesitter/nvim-treesitter' }, dependencies = { "nvim-treesitter/nvim-treesitter" },
config = function() config = function()
require('treesj').setup({--[[ your config ]]}) require("treesj").setup({ --[[ your config ]]
})
end, end,
}, },
@@ -154,31 +188,31 @@ 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 alibity to refactor code. -- The plugin offers the alibity to refactor code.
{ {
"ThePrimeagen/refactoring.nvim", "ThePrimeagen/refactoring.nvim",
dependencies = { dependencies = {
{"nvim-lua/plenary.nvim"}, { "nvim-lua/plenary.nvim" },
{"nvim-treesitter/nvim-treesitter"} { "nvim-treesitter/nvim-treesitter" },
} },
}, },
-- The plugin offers the abilibty to search and replace. -- The plugin offers the abilibty to search and replace.
{ {
"nvim-pack/nvim-spectre", "nvim-pack/nvim-spectre",
dependencies = { dependencies = {
{"nvim-lua/plenary.nvim"}, { "nvim-lua/plenary.nvim" },
} },
}, },
-- full signature help, docs and completion for the nvim lua API. -- full signature help, docs and completion for the nvim lua API.
{ "folke/neodev.nvim", opts = {} }, { "folke/neodev.nvim", opts = {} },
{ "RRethy/vim-illuminate", config = function() end }, { "RRethy/vim-illuminate", config = function() end },
@@ -186,14 +220,14 @@ return {
{ {
"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.incremental_selection = { opts.incremental_selection = {
enable = true, enable = true,
keymaps = { keymaps = {
init_selection = "<C-space>", -- Ctrl + Space init_selection = "<C-space>", -- Ctrl + Space
node_incremental = "<C-space>", node_incremental = "<C-space>",
scope_incremental = "<A-space>", -- Alt + Space scope_incremental = "<A-space>", -- Alt + Space
node_decremental = "<bs>", -- Backspace node_decremental = "<bs>", -- Backspace
}, },
} }
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, { opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, {
@@ -213,14 +247,14 @@ return {
-- implementation/definition preview -- implementation/definition preview
{ {
'rmagatti/goto-preview', "rmagatti/goto-preview",
config = function() config = function()
require('goto-preview').setup {} require("goto-preview").setup({})
end end,
}, },
-- Undo tree -- Undo tree
{ "debugloop/telescope-undo.nvim", }, { "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
@@ -245,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
@@ -258,34 +292,34 @@ 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.
-- 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 null_ls.builtins.formatting.verible_verilog_format, -- Verilog formatter
}) })
end end
@@ -302,8 +336,9 @@ return {
}, },
{ {
'nvim-telescope/telescope.nvim', branch = '0.1.x', "nvim-telescope/telescope.nvim",
dependencies = { 'nvim-lua/plenary.nvim' }, branch = "0.1.x",
dependencies = { "nvim-lua/plenary.nvim" },
init = function() init = function()
-- 1. Disable highlighting for certain filetypes -- 1. Disable highlighting for certain filetypes
-- 2. Ignore files larger than a certain filesize -- 2. Ignore files larger than a certain filesize
@@ -322,7 +357,9 @@ return {
local new_maker = function(filepath, bufnr, opts) local new_maker = function(filepath, bufnr, opts)
opts = opts or {} opts = opts or {}
if opts.use_ft_detect == nil then opts.use_ft_detect = true end 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 -- 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) opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath)
@@ -330,7 +367,9 @@ return {
-- 2. Check the file size, and ignore it if it's too big(preview nothing). -- 2. Check the file size, and ignore it if it's too big(preview nothing).
filepath = vim.fn.expand(filepath) filepath = vim.fn.expand(filepath)
vim.loop.fs_stat(filepath, function(_, stat) vim.loop.fs_stat(filepath, function(_, stat)
if not stat then return end if not stat then
return
end
if stat.size > filesize_threshold then if stat.size > filesize_threshold then
return return
else else
@@ -339,13 +378,13 @@ return {
end) end)
end end
require("telescope").setup { require("telescope").setup({
defaults = { defaults = {
buffer_previewer_maker = new_maker, buffer_previewer_maker = new_maker,
} },
} })
end, end,
} },
}, },
-- Configure require("lazy").setup() options -- Configure require("lazy").setup() options
@@ -354,7 +393,7 @@ return {
performance = { performance = {
rtp = { rtp = {
-- customize default disabled vim plugins -- customize default disabled vim plugins
disabled_plugins = { }; disabled_plugins = {},
}, },
}, },
}, },
@@ -373,36 +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 ---- HDL
"verible", -- verilog language server "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 = {},
@@ -17,7 +17,12 @@ return {
["<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 -- search and replace globally
['<leader>ss'] = {'<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" }, ['<leader>ss'] = {'<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" },
+125 -105
View File
@@ -11,7 +11,10 @@
{ {
xdg.configFile = { xdg.configFile = {
# astronvim's config # astronvim's config
"nvim".source = astronvim; "nvim" = {
source = astronvim;
force = true;
};
# my custom astronvim config, astronvim will load it after base config # my custom astronvim config, astronvim will load it after base config
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16 # https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
@@ -27,114 +30,131 @@
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 = with pkgs; [];
# 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
# ]; telescope-fzf-native-nvim
];
# 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 # TODO - fix python3.11's package conflict - six.py
#-- 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 # 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
#-- 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
]
);
};
} }
+1 -1
View File
@@ -1,4 +1,4 @@
{ nushell-scripts, ...}: { {nushell-scripts, ...}: {
programs.bash = { programs.bash = {
# load the alias file for work # load the alias file for work
bashrcExtra = '' bashrcExtra = ''
@@ -1,4 +1,4 @@
{pkgs, ...}: { _: {
programs.ssh = { programs.ssh = {
enable = true; enable = true;
@@ -23,13 +23,6 @@
# required to prevent sending default identity files first. # required to prevent sending default identity files first.
IdentitiesOnly yes IdentitiesOnly yes
Host github.com
# github is controlled by gluttony~
IdentityFile ~/.ssh/gluttony
# Specifies that ssh should only use the identity file explicitly configured above
# required to prevent sending default identity files first.
IdentitiesOnly yes
Host gtr5 Host gtr5
HostName 192.168.5.172 HostName 192.168.5.172
Port 22 Port 22
+54
View File
@@ -5,3 +5,57 @@
3. alacritty: Standby terminal. 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
```
+18 -6
View File
@@ -1,4 +1,8 @@
{pkgs, catppuccin-alacritty, ...}: {
pkgs,
nur-ryan4yin,
...
}:
########################################################### ###########################################################
# #
# Alacritty Configuration # Alacritty Configuration
@@ -20,7 +24,7 @@
# #
########################################################### ###########################################################
{ {
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;
}; };
@@ -83,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
+2 -6
View File
@@ -1,7 +1,3 @@
{...}: { {mylib, ...}: {
imports = [ imports = mylib.scanPaths ./.;
./alacritty.nix
./kitty.nix
./wezterm.nix
];
} }
+12 -16
View File
@@ -47,22 +47,18 @@
"ctrl+shift+m" = "toggle_maximized"; "ctrl+shift+m" = "toggle_maximized";
}; };
settings = settings = {
{ background_opacity = "0.93";
background_opacity = "0.93"; macos_option_as_alt = true; # Option key acts as Alt on macOS
macos_option_as_alt = true; # Option key acts as Alt on macOS scrollback_lines = 10000;
scrollback_lines = 10000; enable_audio_bell = false;
enable_audio_bell = false; tab_bar_edge = "top"; # tab bar on top
tab_bar_edge = "top"; # tab bar on top # To resolve issues:
} # 1. https://github.com/ryan4yin/nix-config/issues/26
// ( # 2. https://github.com/ryan4yin/nix-config/issues/8
if pkgs.stdenv.isDarwin # Spawn a nushell in login mode via `bash`
then { shell = "${pkgs.bash}/bin/bash --login -c 'nu --login --interactive'";
# macOS specific settings, force kitty to use nushell as default shell };
shell = "/run/current-system/sw/bin/nu";
}
else {}
);
# macOS specific settings # macOS specific settings
darwinLaunchOptions = ["--start-as=maximized"]; darwinLaunchOptions = ["--start-as=maximized"];
+61 -60
View File
@@ -10,85 +10,86 @@
# wezterm has catppuccin theme built-in, # wezterm has catppuccin theme built-in,
# it's not necessary to install it separately. # 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 = programs.wezterm =
{ {
enable = true; enable = true;
# TODO: Fix: https://github.com/wez/wezterm/issues/4483
# package = pkgs.wezterm.override { };
extraConfig = let extraConfig = let
fontsize = fontsize =
if pkgs.stdenv.isDarwin if pkgs.stdenv.isDarwin
then "14.0" then "14.0"
else "13.0"; else "13.0";
in in ''
'' -- Pull in the wezterm API
-- Pull in the wezterm API local wezterm = require 'wezterm'
local wezterm = require 'wezterm'
-- This table will hold the configuration. -- This table will hold the configuration.
local config = {} local config = {}
-- In newer versions of wezterm, use the config_builder which will -- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages -- help provide clearer error messages
if wezterm.config_builder then if wezterm.config_builder then
config = wezterm.config_builder() 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 end
window:set_config_overrides(overrides)
end)
wezterm.on('toggle-opacity', function(window, pane) wezterm.on('toggle-maximize', function(window, pane)
local overrides = window:get_config_overrides() or {} window:maximize()
if not overrides.window_background_opacity then end)
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) -- This is where you actually apply your config choices
window:maximize() config.color_scheme = "Catppuccin Mocha"
end) config.font = wezterm.font_with_fallback {
"JetBrainsMono Nerd Font",
"FiraCode Nerd Font",
-- This is where you actually apply your config choices -- To avoid 'Chinese characters displayed as variant (Japanese) glyphs'
config.color_scheme = "Catppuccin Mocha" "Source Han Sans SC",
config.font = wezterm.font_with_fallback { "Source Han Sans TC"
"JetBrainsMono Nerd Font", }
"FiraCode Nerd Font",
-- To avoid 'Chinese characters displayed as variant (Japanese) glyphs' config.hide_tab_bar_if_only_one_tab = true
"Source Han Sans SC", config.scrollback_lines = 10000
"Source Han Sans TC" config.enable_scroll_bar = true
}
config.hide_tab_bar_if_only_one_tab = true config.keys = {
config.scrollback_lines = 10000 -- toggle opacity(CTRL + SHIFT + B)
config.enable_scroll_bar = true {
key = 'B',
mods = 'CTRL',
action = wezterm.action.EmitEvent 'toggle-opacity',
},
{
key = 'M',
mods = 'CTRL',
action = wezterm.action.EmitEvent 'toggle-maximize',
},
}
config.font_size = ${fontsize}
config.keys = { -- To resolve issues:
-- toggle opacity(CTRL + SHIFT + B) -- 1. https://github.com/ryan4yin/nix-config/issues/26
{ -- 2. https://github.com/ryan4yin/nix-config/issues/8
key = 'B', -- Spawn a nushell in login mode via `bash`
mods = 'CTRL', config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' }
action = wezterm.action.EmitEvent 'toggle-opacity',
},
{
key = 'M',
mods = 'CTRL',
action = wezterm.action.EmitEvent 'toggle-maximize',
},
}
config.font_size = ${fontsize} return config
'' '';
+ (
if pkgs.stdenv.isDarwin
then ''
-- Spawn a fish shell in login mod
config.default_prog = { '/run/current-system/sw/bin/nu', '-l' }
''
else ""
)
+ ''
return config
'';
} }
// ( // (
if pkgs.stdenv.isDarwin if pkgs.stdenv.isDarwin
+10
View File
@@ -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;
};
}
-16
View File
@@ -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()))'";
};
};
}
+6 -2
View File
@@ -1,4 +1,8 @@
{ 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;
@@ -9,7 +13,7 @@
themes = { themes = {
# https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme # https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme
catppuccin-mocha = { catppuccin-mocha = {
src = catppuccin-bat; src = nur-ryan4yin.packages.${pkgs.system}.catppuccin-bat;
file = "Catppuccin-mocha.tmTheme"; file = "Catppuccin-mocha.tmTheme";
}; };
}; };
+7 -5
View File
@@ -1,15 +1,17 @@
{ catppuccin-btop, ... }:
{ {
pkgs,
nur-ryan4yin,
...
}: {
# https://github.com/catppuccin/btop/blob/main/themes/catppuccin_mocha.theme # https://github.com/catppuccin/btop/blob/main/themes/catppuccin_mocha.theme
home.file.".config/btop/themes".source = "${catppuccin-btop}/themes"; xdg.configFile."btop/themes".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-btop}/themes";
# replacement of htop/nmon # replacement of htop/nmon
programs.btop = { programs.btop = {
enable = true; enable = true;
settings = { settings = {
color_theme = "catppuccin_mocha"; color_theme = "catppuccin_mocha";
theme_background = false; # make btop transparent theme_background = false; # make btop transparent
}; };
}; };
} }
+6 -14
View File
@@ -19,15 +19,14 @@
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 # Text Processing
# Docs: https://github.com/learnbyexample/Command-line-text-processing # Docs: https://github.com/learnbyexample/Command-line-text-processing
gnugrep # GNU grep, provides `grep`/`egrep`/`fgrep` gnugrep # GNU grep, provides `grep`/`egrep`/`fgrep`
gnused # GNU sed, very powerful(mainly for replacing text in files) gnused # GNU sed, very powerful(mainly for replacing text in files)
gawk # GNU awk, a pattern scanning and processing language gawk # GNU awk, a pattern scanning and processing language
ripgrep # recursively searches directories for a regex pattern ripgrep # recursively searches directories for a regex pattern
sad # CLI search and replace, with diff preview, really useful!!! sad # CLI search and replace, with diff preview, really useful!!!
delta # A viewer for git and diff output delta # A viewer for git and diff output
# A fast and polyglot tool for code searching, linting, rewriting at large scale # 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/...) # supported languages: only some mainstream languages currently(do not support nix/nginx/yaml/toml/...)
ast-grep ast-grep
@@ -58,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.
eza = { eza = {
enable = true; enable = true;
enableAliases = true; enableAliases = false; # do not enable aliases in nushell!
git = true; git = true;
icons = true; icons = true;
}; };
+2 -13
View File
@@ -1,14 +1,3 @@
{...}: { {mylib, ...}: {
imports = [ imports = mylib.scanPaths ./.;
./nushell
./tmux
./zellij
./bash.nix
./bat.nix
./btop.nix
./core.nix
./git.nix
./starship.nix
];
} }
+8 -9
View File
@@ -2,7 +2,6 @@
config, config,
lib, lib,
pkgs, pkgs,
userfullname, userfullname,
useremail, useremail,
... ...
@@ -12,7 +11,7 @@
# #
# 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; [ home.packages = with pkgs; [
@@ -76,15 +75,15 @@
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"; # commit via `git cm <message>` cm = "commit -m"; # commit via `git cm <message>`
ca = "commit -am"; # commit all changes via `git ca <message>` ca = "commit -am"; # commit all changes via `git ca <message>`
dc = "diff --cached"; dc = "diff --cached";
amend = "commit --amend -m"; # amend commit message via `git amend <message>` amend = "commit --amend -m"; # amend commit message via `git amend <message>`
unstage = "reset HEAD --"; # unstage file via `git unstage <file>` unstage = "reset HEAD --"; # unstage file via `git unstage <file>`
merged = "branch --merged"; # list merged(into HEAD) branches via `git merged` merged = "branch --merged"; # list merged(into HEAD) branches via `git merged`
unmerged = "branch --no-merged"; # list unmerged(into HEAD) branches via `git unmerged` 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` nonexist = "remote prune origin --dry-run"; # list non-exist(remote) branches via `git nonexist`
# delete merged branches except master & dev & staging # delete merged branches except master & dev & staging
# `!` indicates it's a shell script, not a git subcommand # `!` indicates it's a shell script, not a git subcommand
-29
View File
@@ -1,29 +0,0 @@
{ config, ...}: {
programs.nushell = {
enable = true;
configFile.source = ./config.nu;
extraConfig = ''
$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()))'";
};
};
}
+25
View File
@@ -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"
'';
};
}
+23 -17
View File
@@ -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");
}; };
} }
-13
View File
@@ -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";
};
};
}
+20 -23
View File
@@ -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;
+2 -2
View File
@@ -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;
} }
+2 -43
View File
@@ -1,44 +1,3 @@
{pkgs, ...}: { {username, ...}: {
########################################################################## home.homeDirectory = "/Users/${username}";
#
# MacOS specific home configuration
#
##########################################################################
programs.zsh = {
enable = true;
};
programs.ssh = {
enable = true;
# all my ssh private key are generated by `ssh-keygen -t ed25519 -C "ryan@nickname"`
# the config's format:
# Host — given the pattern used to match against the host name given on the command line.
# HostName — specify nickname or abbreviation for host
# IdentityFile — the location of your SSH key authentication file for the account.
# format in details:
# https://www.ssh.com/academy/ssh/config
extraConfig = ''
# a private key that is used during authentication will be added to ssh-agent if it is running
AddKeysToAgent yes
Host 192.168.*
# allow to securely use local SSH agent to authenticate on the remote machine.
# It has the same effect as adding cli option `ssh -A user@host`
ForwardAgent yes
# romantic holds my homelab~
IdentityFile ~/.ssh/romantic
# Specifies that ssh should only use the identity file explicitly configured above
# required to prevent sending default identity files first.
IdentitiesOnly yes
Host github.com
Hostname github.com
# github is controlled by gluttony~
IdentityFile ~/.ssh/harmonica
# Specifies that ssh should only use the identity file explicitly configured above
# required to prevent sending default identity files first.
IdentitiesOnly yes
'';
};
} }
+8 -31
View File
@@ -1,32 +1,9 @@
{ username, ... }: { {mylib, ...}: {
imports = [ imports =
../base/desktop (mylib.scanPaths ./.)
++ [
./proxychains ../base/server
../base/desktop
./core.nix ../base/core.nix
./nushell.nix ];
./rime-squirrel.nix
];
# Home Manager needs a bit of information about you and the
# paths it should manage.
home = {
username = username;
# set homeDirectory make build fail
homeDirectory = "/Users/${username}";
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
stateVersion = "22.11";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
} }
-18
View File
@@ -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 = ''
$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)
'';
}
+4 -10
View File
@@ -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;
}; };
} }
+19
View File
@@ -0,0 +1,19 @@
{
# Homebrew's default install location:
# /opt/homebrew for Apple Silicon
# /usr/local for macOS Intel
# The prefix /opt/homebrew was chosen to allow installations
# in /opt/homebrew for Apple Silicon and /usr/local for Rosetta 2 to coexist and use bottles.
programs.bash = {
enable = true;
bashrcExtra = ''
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
'';
};
programs.zsh = {
enable = true;
envExtra = ''
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
'';
};
}
+10
View File
@@ -11,3 +11,13 @@
1. used by my hyprland desktop. 1. used by my hyprland desktop.
7. `desktop-i3.nix`: the entrypoint of i3's configuration, it import all the submodules above, except `hyprland`. 7. `desktop-i3.nix`: the entrypoint of i3's configuration, it import all the submodules above, except `hyprland`.
1. used by my i3 desktop. 1. used by my i3 desktop.
## Why install I3/Hyprland in Home Manager instead of a NixOS Module?
1. I3 & Hyprland's configuration file is located in `~/.config`, which can be easily managed by Home Manager.
2. There're other user-specific systemd servcies, such gammastep, wallpaper-switcher, etc. which can be easily managed by Home Manager, but if we start i3/hyprland in NixOS Module, they may failed to start automatically. With i3/hyprland installed via home-manager, we can control their systemd service's dependent order, to avoid issues like this.
3. By install as less as possible in NixOS Module, we can:
1. Make the NixOS system more secure and stable.
2. Make this flake more portable to other non-NixOS systems, as home-manager can be installed on any Linux system.
+2 -5
View File
@@ -1,6 +1,3 @@
{ {mylib, ...}: {
imports = [ imports = mylib.scanPaths ./.;
./shell.nix
./system-tools.nix
];
} }
+7 -8
View File
@@ -1,10 +1,14 @@
{config, nushell-scripts, ...}: let
{config, username, ...}: let
d = config.xdg.dataHome; d = config.xdg.dataHome;
c = config.xdg.configHome; c = config.xdg.configHome;
cache = config.xdg.cacheHome; cache = config.xdg.cacheHome;
in rec { in rec {
# add environment variables
systemd.user.sessionVariables = { home.homeDirectory = "/home/${username}";
# environment variables that always set at login
home.sessionVariables = {
# clean up ~ # clean up ~
LESSHISTFILE = cache + "/less/history"; LESSHISTFILE = cache + "/less/history";
LESSKEY = c + "/less/lesskey"; LESSKEY = c + "/less/lesskey";
@@ -17,13 +21,8 @@ in rec {
# set default applications # set default applications
BROWSER = "firefox"; BROWSER = "firefox";
TERM = "xterm-256color";
# enable scrolling in git diff # enable scrolling in git diff
DELTA_PAGER = "less -R"; DELTA_PAGER = "less -R";
MANPAGER = "sh -c 'col -bx | bat -l man -p'";
}; };
home.sessionVariables = systemd.user.sessionVariables;
} }
+1 -14
View File
@@ -1,14 +1,6 @@
{pkgs, ...}: { {pkgs, ...}: {
# Linux Only Packages, not available on Darwin # Linux Only Packages, not available on Darwin
home.packages = with pkgs; [ home.packages = with pkgs; [
# 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
# cloud tools that nix do not have cache for.
terraform
terraformer # generate terraform configs from existing cloud resources
nmon nmon
iotop iotop
iftop iftop
@@ -17,16 +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 bpftrace # powerful tracing tool
tcpdump # network sniffer tcpdump # network sniffer
lsof # list open files lsof # list open files
# system tools # system tools
-31
View File
@@ -1,31 +0,0 @@
{ username, ... }: {
imports = [
../base/desktop
./base
./fcitx5
./desktop
./hyprland
];
# Home Manager needs a bit of information about you and the
# paths it should manage.
home = {
username = username;
homeDirectory = "/home/${username}";
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
stateVersion = "22.11";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}
-31
View File
@@ -1,31 +0,0 @@
{ username, ... }: {
imports = [
../base/desktop
./base
./fcitx5
./desktop
./i3
];
# Home Manager needs a bit of information about you and the
# paths it should manage.
home = {
username = username;
homeDirectory = "/home/${username}";
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
stateVersion = "22.11";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}
+10
View File
@@ -0,0 +1,10 @@
{
imports = [
../base/server
../base/desktop
../base/core.nix
./base
./desktop
];
}
@@ -6,7 +6,7 @@
}: { }: {
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
@@ -22,7 +22,7 @@
pkgs-unstable.yosys # fpga synthesis pkgs-unstable.yosys # fpga synthesis
pkgs-unstable.nextpnr # fpga place and route pkgs-unstable.nextpnr # fpga place and route
pkgs-unstable.openfpgaloader # fpga programming pkgs-unstable.openfpgaloader # fpga programming
nur-ryan4yin.packages.${pkgs.system}.gowin-eda-edu-ide # app: `gowin-env` => `gw_ide` / `gw_pack` / ... nur-ryan4yin.packages.${pkgs.system}.gowin-eda-edu-ide # app: `gowin-env` => `gw_ide` / `gw_pack` / ...
]; ];
programs = { programs = {
+3
View File
@@ -0,0 +1,3 @@
{mylib, ...}: {
imports = mylib.scanPaths ./.;
}
@@ -0,0 +1,45 @@
{
pkgs,
lib,
...
}: {
# Adjust the color temperature(& brightness) of your screen according to
# your surroundings. This may help your eyes hurt less if you are
# working in front of the screen at night.
#
# works fine with both x11 & wayland(hyprland)
#
# https://gitlab.com/chinstrap/gammastep
services.gammastep = {
enable = true;
# add a gammastep icon in the system tray
# has problem with wayland, so disable it
tray = false;
temperature = {
day = 5700;
night = 4000;
};
# https://gitlab.com/chinstrap/gammastep/-/blob/master/gammastep.conf.sample?ref_type=heads
settings = {
general = {
fade = "1"; # gradually apply the new screen temperature/brightness over a couple of seconds.
# it is a fake brightness adjustment obtained by manipulating the gamma ramps,
# which means that it does not reduce the backlight of the screen.
# Preferably only use it if your normal backlight adjustment is too coarse-grained.
brightness-day = "1.0";
brightness-night = "0.8";
location-provider = "manual";
# by default, Redshift will use the current elevation of the sun
# to determine whether it is daytime, night or in transition (dawn/dusk).
# dawn-time = "6:00-8:45";
# dusk-time = "18:35-20:15";
};
manual = {
# China, Shenzhen
lat = "22.5"; # latitude
lon = "114.1"; # longitude
};
};
};
}
@@ -0,0 +1,30 @@
{
pkgs,
nur-ryan4yin,
...
}: {
home.file.".local/share/fcitx5/themes".source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-fcitx5}/src";
xdg.configFile = {
"fcitx5/profile" = {
source = ./profile;
# every time fcitx5 switch input method, it will modify ~/.config/fcitx5/profile,
# so we need to force replace it in every rebuild to avoid file conflict.
force = true;
};
"fcitx5/conf/classicui.conf".source = ./classicui.conf;
};
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
# for flypy chinese input method
fcitx5-rime
# needed enable rime using configtool after installed
fcitx5-configtool
fcitx5-chinese-addons
# fcitx5-mozc # japanese input method
fcitx5-gtk # gtk im module
];
};
}
@@ -3,12 +3,16 @@
config, config,
... ...
}: { }: {
# If your themes for mouse cursor, icons or windows dont 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 = { home.pointerCursor = {
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 24;
gtk.enable = true; gtk.enable = true;
x11.enable = true; x11.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Ice";
size = 24;
}; };
# set dpi for 4k monitor # set dpi for 4k monitor
@@ -27,8 +31,9 @@
enable = true; enable = true;
font = { font = {
name = "Roboto"; name = "Noto Sans";
package = pkgs.roboto; package = pkgs.noto-fonts;
size = 11;
}; };
gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc";
@@ -43,7 +48,7 @@
name = "Catppuccin-Macchiato-Compact-Pink-dark"; name = "Catppuccin-Macchiato-Compact-Pink-dark";
package = pkgs.catppuccin-gtk.override { package = pkgs.catppuccin-gtk.override {
# https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix # https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix
accents = [ "pink" ]; accents = ["pink"];
size = "compact"; size = "compact";
variant = "mocha"; 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,6 @@
{ {
pkgs, pkgs,
catppuccin-cava, pkgs-unstable,
nur-ryan4yin, nur-ryan4yin,
... ...
}: }:
@@ -21,14 +21,14 @@
vdpauinfo vdpauinfo
vulkan-tools vulkan-tools
glxinfo glxinfo
nur-ryan4yin.packages.${pkgs.system}.yazi # terminal file manager
]; ];
# 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 = {
+26
View File
@@ -0,0 +1,26 @@
{pkgs, ...}: {
home.packages = with pkgs; [
# GUI apps
# e-book viewer(.epub/.mobi/...)
# do not support .pdf
foliate
# instant messaging
telegram-desktop
discord
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
# remote desktop(rdp connect)
remmina
freerdp # required by remmina
# misc
flameshot
ventoy # multi-boot usb creator
];
# GitHub CLI tool
programs.gh = {
enable = true;
};
}
@@ -0,0 +1,31 @@
{
pkgs,
config,
lib,
wallpapers,
...
}: {
systemd.user.services.wallpaper = {
Unit = {
Description = "Wallpaper Switcher daemon";
After = ["graphical-session-pre.target" "xdg-desktop-autostart.target"];
Wants = ["graphical-session-pre.target"];
};
Install.WantedBy = ["graphical-session.target"];
Service = {
ExecStart = lib.getExe (pkgs.writeShellApplication {
name = "wallpaper";
runtimeInputs = with pkgs; [procps feh swaybg python3];
text = ''
export WALLPAPERS_DIR="${wallpapers}"
export WALLPAPERS_STATE_FILEPATH="${config.xdg.stateHome}/wallpaper-switcher/switcher_state"
export WALLPAPER_WAIT_MIN=10
export WALLPAPER_WAIT_MAX=20
exec ${./wallpaper-switcher.py}
'';
});
RestartSec = 3;
Restart = "on-failure";
};
};
}
+169
View File
@@ -0,0 +1,169 @@
#!/usr/bin/env python3
"""
This script will randomly select a wallpaper from the wallpapers directory.
It will skip the last wallpaper used, so that you don't get the same wallpaper.
It will also set the wallpaper using `feh` for X11, or `swaybg` for Wayland.
Maintainer: ryan4yin [xiaoyin_c@qq.com]
"""
import os
import time
import random
import json
from pathlib import Path
from typing import Union
import subprocess
import logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
class WallpaperSwitcher:
def __init__(
self,
wait_min,
wait_max,
wallpapers_dir: Path,
state_filepath: Path,
image_extensions: Union[tuple, list],
) -> None:
self.wallpapers_dir = wallpapers_dir
self.image_extensions = image_extensions
self.state_filepath = state_filepath
self.wait_min = wait_min
self.wait_max = wait_max
# initialize the state file
self.state_filepath.parent.mkdir(parents=True, exist_ok=True)
self.current_state = self.state_filepath.open("a+", encoding="utf-8")
self.current_wallpaper_list = list()
def run(self):
"""
Iterate on all wallpapers in the wallpapers directory, cycling through them in a random order.
"""
self.initialize_state()
while True:
for i, w in enumerate(self.current_wallpaper_list):
if i < self.current_wallpaper_index:
continue
logger.info(
f"Setting wallpaper {i+1}/{len(self.current_wallpaper_list)}: {w}"
)
self.set_wallpaper(w)
# update the state
self.current_wallpaper_index = i
self.save_state()
wait_time = random.randint(self.wait_min, self.wait_max)
logger.info(f"Waiting {wait_time} seconds...")
time.sleep(wait_time)
# reset the state
self.reset_state()
def save_state(self):
wallpaper_list = [w.as_posix() for w in self.current_wallpaper_list]
state = {
"current_wallpaper_list": wallpaper_list,
"current_wallpaper_index": self.current_wallpaper_index,
}
self.current_state.truncate(0)
self.current_state.write(json.dumps(state, indent=4))
self.current_state.flush()
def initialize_state(self):
self.current_state.seek(0)
data = self.current_state.read()
if not data:
logger.info("No state found, resetting...")
self.reset_state()
else:
logger.info("State found, reloading...")
state = json.loads(data)
wallpapers = [Path(w) for w in state["current_wallpaper_list"]]
self.current_wallpaper_list = wallpapers
self.current_wallpaper_index = state["current_wallpaper_index"]
def reset_state(self):
logger.info(f"Rescanning & shuffle wallpapers in {self.wallpapers_dir} ...")
wallpapers = list(
filter(
lambda x: x.suffix in self.image_extensions,
self.wallpapers_dir.iterdir(),
)
)
random.shuffle(wallpapers)
self.current_wallpaper_list = wallpapers
self.current_wallpaper_index = 0
def set_wallpaper(self, path: Path):
# check if we are running under x11 or wayland
if (
"WAYLAND_DISPLAY" in os.environ
or os.environ.get("XDG_SESSION_TYPE") == "wayland"
):
self.set_wallpaper_wayland(path)
else:
self.set_wallpaper_x11(path)
def set_wallpaper_x11(self, path: Path):
subprocess.run(["feh", "--bg-fill", path])
def set_wallpaper_wayland(self, path: Path):
# find all swaybg processes
swaybg_pids = subprocess.run(
["pgrep", "-f", "swaybg"], stdout=subprocess.PIPE
).stdout.decode("utf-8")
# run swaybg in the background, and make it running even after the parent process exits
subprocess.Popen(
["swaybg", "--output", "*", "--mode", "fill", "--image", path],
start_new_session=True,
)
time.sleep(1)
# kill all old swaybg processes
for pid in swaybg_pids.splitlines():
try:
os.kill(int(pid), 9)
except ProcessLookupError:
pass
def main():
wallpapers_dir = os.getenv("WALLPAPERS_DIR")
state_filepath = os.getenv("WALLPAPERS_STATE_FILEPATH")
if not wallpapers_dir:
raise Exception("WALLPAPERS_DIR not set")
if not state_filepath:
raise Exception("WALLPAPERS_STATE_FILEPATH not set")
image_postfix = (
".jpg",
".jpeg",
".png",
# ".gif",
# ".webp"
)
wait_min = int(os.getenv("WALLPAPER_WAIT_MIN", 60))
wait_max = int(os.getenv("WALLPAPER_WAIT_MAX", 300))
wallpaper_switcher = WallpaperSwitcher(
wait_min,
wait_max,
Path(wallpapers_dir).expanduser(),
Path(state_filepath).expanduser(),
image_postfix,
)
wallpaper_switcher.run()
if __name__ == "__main__":
main()
@@ -12,9 +12,14 @@
xdg-user-dirs xdg-user-dirs
]; ];
xdg.configFile."mimeapps.list".force = true;
xdg = { xdg = {
enable = true; enable = true;
cacheHome = config.home.homeDirectory + "/.local/cache";
cacheHome = "${config.home.homeDirectory}/.cache";
configHome = "${config.home.homeDirectory}/.config";
dataHome = "${config.home.homeDirectory}/.local/share";
stateHome = "${config.home.homeDirectory}/.local/state";
# manage $XDG_CONFIG_HOME/mimeapps.list # manage $XDG_CONFIG_HOME/mimeapps.list
# xdg search all desktop entries from $XDG_DATA_DIRS, check it by command: # xdg search all desktop entries from $XDG_DATA_DIRS, check it by command:
@@ -51,7 +56,7 @@
"x-scheme-handler/unknown" = browser; "x-scheme-handler/unknown" = browser;
"x-scheme-handler/discord" = ["discord.desktop"]; "x-scheme-handler/discord" = ["discord.desktop"];
"x-scheme-handler/tg" = ["telegramdesktop.desktop"]; "x-scheme-handler/tg" = ["org.telegram.desktop.desktop "];
"audio/*" = ["mpv.desktop"]; "audio/*" = ["mpv.desktop"];
"video/*" = ["mpv.dekstop"]; "video/*" = ["mpv.dekstop"];
@@ -62,10 +67,9 @@
"image/webp" = ["imv.desktop"]; "image/webp" = ["imv.desktop"];
}; };
associations.removed = associations.removed = {
{ # ......
# ...... };
};
}; };
userDirs = { userDirs = {
+2 -38
View File
@@ -1,39 +1,3 @@
{pkgs, ...}: { {mylib, ...}: {
imports = [ imports = mylib.scanPaths ./.;
./creative.nix
./gtk.nix
./immutable-file.nix
./media.nix
./ssh.nix
./wallpaper.nix
./xdg.nix
];
home.packages = with pkgs; [
# GUI apps
insomnia # REST client
wireshark # network analyzer
# e-book viewer(.epub/.mobi/...)
# do not support .pdf
foliate
# instant messaging
telegram-desktop
discord
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
# remote desktop(rdp connect)
remmina
freerdp # required by remmina
# misc
flameshot
mitmproxy # http/https proxy tool
];
# GitHub CLI tool
programs.gh = {
enable = true;
};
} }
@@ -1,21 +1,3 @@
## Hyprland configuration file
# color-scheme: cappuccin-mocha
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 ----------------------------------------------------
# Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info.
# format:
# monitor=name,resolution,position,scale
monitor=DP-2,3840x2160@144,0x0,1.6
workspace=DP-2,1
#-- Input ---------------------------------------------------- #-- Input ----------------------------------------------------
# Configure mouse and touchpad here. # Configure mouse and touchpad here.
input { input {
@@ -199,10 +181,9 @@ bind=SUPER,mouse_up,workspace,e-1
#-- Startup ---------------------------------------------------- #-- Startup ----------------------------------------------------
exec-once=~/.config/hypr/scripts/startup exec-once=~/.config/hypr/scripts/startup
# -- Fcitx5 input method
#-- Fcitx5 input method ----------------------------------------------------
windowrule=pseudo,fcitx # enable this will make fcitx5 works, but fcitx5-configtool will not work! windowrule=pseudo,fcitx # enable this will make fcitx5 works, but fcitx5-configtool will not work!
exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore fcitx5 profile manged by nixos exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore fcitx5 profile managed by nixos
exec-once=fcitx5 -d --replace # start fcitx5 daemon exec-once=fcitx5 -d --replace # start fcitx5 daemon
bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r
@@ -211,14 +192,3 @@ windowrulev2 = rounding 0, xwayland:1, floating:1
windowrulev2 = center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$ windowrulev2 = center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$
windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$ windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$
# -- Fix input method in vscode
exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24
# 效果是 wayland 原生窗口缩放完全正常
# xwayland 窗口先渲染到 200% 再降到 hyprland config 里 monitor 设置的值,看上去和原生没啥区别
# 相比较一开始的方案输入法字体大小也正确了.唯一有点问题的可能是 xwayland 窗口下的鼠标指针大小不对
exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
exec-once = xrdb -merge ~/.Xresources
# env = GDK_SCALE,2
env = XCURSOR_SIZE,48
env = XCURSOR_THEME,"Bibata-Modern-Ice"

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

@@ -10,8 +10,9 @@ for _prs in "${_ps[@]}"; do
fi fi
done done
# Set wallpaper # Set wallpaper via a wallpaper.service
swaybg --output '*' --mode fill --image ~/.config/wallpapers/default_wallpaper & # it will by start by home-manager automatically, do not need to restart it here.
# systemctl --user restart wallpaper.service
# Lauch notification daemon (mako) # Lauch notification daemon (mako)
~/.config/hypr/scripts/notifications & ~/.config/hypr/scripts/notifications &
@@ -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

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

Before

Width:  |  Height:  |  Size: 5.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Some files were not shown because too many files have changed in this diff Show More