├── .gitignore
├── .sops.yaml
├── LICENSE
├── Makefile
├── README.md
├── flake.lock
├── flake.nix
├── home-manager
├── home.nix
└── hosts
│ ├── nix-on-droid.nix
│ └── nixos.nix
├── modules
├── home-manager
│ ├── aria2.nix
│ ├── browser.nix
│ ├── btop.nix
│ ├── ctags.nix
│ ├── default.nix
│ ├── direnv.nix
│ ├── fcitx5.nix
│ ├── foot.nix
│ ├── fuzzel.nix
│ ├── git-sync.nix
│ ├── git.nix
│ ├── gnome-terminal.nix
│ ├── hyprland.nix
│ ├── lang.nix
│ ├── mail.nix
│ ├── mime.nix
│ ├── mpd.nix
│ ├── mpv.nix
│ ├── neovim.nix
│ ├── ripgrep.nix
│ ├── rofi.nix
│ ├── sops.nix
│ ├── starship.nix
│ ├── syncthing.nix
│ ├── theme.nix
│ ├── tmux.nix
│ ├── translate-shell.nix
│ ├── vscode.nix
│ ├── wallpaper.nix
│ ├── waybar.nix
│ ├── wezterm.nix
│ ├── yazi.nix
│ ├── zellij.nix
│ └── zsh.nix
└── nixos
│ ├── bluetooth.nix
│ ├── default.nix
│ ├── docker.nix
│ ├── firewall.nix
│ ├── fonts.nix
│ ├── gnome.nix
│ ├── headscale.nix
│ ├── hyprland.nix
│ ├── interception-tools.nix
│ ├── mail.nix
│ ├── mihomo.nix
│ ├── ollama.nix
│ ├── podman.nix
│ ├── rustdesk-server.nix
│ ├── sing-box.nix
│ ├── sops.nix
│ ├── steam.nix
│ ├── systemd-boot.nix
│ ├── theme.nix
│ ├── virt.nix
│ ├── waydroid.nix
│ └── xserver.nix
├── nixos
├── configuration.nix
├── hosts
│ ├── aliyun
│ │ ├── configuration.nix
│ │ ├── default.nix
│ │ ├── disk-config.nix
│ │ └── hardware-configuration.nix
│ ├── aws
│ │ ├── configuration.nix
│ │ └── default.nix
│ ├── nix-on-droid
│ │ └── default.nix
│ ├── nixos-wsl
│ │ └── default.nix
│ └── nixos
│ │ ├── configuration.nix
│ │ ├── default.nix
│ │ └── hardware-configuration.nix
└── users.nix
├── overlays
└── default.nix
├── pkgs
├── bingwallpaper-get
│ ├── bingwallpaper-get.sh
│ └── default.nix
├── default.nix
├── fhs
│ └── default.nix
├── gh-models
│ └── default.nix
├── lemminx-maven
│ └── default.nix
├── rofi-screenshot-wayland
│ └── default.nix
└── wallpaper-switch
│ ├── default.nix
│ └── wallpaper-switch.sh
├── secrets.yaml
└── xdg
└── config
├── ctags
└── my.ctags
├── nvim
├── .gitignore
├── .stylua.toml
├── LICENSE
├── after
│ ├── ftplugin
│ │ ├── java.vim
│ │ ├── json.vim
│ │ ├── lua.vim
│ │ ├── markdown.vim
│ │ ├── nix.vim
│ │ ├── org.vim
│ │ └── vue.vim
│ └── lsp
│ │ ├── cssls.lua
│ │ ├── eslint.lua
│ │ ├── jsonls.lua
│ │ ├── kulala_ls.lua
│ │ ├── lua_ls.lua
│ │ ├── nixd.lua
│ │ ├── pylsp.lua
│ │ ├── texlab.lua
│ │ ├── ts_ls.lua
│ │ ├── vue_ls.lua
│ │ └── yamlls.lua
├── colors
│ ├── wenvim-brown.lua
│ ├── wenvim-dark.lua
│ └── wenvim-purple.lua
├── init.lua
├── lua
│ ├── lsp
│ │ └── jdtls
│ │ │ ├── init.lua
│ │ │ ├── settings.lua
│ │ │ └── settings.prefs
│ ├── plugin
│ │ ├── colorscheme.lua
│ │ ├── core.lua
│ │ ├── dap.lua
│ │ ├── editing.lua
│ │ ├── extra.lua
│ │ ├── finder.lua
│ │ ├── git.lua
│ │ ├── init.lua
│ │ ├── lspconfig.lua
│ │ ├── motion.lua
│ │ ├── note.lua
│ │ └── ui.lua
│ └── util
│ │ ├── color.lua
│ │ ├── init.lua
│ │ └── lsp.lua
├── mini-deps-snap
├── plugin
│ ├── autocmd.lua
│ ├── keymaps.lua
│ └── options.lua
├── queries
│ └── vue
│ │ └── highlights.scm
├── readme.md
├── snippets
│ ├── global.json
│ ├── java.json
│ ├── lua.json
│ ├── nix.json
│ └── package.json
└── spell
│ └── en.utf-8.add
└── wezterm
└── wezterm.lua
/.gitignore:
--------------------------------------------------------------------------------
1 | **/result
2 | **/.direnv/
3 | **/tags
4 | **/.envrc
5 |
--------------------------------------------------------------------------------
/.sops.yaml:
--------------------------------------------------------------------------------
1 | # This example uses YAML anchors which allows reuse of multiple keys
2 | # without having to repeat yourself.
3 | # Also see https://github.com/Mic92/dotfiles/blob/master/nixos/.sops.yaml
4 | # for a more complex example.
5 | keys:
6 | - &nixos-wenjin age1swanwyhp3k6nycu2q3pyurgugzj4wlxg84gaj272rky0xu8j7ynq2eek7w
7 | - &nixos age1r9aqhunddlxpjnw2lezhq3zn7edgqqju2mfjyxra58kg95f2mg6s0qz6v5
8 | - &nixos-wsl-wenjin age1u7g2z73c3fq28purtn9kvkpsxlq4srkkn4944u5krfwqjkeqeshq9zgs3m
9 | - &nixos-wsl age10ff9heqlh8qjunnt9060a97aqxa7vqj4nclmzm0gwe54fe95mdlqc7k6r4
10 | creation_rules:
11 | - path_regex: ^secrets.yaml$
12 | key_groups:
13 | - age:
14 | - *nixos-wenjin
15 | - *nixos
16 | - *nixos-wsl-wenjin
17 | - *nixos-wsl
18 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 wenjin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | HOSTNAME = $(if $(host),$(host),$(shell hostname))
2 | USER = $(if $(user),$(user),$(shell whoami))
3 | all:
4 | sudo nixos-rebuild switch --flake .#$(HOSTNAME) && home-manager switch --flake .#$(USER)@$(HOSTNAME) -b backup
5 | home:
6 | home-manager switch --flake .#$(USER)@$(HOSTNAME) -b backup
7 | system:
8 | sudo nixos-rebuild switch --flake .#$(HOSTNAME)
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Personal NixOS configuration with Flake and Home Manager
2 | # Screenshot
3 |
4 | 
5 |
6 | The old Arch configuration at [Arch branch](https://github.com/wenjinnn/config/tree/arch).
7 |
8 | Recently I also replace my [ags](https://github.com/Aylur/ags) configuration with some standalone package (you can see detail on below), But I think the old ags configuration still valuable
9 | So you can visit it in [ags-v1](https://github.com/wenjinnn/.dotfiles/tree/ags-v1).
10 |
11 | I don't want to spend too much time on writing about my desktop environment components,
12 | I do most of my work in the command line and prioritize practicality,
13 | so I want to keep my compositor desktop minimalist.
14 |
15 | # Why NixOS?
16 |
17 | For a lone time I'm seeking for a solution to manage my OS configurations,
18 | The Arch branch is a way that I manage my home configurations,
19 | but that's not enough, NixOS provided capability to manage system wide configurations, or even more,
20 | now this repo manage my laptop, WSL, and nix-on-droid configurations together (but nix-on-droid configurations are not work well now)
21 |
22 | Repo's structure base on [nix-starter-config#standard](https://github.com/Misterio77/nix-starter-configs/tree/main/standard),
23 | is a good start point for leaning NixOS, but you should be careful to using unstable and stable nixpkgs together,
24 | e.g. if you want to stay at stable nixpkgs branch but using unstable Hyprland, it will broken because of the mesa package version are not equal.
25 |
26 | # Stuff here
27 |
28 | * Editor: a well [configured nvim](https://github.com/wenjinnn/config/tree/nixos/xdg/config/nvim) (tested startup time are less than 30ms) that follows the [KISS principle](https://en.wikipedia.org/wiki/KISS_principle)
29 |
30 | you can try it and find more detail in my mono nvim configuration repo [wenvim](https://github.com/wenjinnn/wenvim), I'm using home-manager with `mkOutOfStoreSymlink` to symlink my nvim configurations directory, that's maybe not the nix way, but since I modify it very frequently and I store my custom snippets and spell file together with it, I don't want to compile it everytime I modified this, also I can easier to share my code with someone that not using NixOS.
31 | * Compositor: [Hyprland](https://github.com/hyprwm/Hyprland)
32 | * Topbar: [waybar](https://github.com/Alexays/Waybar)
33 | * Notification daemon: [dunst](https://github.com/dunst-project/dunst)
34 | * Launcher: [rofi (wayland-fork)](https://github.com/lbonn/rofi) with some script to let it provide the ability to manage various system functions, some of them maintained by myself:
35 | * [cliphist-rofi-img](https://github.com/sentriz/cliphist/blob/master/contrib/cliphist-rofi-img) for clipboard manage
36 | * [rofi-screenshot-wayland](https://github.com/wenjinnn/rofi-screenshot-wayland) a fork of [rofi-screenshot](https://github.com/ceuk/rofi-screenshot)
37 | * [rofi-power-menu](https://github.com/jluttine/rofi-power-menu)
38 | * [rofi-systemd](https://github.com/colonelpanic8/rofi-systemd) for control systemd unit
39 | * [rofi-bluetooth](https://github.com/nickclyde/rofi-bluetooth) with scan ability fixed [PR](https://github.com/nickclyde/rofi-bluetooth/pull/33).
40 | * [rofi-pass-wayland](https://github.com/Seme4eg/rofi-pass-wayland) as [pass](https://www.passwordstore.org/) frontend.
41 | * [rofi-pulse-select](https://gitlab.com/DamienCassou/rofi-pulse-select)
42 | * [rofimoji](https://github.com/fdw/rofimoji) for emoji and unicode selection
43 | * [rofi-network-manager](https://github.com/meowrch/rofi-network-manager)
44 | * Terminal emulator: [foot](https://codeberg.org/dnkl/foot)
45 | * Wallpaper: [hyprpaper](https://github.com/hyprwm/hyprpaper) and some small script, [wallpaper-switch](https://github.com/wenjinnn/.dotfiles/blob/none-ags/pkgs/wallpaper-switch/wallpaper-switch.sh) , and [bingwallpaper-get](https://github.com/wenjinnn/.dotfiles/blob/none-ags/pkgs/bingwallpaper-get/bingwallpaper-get.sh) for download daily bingwallpaper and switch to it immediately.
46 | * Style manage: [stylix](https://github.com/danth/stylix) (that's awesome!)
47 | * Music player: [MPD](https://www.musicpd.org) and [ncmpcpp](https://github.com/ncmpcpp/ncmpcpp)
48 | * Mail client: [neomutt](https://neomutt.org/)
49 |
50 | # Installation
51 |
52 | > [!NOTE]
53 | > You can not use this repo directly for I'm using [sops-nix](https://github.com/Mic92/sops-nix) to manage my secrets in some modules, you won't pass the compile, but I still give a short guide to install this to remind you and myself.
54 | >
55 | > Even you remove all the modules that using sops secrets,
56 | > the other parts still has many custom settings that may not suitable for you machine,
57 | > use it directly maybe damage your system.
58 | >
59 | > Please always check the code before you use it.
60 |
61 | For NixOS users:
62 |
63 | * This repo should be placed at `$HOME/.dotfiles` for I'm defined a [immutable value](https://github.com/wenjinnn/.dotfiles/blob/62b9f6d35c7da4e6ef44aa93ce397328f920fd43/home-manager/home.nix#L190) and refer it in some home-manager modules.
64 |
65 | * Replace [hardware-configuration.nix](https://github.com/wenjinnn/config/blob/nixos/nixos/hosts/nixos/hardware-configuration.nix) with your own, and change the [username](https://github.com/wenjinnn/config/blob/1d08b37c56696a953e1c40c0ea9307acf0c1539d/flake.nix#L63) variable to yours
66 |
67 | * You also need to remove this [hardware setting](https://github.com/wenjinnn/config/blob/3c58b72f83b4a4e421ef0fc72a808e2ce31ca68b/flake.nix#L94) or replace it with your hardware model
68 |
69 | * Other modules that using sops secrets should be removed.
70 |
71 | * Navigate to repo root then execute following command in repo root:
72 | ```
73 | $ sudo nixos-rebuild switch --flake .#nixos
74 | $ home-manager switch --flake .#wenjin@nixos
75 | ```
76 |
77 | * If your machine's `$HOSTNAME` and `$USER` variables as same as that variables in `nixosConfigurations` and `homeConfigurations`, there's also a Makefile for simplified command:
78 | ```
79 | $ make # build system and home
80 | $ make system # build system
81 | $ make home # build home
82 | ```
83 |
--------------------------------------------------------------------------------
/flake.nix:
--------------------------------------------------------------------------------
1 | {
2 | description = "NixOS Flake and Home Manager configuration of wenjin";
3 |
4 | # the nixConfig here only affects the flake itself, not the system configuration!
5 | nixConfig = {
6 | # will be appended to the system-level substituters
7 | extra-substituters = [
8 | # nix community's cache server
9 | "https://nix-community.cachix.org"
10 | ];
11 |
12 | # will be appended to the system-level trusted-public-keys
13 | extra-trusted-public-keys = [
14 | # nix community's cache server public key
15 | "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
16 | ];
17 | };
18 |
19 | inputs = {
20 | # Nixpkgs
21 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
22 | # You can access packages and modules from different nixpkgs revs
23 | # at the same time. Here's an working example:
24 | # nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
25 | # Also see the 'unstable-packages' overlay at 'overlays/default.nix'.
26 |
27 | nixos-wsl = {
28 | url = "github:/nix-community/NixOS-WSL";
29 | inputs.nixpkgs.follows = "nixpkgs";
30 | };
31 | nur = {
32 | url = "github:nix-community/NUR";
33 | inputs.nixpkgs.follows = "nixpkgs";
34 | };
35 |
36 | # Home manager
37 | home-manager = {
38 | url = "github:nix-community/home-manager";
39 | inputs.nixpkgs.follows = "nixpkgs";
40 | };
41 | nix-on-droid = {
42 | url = "github:nix-community/nix-on-droid/release-23.11";
43 | inputs.nixpkgs.follows = "nixpkgs";
44 | };
45 |
46 | nix-index-database = {
47 | url = "github:nix-community/nix-index-database";
48 | inputs.nixpkgs.follows = "nixpkgs";
49 | };
50 |
51 | sops-nix = {
52 | url = "github:Mic92/sops-nix";
53 | inputs.nixpkgs.follows = "nixpkgs";
54 | };
55 | disko = {
56 | url = "github:nix-community/disko";
57 | inputs.nixpkgs.follows = "nixpkgs";
58 | };
59 | neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
60 | nixos-hardware.url = "github:nixos/nixos-hardware";
61 | stylix.url = "github:danth/stylix";
62 | };
63 |
64 | outputs = {
65 | self,
66 | nixpkgs,
67 | home-manager,
68 | nix-on-droid,
69 | nixos-hardware,
70 | nur,
71 | sops-nix,
72 | stylix,
73 | nix-index-database,
74 | disko,
75 | ...
76 | } @ inputs: let
77 | inherit (self) outputs;
78 | # Supported systems for your flake packages, shell, etc.
79 | systems = [
80 | #"aarch64-linux"
81 | #"i686-linux"
82 | "x86_64-linux"
83 | #"aarch64-darwin"
84 | #"x86_64-darwin"
85 | ];
86 | # This is a function that generates an attribute by calling a function you
87 | # pass to it, with each system as an argument
88 | forAllSystems = nixpkgs.lib.genAttrs systems;
89 | me = {
90 | username = "wenjin";
91 | mail = {
92 | outlook = "hewenjin94@outlook.com";
93 | gmail = "hewenjin1112@gmail.com";
94 | };
95 | };
96 | in {
97 | # Your custom packages
98 | # Accessible through 'nix build', 'nix shell', etc
99 | packages = forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
100 | # Formatter for your nix files, available through 'nix fmt'
101 | # Other options beside 'alejandra' include 'nixpkgs-fmt'
102 | formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
103 |
104 | # Your custom packages and modifications, exported as overlays
105 | overlays = import ./overlays {inherit inputs;};
106 | # Reusable nixos modules you might want to export
107 | # These are usually stuff you would upstream into nixpkgs
108 | nixosModules = import ./modules/nixos;
109 | # Reusable home-manager modules you might want to export
110 | # These are usually stuff you would upstream into home-manager
111 | homeManagerModules = import ./modules/home-manager;
112 |
113 | # NixOS configuration entrypoint
114 | # Available through 'nixos-rebuild --flake .#your-hostname'
115 | nixosConfigurations = {
116 | nixos = nixpkgs.lib.nixosSystem {
117 | system = "x86_64-linux";
118 | specialArgs = {inherit inputs outputs me;};
119 | modules = [
120 | # > Our main nixos configuration file <
121 | ./nixos/hosts/nixos
122 | nixos-hardware.nixosModules.lenovo-thinkpad-x1-9th-gen
123 | nur.modules.nixos.default
124 | sops-nix.nixosModules.sops
125 | stylix.nixosModules.stylix
126 | nix-index-database.nixosModules.nix-index
127 | # for eGPU
128 | nixos-hardware.nixosModules.common-gpu-amd
129 | ];
130 | };
131 | nixos-wsl = nixpkgs.lib.nixosSystem {
132 | system = "x86_64-linux";
133 | specialArgs = {inherit inputs outputs me;};
134 | modules = [
135 | ./nixos/hosts/nixos-wsl
136 | nur.modules.nixos.default
137 | sops-nix.nixosModules.sops
138 | nix-index-database.nixosModules.nix-index
139 | ];
140 | };
141 | aws = nixpkgs.lib.nixosSystem {
142 | system = "x86_64-linux";
143 | specialArgs = {inherit inputs outputs me;};
144 | modules = [
145 | ./nixos/hosts/aws
146 | ];
147 | };
148 | aliyun = nixpkgs.lib.nixosSystem {
149 | system = "x86_64-linux";
150 | specialArgs = {inherit inputs outputs me;};
151 | modules = [
152 | disko.nixosModules.disko
153 | ./nixos/hosts/aliyun
154 | ];
155 | };
156 | };
157 |
158 | # Available through 'nix-on-droid switch --flake path/to/flake#device'
159 | nixOnDroidConfigurations.default = nix-on-droid.lib.nixOnDroidConfiguration {
160 | modules = [
161 | ./nixos/hosts/nix-on-droid
162 |
163 | # list of extra modules for Nix-on-Droid system
164 | # { nix.registry.nixpkgs.flake = nixpkgs; }
165 | # ./path/to/module.nix
166 |
167 | # or import source out-of-tree modules like:
168 | # flake.nixOnDroidModules.module
169 | ];
170 |
171 | # list of extra special args for Nix-on-Droid modules
172 | extraSpecialArgs = {username = "nix-on-droid";};
173 |
174 | # set nixpkgs instance, it is recommended to apply `nix-on-droid.overlays.default`
175 | pkgs = import nixpkgs {
176 | system = "aarch64-linux";
177 |
178 | overlays = [
179 | nix-on-droid.overlays.default
180 | # add other overlays
181 | ];
182 | };
183 | # set path to home-manager flake
184 | home-manager-path = home-manager.outPath;
185 | };
186 |
187 | # Standalone home-manager configuration entrypoint
188 | # Available through 'home-manager --flake .#your-username@your-hostname'
189 | homeConfigurations = {
190 | "wenjin@nixos" = home-manager.lib.homeManagerConfiguration {
191 | pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
192 | extraSpecialArgs = {inherit inputs outputs me;};
193 | modules = [
194 | # > Our main home-manager configuration file <
195 | ./home-manager/home.nix
196 | ./home-manager/hosts/nixos.nix
197 | nur.modules.homeManager.default
198 | stylix.homeModules.stylix
199 | nix-index-database.hmModules.nix-index
200 | ];
201 | };
202 | "wenjin@nixos-wsl" = home-manager.lib.homeManagerConfiguration {
203 | pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
204 | extraSpecialArgs = {inherit inputs outputs me;};
205 | modules = [
206 | # > Our main home-manager configuration file <
207 | ./home-manager/home.nix
208 | nix-index-database.hmModules.nix-index
209 | ];
210 | };
211 | };
212 | };
213 | }
214 |
--------------------------------------------------------------------------------
/home-manager/home.nix:
--------------------------------------------------------------------------------
1 | # This is your home-manager configuration file
2 | # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
3 | {
4 | inputs,
5 | outputs,
6 | lib,
7 | config,
8 | pkgs,
9 | me,
10 | ...
11 | }: let
12 | dotfiles_path = "${config.home.homeDirectory}/.dotfiles";
13 | archive_path = "${config.home.homeDirectory}/.archive";
14 | note_path = "${config.home.homeDirectory}/.note";
15 | in
16 | {
17 | # You can import other home-manager modules here
18 | imports = with outputs.homeManagerModules; [
19 | # If you want to use modules your own flake exports (from modules/home-manager):
20 | # outputs.homeManagerModules.example
21 | zsh
22 | starship
23 | neovim
24 | git
25 | ctags
26 | yazi
27 | mime
28 | git-sync
29 | btop
30 | lang
31 | direnv
32 | translate-shell
33 | ripgrep
34 | tmux
35 | sops
36 | mail
37 | mpd
38 | syncthing
39 | # Or modules exported from other flakes (such as nix-colors):
40 | # inputs.nix-colors.homeManagerModules.default
41 |
42 | # You can also split up your configuration and import pieces of it here:
43 | # ./nvim.nix
44 | ];
45 |
46 | nixpkgs = {
47 | # You can add overlays here
48 | overlays = [
49 | # Add overlays your own flake exports (from overlays and pkgs dir):
50 | outputs.overlays.additions
51 | outputs.overlays.modifications
52 | # outputs.overlays.unstable-packages
53 |
54 | # You can also add overlays exported from other flakes:
55 | # neovim-nightly-overlay.overlays.default
56 |
57 | # Or define it inline, for example:
58 | # (final: prev: {
59 | # hi = final.hello.overrideAttrs (oldAttrs: {
60 | # patches = [ ./change-hello-to-hi.patch ];
61 | # });
62 | # })
63 | ];
64 | # Configure your nixpkgs instance
65 | config = {
66 | # Disable if you don't want unfree packages
67 | allowUnfree = true;
68 | };
69 | };
70 |
71 | # TODO: Set your username
72 | home = {
73 | username = "${me.username}";
74 | homeDirectory = "/home/${me.username}";
75 | };
76 |
77 | # Add stuff for your user as you see fit:
78 | # programs.neovim.enable = true;
79 | home.packages = with pkgs; [
80 | # # Adds the 'hello' command to your environment. It prints a friendly
81 | # # "Hello, world!" when run.
82 | # pkgs.hello
83 |
84 | # # It is sometimes useful to fine-tune packages, for example, by applying
85 | # # overrides. You can do that directly here, just don't forget the
86 | # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
87 | # # fonts?
88 | # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
89 |
90 | # # You can also create simple shell scripts directly inside your
91 | # # configuration. For example, this adds a command 'my-hello' to your
92 | # # environment:
93 | # (pkgs.writeShellScriptBin "my-hello" ''
94 | # echo "Hello, ${config.home.username}!"
95 | # '')/
96 | fastfetch
97 | ffmpeg
98 | distrobox
99 | bat
100 | fd
101 | ripgrep
102 | fzf
103 | socat
104 | lazygit
105 | jq
106 | lsd
107 | duf
108 | cowsay
109 | file
110 | which
111 | tree
112 | traceroute
113 | gnused
114 | gnutar
115 | gawk
116 | zstd
117 | gnupg
118 | du-dust
119 | inotify-tools
120 | libnotify
121 | lsof
122 | fhs
123 | appimage-run
124 | zip
125 | unzipNLS
126 | glib
127 | killall
128 | k9s
129 | minikube
130 | kubernetes
131 | kubectl
132 | autossh
133 | mermaid-cli
134 | mermaid-filter
135 | pandoc
136 | yq
137 | quicktype
138 | openpomodoro-cli
139 | cloc
140 | frp
141 | xdg-utils
142 | trashy
143 | w3m
144 | networkmanagerapplet
145 | browserpass
146 | devenv
147 | # for nvim dict
148 | wordnet
149 | # nix related
150 | #
151 | # it provides the command `nom` works just like `nix`
152 | # with more details log output
153 | nix-output-monitor
154 | nixpkgs-review
155 | treefmt
156 | ];
157 |
158 | # xresources.properties = {
159 | # "Xcursor.size" = 16;
160 | # "Xft.dpi" = 172;
161 | # };
162 |
163 | # Home Manager is pretty good at managing dotfiles. The primary way to manage
164 | # plain files is through 'home.file'.
165 | home.file = {
166 | # # Building this configuration will create a copy of 'dotfiles/screenrc' in
167 | # # the Nix store. Activating the configuration will then make '~/.screenrc' a
168 | # # symlink to the Nix store copy.
169 | # ".screenrc".source = dotfiles/screenrc;
170 | # ".config/qt5ct".source = ./xdg-config-home/qt5ct;
171 | # ".config/hypr" = {
172 | # source = ./xdg-config-home/hypr;
173 | # recursive = true;
174 | # };
175 |
176 | # # You can also set the file content immediately.
177 | # ".gradle/gradle.properties".text = ''
178 | # org.gradle.console=verbose
179 | # org.gradle.daemon.idletimeout=3600000
180 | # '';
181 | };
182 |
183 | # Home Manager can also manage your environment variables through
184 | # 'home.sessionVariables'. If you don't want to manage your shell through Home
185 | # Manager then you have to manually source 'hm-session-vars.sh' located at
186 | # either
187 | #
188 | # ~/.nix-profile/etc/profile.d/hm-session-vars.sh
189 | #
190 | # or
191 | #
192 | # /etc/profiles/per-user/wenjin/etc/profile.d/hm-session-vars.sh
193 | #
194 | home.sessionPath = [
195 | # add oauth2 script
196 | "${config.home.homeDirectory}/.local/bin"
197 | ];
198 | home.sessionVariables = {
199 | DOTFILES = dotfiles_path;
200 | ARCHIVE = archive_path;
201 | NOTE = note_path;
202 | SOPS_SECRETS = "${dotfiles_path}/secrets.yaml";
203 | };
204 |
205 | xdg = {
206 | enable = true;
207 | userDirs.enable = true;
208 | };
209 |
210 |
211 | programs = {
212 | gh = {
213 | enable = true;
214 | extensions = with pkgs; [
215 | gh-copilot
216 | gh-models
217 | ];
218 | };
219 | nix-index = {
220 | enable = true;
221 | enableZshIntegration = true;
222 | };
223 | mangohud = {
224 | enable = true;
225 | settings = {
226 | cpu_temp = true;
227 | gpu_temp = true;
228 | ram = true;
229 | vram = true;
230 | font_scale = lib.mkForce 2.0;
231 | background_alpha = lib.mkForce 0.5;
232 | };
233 | };
234 | # Enable home-manager
235 | home-manager.enable = true;
236 | gpg.enable = true;
237 | bash.enable = true;
238 | imv.enable = true;
239 | browserpass.enable = true;
240 | password-store = {
241 | enable = true;
242 | package = pkgs.pass.withExtensions (exts: [
243 | exts.pass-otp
244 | exts.pass-tomb
245 | exts.pass-file
246 | exts.pass-audit
247 | exts.pass-update
248 | exts.pass-import
249 | exts.pass-checkup
250 | exts.pass-genphrase
251 | ]);
252 | settings = {
253 | PASSWORD_STORE_DIR = "${archive_path}/password-store";
254 | };
255 | };
256 | zathura = {
257 | enable = true;
258 | options = {
259 | recolor = true;
260 | };
261 | };
262 | };
263 |
264 | services.gpg-agent = {
265 | enable = true;
266 | maxCacheTtl = 60480000;
267 | defaultCacheTtl = 60480000;
268 | };
269 |
270 | # Nicely reload system units when changing configs
271 | systemd.user.startServices = "sd-switch";
272 |
273 | # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
274 | home.stateVersion = "23.11";
275 | }
276 |
--------------------------------------------------------------------------------
/home-manager/hosts/nix-on-droid.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | username,
8 | ...
9 | }: {
10 | imports = [
11 | # If you want to use modules your own flake exports (from modules/home-manager):
12 | # outputs.homeManagerModules.example
13 | ../../modules/home-manager/zsh.nix
14 | ../../modules/home-manager/starship.nix
15 | ../../modules/home-manager/git-sync.nix
16 | # Or modules exported from other flakes (such as nix-colors):
17 | # inputs.nix-colors.homeManagerModules.default
18 |
19 | # You can also split up your configuration and import pieces of it here:
20 | # ./nvim.nix
21 | ];
22 |
23 | programs.git = {
24 | enable = true;
25 | userName = "wenjinnn";
26 | userEmail = "hewenjin94@outlook.com";
27 | extraConfig = {
28 | color.ui = true;
29 | credential.helper = "store";
30 | github.user = "wenjinnn";
31 | push.autoSetupRemote = true;
32 | mergetool.keepBackup = false;
33 | };
34 | };
35 |
36 | # TODO: Set your username
37 | home = {
38 | username = "nix-on-droid";
39 | homeDirectory = "/data/data/com.termux.nix/files/home";
40 | };
41 |
42 | # Add stuff for your user as you see fit:
43 | # programs.neovim.enable = true;
44 | home.packages = with pkgs; [
45 | # # Adds the 'hello' command to your environment. It prints a friendly
46 | # # "Hello, world!" when run.
47 | # pkgs.hello
48 |
49 | # # It is sometimes useful to fine-tune packages, for example, by applying
50 | # # overrides. You can do that directly here, just don't forget the
51 | # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
52 | # # fonts?
53 | # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
54 |
55 | # # You can also create simple shell scripts directly inside your
56 | # # configuration. For example, this adds a command 'my-hello' to your
57 | # # environment:
58 | # (pkgs.writeShellScriptBin "my-hello" ''
59 | # echo "Hello, ${config.home.username}!"
60 | # '')/
61 | neofetch
62 | bat
63 | fd
64 | ripgrep
65 | fzf
66 | socat
67 | jq
68 | lsd
69 | duf
70 | cowsay
71 | file
72 | which
73 | tree
74 | traceroute
75 | gnused
76 | gnutar
77 | gawk
78 | zstd
79 | gnupg
80 | lsof
81 | # nix related
82 | #
83 | # it provides the command `nom` works just like `nix`
84 | # with more details log output
85 | nix-output-monitor
86 | zip
87 | unzip
88 | glib
89 | killall
90 | gh
91 | yq
92 | ];
93 |
94 | programs.bash.enable = true;
95 | # Enable home-manager
96 | programs.home-manager.enable = true;
97 |
98 | # Nicely reload system units when changing configs
99 | systemd.user.startServices = "sd-switch";
100 |
101 | # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
102 | home.stateVersion = "23.11";
103 | }
104 |
--------------------------------------------------------------------------------
/home-manager/hosts/nixos.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | imports = with outputs.homeManagerModules; [
10 | # If you want to use modules your own flake exports (from modules/home-manager):
11 | # outputs.homeManagerModules.example
12 | hyprland
13 | fcitx5
14 | theme
15 | mpv
16 | foot
17 | vscode
18 | aria2
19 | browser
20 | ];
21 |
22 | nixpkgs.config.permittedInsecurePackages = [
23 | "openssl-1.1.1w"
24 | ];
25 |
26 | gtk.gtk3.bookmarks = let
27 | homePath = "file://${config.home.homeDirectory}";
28 | in [
29 | "${homePath}/Documents"
30 | "${homePath}/Downloads"
31 | "${homePath}/Music"
32 | "${homePath}/Pictures"
33 | "${homePath}/Public"
34 | "${homePath}/Repo"
35 | "${homePath}/Templates"
36 | "${homePath}/Videos"
37 | ];
38 |
39 | services.remmina.enable = true;
40 |
41 | home.packages = with pkgs; [
42 | gimp3-with-plugins
43 | darktable
44 | obs-studio
45 | scrcpy
46 | wpsoffice-cn
47 | dconf-editor
48 | wireshark
49 | mitmproxy
50 | waydroid
51 | bottles
52 | telegram-desktop
53 | discord
54 | showmethekey
55 | dbeaver-bin
56 | redisinsight
57 | wechat-uos
58 | shotcut
59 | qq
60 | wemeet
61 | obsidian
62 | obsidian-export
63 | nur.repos.xddxdd.dingtalk
64 | ];
65 | }
66 |
--------------------------------------------------------------------------------
/modules/home-manager/aria2.nix:
--------------------------------------------------------------------------------
1 | {
2 | pkgs,
3 | config,
4 | ...
5 | }: {
6 | programs.aria2 = {
7 | enable = true;
8 | # TODO get bt-tracker from https://github.com/ngosang/trackerslist, maybe write a script later.
9 | extraConfig = ''
10 | bt-tracker=udp://93.158.213.92:1337/announce,udp://23.134.89.9:1337/announce,udp://186.10.181.37:1337/announce,udp://185.243.218.213:80/announce,udp://208.83.20.20:6969/announce,udp://15.204.56.171:6969/announce,udp://45.9.60.30:6969/announce,udp://104.244.77.87:6969/announce,udp://23.153.248.83:6969/announce,udp://83.102.180.21:80/announce,udp://37.235.176.37:2710/announce,udp://34.89.51.235:6969/announce,udp://5.181.156.41:6969/announce,udp://198.12.89.149:6969/announce,udp://37.27.4.53:6969/announce,udp://185.216.179.62:25/announce
11 | '';
12 | settings = {
13 | listen-port = 4001;
14 | dht-listen-port = 4000;
15 | dir = "${config.home.homeDirectory}/Downloads/aria2";
16 | enable-rpc = true;
17 | rpc-listen-all = true;
18 | rpc-allow-origin-all = true;
19 | };
20 | };
21 | home.packages = with pkgs; [
22 | # accessiable through ~/.nix-profile/share/ariang/index.html
23 | ariang
24 | ];
25 | }
26 |
--------------------------------------------------------------------------------
/modules/home-manager/browser.nix:
--------------------------------------------------------------------------------
1 | {me, ...}: {
2 | programs.firefox = {
3 | enable = true;
4 | };
5 | }
6 |
--------------------------------------------------------------------------------
/modules/home-manager/btop.nix:
--------------------------------------------------------------------------------
1 | {
2 | programs.btop = {
3 | enable = true;
4 | settings = {
5 | vim_keys = true;
6 | };
7 | };
8 | }
9 |
--------------------------------------------------------------------------------
/modules/home-manager/ctags.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | home.packages = with pkgs; [
10 | universal-ctags
11 | ];
12 | xdg.configFile = {
13 | "ctags".source = ../../xdg/config/ctags;
14 | };
15 | }
16 |
--------------------------------------------------------------------------------
/modules/home-manager/default.nix:
--------------------------------------------------------------------------------
1 | # Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
2 | # These should be stuff you would like to share with others, not your personal configurations.
3 | {
4 | # List your module files here
5 | # my-module = import ./my-module.nix;
6 | hyprland = import ./hyprland.nix;
7 | zsh = import ./zsh.nix;
8 | foot = import ./foot.nix;
9 | neovim = import ./neovim.nix;
10 | git = import ./git.nix;
11 | fcitx5 = import ./fcitx5.nix;
12 | theme = import ./theme.nix;
13 | fuzzel = import ./fuzzel.nix;
14 | ctags = import ./ctags.nix;
15 | yazi = import ./yazi.nix;
16 | mpv = import ./mpv.nix;
17 | mime = import ./mime.nix;
18 | git-sync = import ./git-sync.nix;
19 | gnome-terminal = import ./gnome-terminal.nix;
20 | tmux = import ./tmux.nix;
21 | wezterm = import ./wezterm.nix;
22 | lang = import ./lang.nix;
23 | btop = import ./btop.nix;
24 | vscode = import ./vscode.nix;
25 | direnv = import ./direnv.nix;
26 | translate-shell = import ./translate-shell.nix;
27 | aria2 = import ./aria2.nix;
28 | starship = import ./starship.nix;
29 | ripgrep = import ./ripgrep.nix;
30 | sops = import ./sops.nix;
31 | mail = import ./mail.nix;
32 | zellij = import ./zellij.nix;
33 | mpd = import ./mpd.nix;
34 | rofi = import ./rofi.nix;
35 | waybar = import ./waybar.nix;
36 | wallpaper = import ./wallpaper.nix;
37 | browser = import ./browser.nix;
38 | syncthing = import ./syncthing.nix;
39 | }
40 |
--------------------------------------------------------------------------------
/modules/home-manager/direnv.nix:
--------------------------------------------------------------------------------
1 | {
2 | programs.direnv = {
3 | enable = true;
4 | enableZshIntegration = true;
5 | nix-direnv.enable = true;
6 | config = {
7 | load_dotenv = true;
8 | };
9 | };
10 | }
11 |
--------------------------------------------------------------------------------
/modules/home-manager/fcitx5.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | # xdg.configFile = {
10 | # "fcitx5/profile" = {
11 | # source = ../../xdg/config/fcitx5/profile;
12 | # # every time fcitx5 switch input method, it will modify ~/.config/fcitx5/profile,
13 | # # so we need to force replace it in every rebuild to avoid file conflict.
14 | # force = true;
15 | # };
16 | # "fcitx5/config".source = ../../xdg/config/fcitx5/config;
17 | # "fcitx5/conf/classicui.conf".source = ../../xdg/config/fcitx5/conf/classicui.conf;
18 | # };
19 | # rime sync dir link to private repo
20 | xdg.dataFile = {
21 | "fcitx5/rime/sync" = {
22 | source =
23 | config.lib.file.mkOutOfStoreSymlink
24 | "${config.home.sessionVariables.ARCHIVE}/rime/";
25 | };
26 | };
27 | # fcitx5
28 | i18n.inputMethod = {
29 | type = "fcitx5";
30 | enable = true;
31 | fcitx5 = {
32 | waylandFrontend = true;
33 | addons = with pkgs; [
34 | (fcitx5-rime.override {
35 | rimeDataPkgs = [
36 | nur.repos.xddxdd.rime-aurora-pinyin
37 | nur.repos.xddxdd.rime-custom-pinyin-dictionary
38 | nur.repos.xddxdd.rime-dict
39 | nur.repos.xddxdd.rime-ice
40 | nur.repos.xddxdd.rime-moegirl
41 | nur.repos.xddxdd.rime-zhwiki
42 | rime-data
43 | ];
44 | })
45 | fcitx5-mozc
46 | fcitx5-gtk
47 | ];
48 | settings = {
49 | inputMethod = {
50 | GroupOrder."0" = "Default";
51 | "Groups/0" = {
52 | Name = "Default";
53 | "Default Layout" = "us";
54 | DefaultIM = "keyboard-us";
55 | };
56 | "Groups/0/Items/0".Name = "keyboard-us";
57 | "Groups/0/Items/1".Name = "rime";
58 | "Groups/0/Items/2".Name = "mozc";
59 | };
60 | globalOptions = {
61 | Behavior = {
62 | ActiveByDefault = false;
63 | };
64 | Hotkey = {
65 | EnumerateWithTriggerKeys = true;
66 | EnumerateSkipFirst = false;
67 | };
68 | "Hotkey/TriggerKeys" = {
69 | "0" = "Super+space";
70 | };
71 | "Hotkey/AltTriggerKeys" = {
72 | "0" = "Shift_L";
73 | };
74 | "Hotkey/PrevCandidate" = {
75 | "0" = "Shift+Tab";
76 | };
77 | "Hotkey/NextCandidate" = {
78 | "0" = "Tab";
79 | };
80 | "Hotkey/EnumerateGroupForwardKeys" = {
81 | "0" = "Super+space";
82 | };
83 | "Hotkey/EnumerateGroupBackwardKeys" = {
84 | "0" = "Shift+Super+space";
85 | };
86 | Behavior = {
87 | PreeditEnabledByDefault = true;
88 | ShowInputMethodInformation = true;
89 | ShowInputMethodInformationWhenFocusIn = false;
90 | CompactInputMethodInformation = true;
91 | ShowFirstInputMethodInformation = true;
92 | };
93 | };
94 | addons = {
95 | classicui.globalSection.Theme = "stylix";
96 | };
97 | };
98 |
99 | };
100 | };
101 | }
102 |
--------------------------------------------------------------------------------
/modules/home-manager/foot.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | # foot
3 | programs.foot = {
4 | enable = true;
5 | server.enable = true;
6 | settings = {
7 | main = {
8 | letter-spacing = 0;
9 | dpi-aware = "no";
10 | bold-text-in-bright = "no";
11 | };
12 | scrollback = {
13 | lines = 10000;
14 | };
15 | cursor = {
16 | color = "1e1e1e cccccc";
17 | };
18 | colors = {
19 | background = "1e1e1e";
20 | foreground = "cccccc";
21 | regular0 = "000000";
22 | regular1 = "cd3131";
23 | regular2 = "0dbc79";
24 | regular3 = "e5e510";
25 | regular4 = "2472c8";
26 | regular5 = "bc3fbc";
27 | regular6 = "11a8cd";
28 | regular7 = "e5e5e5";
29 | bright0 = "666666";
30 | bright1 = "f14c4c";
31 | bright2 = "23d18b";
32 | bright3 = "f5f543";
33 | bright4 = "3b8eea";
34 | bright5 = "d670d6";
35 | bright6 = "29b8db";
36 | bright7 = "e5e5e5";
37 | };
38 | key-bindings = {
39 | scrollback-up-page = "Control+Shift+Page_Up";
40 | scrollback-down-page = "Control+Shift+Page_Down";
41 | clipboard-copy = "Control+Shift+c";
42 | clipboard-paste = "Control+Shift+v";
43 | search-start = "Control+Shift+f";
44 | };
45 | search-bindings = {
46 | cancel = "Escape";
47 | commit = "Return";
48 | find-prev = "Control+Shift+p";
49 | find-next = "Control+Shift+n";
50 | };
51 | };
52 | };
53 | }
54 |
--------------------------------------------------------------------------------
/modules/home-manager/fuzzel.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | programs.fuzzel = {
10 | enable = true;
11 | settings = {
12 | main = {
13 | font = "DejaVuSansM Nerd Font Mono:size=12";
14 | dpi-aware = "yes";
15 | terminal = "${pkgs.foot}/bin/footclient -e";
16 | layer = "overlay";
17 | };
18 | colors = {
19 | background = "171717ff";
20 | text = "eeeeeeff";
21 | selection = "373737ff";
22 | selection-text = "c4c4c4ff";
23 | border = "1f1f1fff";
24 | match = "5ba9e8ff";
25 | selection-match = "5ba9e8ff";
26 | };
27 | dmenu = {
28 | exit-immediately-if-empty = "yes";
29 | };
30 | border = {
31 | width = 1;
32 | };
33 | };
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/modules/home-manager/git-sync.nix:
--------------------------------------------------------------------------------
1 | { config, ... }:
2 | {
3 | services.git-sync = {
4 | enable = true;
5 | repositories = {
6 | archive = {
7 | path = config.home.sessionVariables.ARCHIVE;
8 | uri = "git@github.com:wenjinnn/.archive.git";
9 | };
10 | note = {
11 | path = config.home.sessionVariables.NOTE;
12 | uri = "git@github.com:wenjinnn/.note.git";
13 | };
14 | };
15 | };
16 | }
17 |
--------------------------------------------------------------------------------
/modules/home-manager/git.nix:
--------------------------------------------------------------------------------
1 | {
2 | me,
3 | pkgs,
4 | ...
5 | }: {
6 | # git
7 | programs.git = {
8 | enable = true;
9 | package = pkgs.gitAndTools.gitFull;
10 | userName = me.username;
11 | userEmail = me.mail.outlook;
12 | extraConfig = {
13 | color.ui = true;
14 | credential.helper = "store";
15 | github.user = "wenjinnn";
16 | push.autoSetupRemote = true;
17 | mergetool.keepBackup = false;
18 | merge.tool = "vimdiff";
19 | diff.tool = "vimdiff";
20 | core.autocrlf = "input";
21 | };
22 | };
23 | }
24 |
--------------------------------------------------------------------------------
/modules/home-manager/gnome-terminal.nix:
--------------------------------------------------------------------------------
1 | {me, ...}: {
2 | programs.gnome-terminal = {
3 | enable = true;
4 | showMenubar = false;
5 | profile."2feb4282-c157-43f0-a9cf-90e58422cfc8" = {
6 | visibleName = me.username;
7 | font = "monospace 11";
8 | default = true;
9 | allowBold = true;
10 | boldIsBright = true;
11 | transparencyPercent = 90;
12 | showScrollbar = false;
13 | };
14 | };
15 | }
16 |
--------------------------------------------------------------------------------
/modules/home-manager/lang.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | home.packages = with pkgs; [
3 | (python3.withPackages (p: [
4 | p.python-pam
5 | p.debugpy
6 | p.msal
7 | ]))
8 | gnumake
9 | cmake
10 | gcc
11 | gdb
12 | nodejs
13 | jdk21
14 | maven
15 | rustc
16 | cargo
17 | ];
18 |
19 | home.file = {
20 | ".local/lib/openjdk8".source = "${pkgs.jdk8}/lib/openjdk";
21 | ".local/lib/openjdk17".source = "${pkgs.jdk17}/lib/openjdk";
22 | ".local/lib/openjdk21".source = "${pkgs.jdk21}/lib/openjdk";
23 | ".m2/toolchains.xml".text = ''
24 |
25 |
26 |
27 |
28 | jdk
29 |
30 | 8
31 |
32 |
33 | ${pkgs.jdk8}/lib/openjdk
34 |
35 |
36 |
37 | '';
38 | ".m2/settings.xml".text = ''
39 |
40 |
41 |
42 | maven-default-http-blocker
43 | dummy
44 | Dummy mirror to override default blocking mirror that blocks http
45 | http://0.0.0.0/
46 |
47 |
48 |
49 | '';
50 | };
51 | }
52 |
--------------------------------------------------------------------------------
/modules/home-manager/mail.nix:
--------------------------------------------------------------------------------
1 | {
2 | pkgs,
3 | config,
4 | me,
5 | ...
6 | }: let
7 | username = me.username;
8 | gmail = me.mail.gmail;
9 | outlook = me.mail.outlook;
10 | # for the follow script will be used in systemd unit, so we don't use ${sops_secrets} here
11 | sops_secrets = config.home.sessionVariables.SOPS_SECRETS;
12 | mutt_oauth2 = "${pkgs.neomutt}/share/neomutt/oauth2/mutt_oauth2.py";
13 | # outlook token setup
14 | outlook_oauth2_token_path = "${config.home.homeDirectory}/.cache/neomutt/${outlook}.tokens";
15 | init_outlook_oauth2_token = pkgs.writeShellScript "init_outlook_oauth2_token" ''
16 | export GPG_TTY=$(tty)
17 | ${mutt_oauth2} ${outlook_oauth2_token_path} \
18 | --verbose \
19 | --authorize \
20 | --provider microsoft \
21 | --encryption-pipe="gpg --encrypt --default-recipient-self" \
22 | --client-id "$(sops exec-env ${sops_secrets} 'echo -e $OUTLOOK_CLIENT_ID')" \
23 | --client-secret "" \
24 | --authflow localhostauthcode \
25 | --email ${outlook}
26 | '';
27 | outlook_oauth2_token = pkgs.writeShellScript "outlook_oauth2_token" ''
28 | export GPG_TTY=$(tty)
29 | ${mutt_oauth2} ${outlook_oauth2_token_path}
30 | '';
31 | # gmail token setup
32 | gmail_oauth2_token_path = "${config.home.homeDirectory}/.cache/neomutt/${gmail}.tokens";
33 | init_gmail_oauth2_token = pkgs.writeShellScript "init_gmail_oauth2_token" ''
34 | export GPG_TTY=$(tty)
35 | ${mutt_oauth2} ${gmail_oauth2_token_path} \
36 | --verbose \
37 | --authorize \
38 | --provider google \
39 | --encryption-pipe="gpg --encrypt --default-recipient-self" \
40 | --client-id "$(sops exec-env ${sops_secrets} 'echo -e $GMAIL_CLIENT_ID')" \
41 | --client-secret "$(sops exec-env ${sops_secrets} 'echo -e $GMAIL_CLIENT_SECRET')" \
42 | --authflow localhostauthcode \
43 | --email ${gmail}
44 | '';
45 | gmail_oauth2_token = pkgs.writeShellScript "gmail_oauth2_token" ''
46 | export GPG_TTY=$(tty)
47 | ${mutt_oauth2} ${gmail_oauth2_token_path}
48 | '';
49 | notmuch_new = "${pkgs.notmuch}/bin/notmuch new";
50 | in {
51 | home.file = {
52 | ".local/bin/init_gmail_oauth2_token".source = init_gmail_oauth2_token;
53 | ".local/bin/init_outlook_oauth2_token".source = init_outlook_oauth2_token;
54 | };
55 |
56 | accounts.email.accounts = {
57 | ${outlook} = {
58 | realName = "${username}";
59 | userName = "${outlook}";
60 | address = "${outlook}";
61 | primary = true;
62 | maildir.path = "${outlook}";
63 | neomutt = {
64 | enable = true;
65 | mailboxName = "${outlook}";
66 | };
67 | notmuch.enable = true;
68 | passwordCommand = "${outlook_oauth2_token}";
69 | imapnotify = {
70 | enable = true;
71 | boxes = ["Inbox"];
72 | onNotifyPost = ''${pkgs.libnotify}/bin/notify-send "New mail in:" "${outlook}"'';
73 | onNotify = "${pkgs.offlineimap}/bin/offlineimap -a ${outlook} && ${notmuch_new}";
74 | extraConfig = {
75 | xoAuth2 = true;
76 | };
77 | };
78 | imap = {
79 | host = "outlook.office365.com";
80 | tls.enable = true;
81 | port = 993;
82 | };
83 | smtp = {
84 | host = "smtp-mail.outlook.com";
85 | port = 587;
86 | tls.enable = true;
87 | tls.useStartTls = true;
88 | };
89 | offlineimap = {
90 | enable = true;
91 | postSyncHookCommand = notmuch_new;
92 | extraConfig = {
93 | remote = {
94 | remotepasseval = false;
95 | auth_mechanisms = "XOAUTH2";
96 | oauth2_request_url = "https://login.microsoftonline.com/common/oauth2/v2.0/token";
97 | oauth2_client_id_eval = ''get_output("sops exec-env ${sops_secrets} 'echo -e $OUTLOOK_CLIENT_ID'")'';
98 | oauth2_client_secret = "";
99 | oauth2_access_token_eval = ''get_output("${outlook_oauth2_token}")'';
100 | };
101 | };
102 | };
103 | msmtp = {
104 | enable = true;
105 | extraConfig = {
106 | auth = "xoauth2";
107 | passwordeval = "${outlook_oauth2_token}";
108 | };
109 | };
110 | };
111 | ${gmail} = {
112 | realName = "${username}";
113 | userName = "${gmail}";
114 | address = "${gmail}";
115 | maildir.path = "${gmail}";
116 | neomutt = {
117 | enable = true;
118 | mailboxName = "${gmail}";
119 | };
120 | notmuch.enable = true;
121 | passwordCommand = "${gmail_oauth2_token}";
122 | imapnotify = {
123 | enable = true;
124 | boxes = ["Inbox"];
125 | onNotifyPost = ''${pkgs.libnotify}/bin/notify-send "New mail in:" "${gmail}"'';
126 | onNotify = "${pkgs.offlineimap}/bin/offlineimap -a ${gmail} && ${notmuch_new}";
127 | extraConfig = {
128 | xoAuth2 = true;
129 | };
130 | };
131 | imap = {
132 | host = "imap.gmail.com";
133 | tls.enable = true;
134 | port = 993;
135 | };
136 | smtp = {
137 | host = "smtp.gmail.com";
138 | port = 587;
139 | tls.enable = true;
140 | tls.useStartTls = true;
141 | };
142 | offlineimap = {
143 | enable = true;
144 | postSyncHookCommand = notmuch_new;
145 | extraConfig = {
146 | account = {
147 | synclabels = "yes";
148 | };
149 | local = {
150 | type = "GmailMaildir";
151 | nametrans = ''
152 | lambda foldername: re.sub ('Inbox', 'INBOX', foldername)
153 | '';
154 | };
155 | remote = {
156 | type = "Gmail";
157 | remotepasseval = false;
158 | auth_mechanisms = "XOAUTH2";
159 | oauth2_request_url = "https://oauth2.googleapis.com/token";
160 | oauth2_client_id_eval = ''get_output("sops exec-env ${sops_secrets} 'echo -e $GMAIL_CLIENT_ID'")'';
161 | oauth2_client_secret_eval = ''get_output("sops exec-env ${sops_secrets} 'echo -e $GMAIL_CLIENT_SECRET'")'';
162 | oauth2_access_token_eval = ''get_output("${gmail_oauth2_token}")'';
163 | nametrans = ''
164 | lambda foldername: re.sub ('INBOX', 'Inbox', foldername)
165 | '';
166 | folderfilter = ''lambda foldername: foldername not in ['[Gmail]/All Mail']'';
167 | };
168 | };
169 | };
170 | msmtp = {
171 | enable = true;
172 | extraConfig = {
173 | auth = "xoauth2";
174 | passwordeval = "${gmail_oauth2_token}";
175 | };
176 | };
177 | };
178 | # local mail box for read rss source
179 | ${username} = {
180 | realName = "${username}";
181 | userName = "${username}";
182 | address = "${username}@nixos.com";
183 | maildir.path = "${username}";
184 | neomutt = {
185 | enable = true;
186 | mailboxName = "${username}";
187 | };
188 | notmuch.enable = true;
189 | passwordCommand = "";
190 | imap = {
191 | host = "localhost";
192 | };
193 | smtp = {
194 | host = "localhost";
195 | };
196 | };
197 | };
198 |
199 | programs = {
200 | neomutt = {
201 | enable = true;
202 | vimKeys = true;
203 | extraConfig = ''
204 | set query_command = "lbdbq '%s'"
205 |
206 | unauto_view "*"
207 |
208 | # Quote
209 | color body brightcyan default "^[>].*"
210 |
211 | # Link
212 | color body brightyellow default "(https?|ftp)://[^ ]+"
213 |
214 | # Code block start and end
215 | color body cyan default "^\`\`\`.*$"
216 |
217 | # mail address
218 | color body yellow default "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
219 |
220 | # Patch mail highlight, copied from https://github.com/neomutt/dyk/issues/13
221 | # Diff changes
222 | color body brightgreen default "^[+].*"
223 | color body brightred default "^[-].*"
224 |
225 | # Diff file
226 | color body green default "^[-][-][-] .*"
227 | color body green default "^[+][+][+] .*"
228 |
229 | # Diff header
230 | color body green default "^diff .*"
231 | color body green default "^index .*"
232 |
233 | # Diff chunk
234 | color body cyan default "^@@ .*"
235 |
236 | # Linked issue
237 | color body brightgreen default "^(close[ds]*|fix(e[ds])*|resolve[sd]*):* *#[0-9]+$"
238 |
239 | # Credit
240 | color body brightwhite default "(signed-off|co-authored)-by: .*"
241 | '';
242 | };
243 | notmuch.enable = true;
244 | msmtp.enable = true;
245 | offlineimap = {
246 | enable = true;
247 | pythonFile = ''
248 | import subprocess
249 |
250 | def get_output(cmd):
251 | return subprocess.check_output(cmd, shell=True).decode('utf8')
252 | '';
253 | };
254 | };
255 |
256 | services.imapnotify = {
257 | enable = true;
258 | path = with pkgs; [
259 | coreutils
260 | python3
261 | libnotify
262 | offlineimap
263 | gnupg
264 | notmuch
265 | sops
266 | ];
267 | };
268 |
269 | home.packages = [pkgs.lbdb];
270 |
271 | home.file = {
272 | ".mailcap".text = ''
273 | audio/*; xdg-open %s
274 |
275 | image/*; xdg-open %s
276 |
277 | application/msword; xdg-open %s
278 | application/pdf; xdg-open %s
279 | application/postscript ; xdg-open %s
280 |
281 | application/x-gunzip; xdg-open %s
282 | application/x-tar-gz; xdg-open %s
283 |
284 | text/html; xdg-open %s ; nametemplate=%s.html
285 | '';
286 | };
287 |
288 | }
289 |
--------------------------------------------------------------------------------
/modules/home-manager/mime.nix:
--------------------------------------------------------------------------------
1 | let
2 | browser = "firefox.desktop";
3 | file-manager = "org.gnome.Nautilus.desktop";
4 | image-viewer = "imv.desktop";
5 | pdf-viewer = "org.pwmt.zathura.desktop";
6 | nvim = "nvim.desktop";
7 | in {
8 | xdg.mimeApps = rec {
9 | enable = true;
10 | associations.added = defaultApplications;
11 | defaultApplications = {
12 | "inode/directory" = file-manager;
13 |
14 | "x-scheme-handler/http" = browser;
15 | "x-scheme-handler/https" = browser;
16 | "application/xhtml+xml" = browser;
17 | "text/html" = browser;
18 | "text/plain" = nvim;
19 |
20 | "application/pdf" = pdf-viewer;
21 |
22 | "image/jpeg" = image-viewer;
23 | "image/bmp" = image-viewer;
24 | "image/gif" = image-viewer;
25 | "image/jpg" = image-viewer;
26 | "image/pjpeg" = image-viewer;
27 | "image/png" = image-viewer;
28 | "image/tiff" = image-viewer;
29 | "image/webp" = image-viewer;
30 | "image/x-bmp" = image-viewer;
31 | "image/x-gray" = image-viewer;
32 | "image/x-icb" = image-viewer;
33 | "image/x-ico" = image-viewer;
34 | "image/x-png" = image-viewer;
35 | "image/x-portable-anymap" = image-viewer;
36 | "image/x-portable-bitmap" = image-viewer;
37 | "image/x-portable-graymap" = image-viewer;
38 | "image/x-portable-pixmap" = image-viewer;
39 | "image/x-xbitmap" = image-viewer;
40 | "image/x-xpixmap" = image-viewer;
41 | "image/x-pcx" = image-viewer;
42 | "image/svg+xml" = image-viewer;
43 | "image/svg+xml-compressed" = image-viewer;
44 | "image/vnd.wap.wbmp" = image-viewer;
45 | "image/x-icns" = image-viewer;
46 | };
47 | };
48 | }
49 |
--------------------------------------------------------------------------------
/modules/home-manager/mpd.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | home.packages = [
3 | pkgs.mpc
4 | ];
5 | services = {
6 | mpd-mpris.enable = true;
7 | mpd = {
8 | enable = true;
9 | extraConfig = ''
10 | audio_output {
11 | type "pipewire"
12 | name "PipeWire Sound Server"
13 | }
14 | '';
15 | };
16 | };
17 | programs.ncmpcpp = {
18 | enable = true;
19 | bindings = [
20 | {
21 | key = "j";
22 | command = "scroll_down";
23 | }
24 | {
25 | key = "k";
26 | command = "scroll_up";
27 | }
28 | {
29 | key = "J";
30 | command = ["select_item" "scroll_down"];
31 | }
32 | {
33 | key = "K";
34 | command = ["select_item" "scroll_up"];
35 | }
36 | ];
37 | };
38 | }
39 |
--------------------------------------------------------------------------------
/modules/home-manager/mpv.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | programs.mpv = {
3 | enable = true;
4 | scripts = with pkgs.mpvScripts; [
5 | memo
6 | uosc
7 | mpris
8 | cutter
9 | autoload
10 | thumbfast
11 | visualizer
12 | vr-reversal
13 | quality-menu
14 | mpv-cheatsheet
15 | webtorrent-mpv-hook
16 | ];
17 | config = {
18 | osd-bar = "no";
19 | border = "no";
20 | };
21 | };
22 | }
23 |
--------------------------------------------------------------------------------
/modules/home-manager/neovim.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | config,
4 | pkgs,
5 | ...
6 | }: {
7 | home.packages =
8 | (with pkgs; [
9 | # lsp related
10 | jdt-language-server
11 | lombok
12 | lua-language-server
13 | bash-language-server
14 | vue-language-server
15 | vscode-langservers-extracted
16 | lemminx-maven
17 | clang-tools
18 | nixd
19 | rust-analyzer
20 | vale-ls
21 | luajitPackages.luarocks-nix
22 | typescript
23 | typescript-language-server
24 | vue-language-server
25 | yaml-language-server
26 | vim-language-server
27 | texlab
28 | taplo
29 | gopls
30 | # formatter
31 | stylua
32 | libxml2
33 | alejandra
34 | nixfmt-rfc-style
35 | rustfmt
36 | kulala-fmt
37 | # for nvim-treesitter
38 | tree-sitter
39 | # ai and mcp tools
40 | vectorcode
41 | uv
42 | # another http tool
43 | hurl
44 | # for kulala.nvim
45 | grpcurl
46 | websocat
47 | openssl
48 | # for vim-dadbod
49 | mariadb
50 | redis
51 | oracle-instantclient
52 | ])
53 | ++ (with pkgs.python3Packages; [
54 | python-lsp-server
55 | pip
56 | ]);
57 |
58 | home.sessionVariables = {
59 | JAVA_8_HOME = "${pkgs.jdk8}/lib/openjdk";
60 | JAVA_17_HOME = "${pkgs.jdk17}/lib/openjdk";
61 | JAVA_21_HOME = "${pkgs.jdk21}/lib/openjdk";
62 | };
63 | xdg.configFile = {
64 | nvim = {
65 | source =
66 | config.lib.file.mkOutOfStoreSymlink
67 | "${config.home.sessionVariables.DOTFILES}/xdg/config/nvim";
68 | };
69 | "vale/.vale.ini".text = ''
70 | MinAlertLevel = suggestion
71 |
72 | [*]
73 | BasedOnStyles = Vale
74 | '';
75 | };
76 | programs.neovim = {
77 | enable = true;
78 | package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.default;
79 | viAlias = true;
80 | vimAlias = true;
81 | vimdiffAlias = true;
82 | defaultEditor = true;
83 |
84 | withRuby = true;
85 | withNodeJs = true;
86 | withPython3 = true;
87 |
88 | extraWrapperArgs = [
89 | "--suffix"
90 | "JAVA_TEST_PATH"
91 | ":"
92 | "${pkgs.vscode-extensions.vscjava.vscode-java-test}/share/vscode/extensions/vscjava.vscode-java-test"
93 | "--suffix"
94 | "JAVA_DEBUG_PATH"
95 | ":"
96 | "${pkgs.vscode-extensions.vscjava.vscode-java-debug}/share/vscode/extensions/vscjava.vscode-java-debug"
97 | "--suffix"
98 | "LOMBOK_PATH"
99 | ":"
100 | "${pkgs.lombok}/share/java"
101 | "--suffix"
102 | "SONARLINT_PATH"
103 | ":"
104 | "${pkgs.vscode-extensions.sonarsource.sonarlint-vscode}/share/vscode/extensions/sonarsource.sonarlint-vscode/"
105 | "--suffix"
106 | "VUE_LANGUAGE_SERVER_PATH"
107 | ":"
108 | "${pkgs.vue-language-server}/lib/node_modules/@vue/language-server"
109 | "--suffix"
110 | "TYPESCRIPT_LIBRARY"
111 | ":"
112 | "${pkgs.typescript}/lib/node_modules/typescript/lib"
113 | ];
114 | };
115 | }
116 |
--------------------------------------------------------------------------------
/modules/home-manager/ripgrep.nix:
--------------------------------------------------------------------------------
1 | {
2 | programs.ripgrep = {
3 | enable = true;
4 | arguments = [
5 | "--glob=!.git/*"
6 | "--glob=!**/target"
7 | "--glob=!**/node_modules"
8 | "--glob=!**/tags"
9 | "--glob=!**/rime/*.dict.yaml"
10 | "--glob=!**/.direnv"
11 | "--smart-case"
12 | "--hidden"
13 | "--no-ignore-vcs"
14 | ];
15 | };
16 | }
17 |
--------------------------------------------------------------------------------
/modules/home-manager/rofi.nix:
--------------------------------------------------------------------------------
1 | {
2 | pkgs,
3 | config,
4 | ...
5 | }: {
6 | home.packages = with pkgs; [
7 | rofi-power-menu
8 | rofi-bluetooth
9 | rofi-pulse-select
10 | rofi-systemd
11 | rofi-network-manager
12 | rofi-screenshot-wayland
13 | rofimoji
14 | cava
15 | ];
16 | programs.rofi = {
17 | enable = true;
18 | package = pkgs.rofi-wayland;
19 | pass = {
20 | enable = true;
21 | package = pkgs.rofi-pass-wayland;
22 | extraConfig = ''
23 | edit_terminal_command=foot
24 | '';
25 | };
26 | terminal = "${pkgs.foot}/bin/foot";
27 | extraConfig = {
28 | modes = "drun,run,window,ssh,calc,keys,recursivebrowser";
29 | show-icons = true;
30 | };
31 | plugins = [pkgs.rofi-calc];
32 | theme = let
33 | # Use `mkLiteral` for string-like values that should show without
34 | # quotes, e.g.:
35 | # {
36 | # foo = "abc"; => foo: "abc";
37 | # bar = mkLiteral "abc"; => bar: abc;
38 | # };
39 | inherit (config.lib.formats.rasi) mkLiteral;
40 | in {
41 | "#mainbox" = {
42 | children = map mkLiteral ["inputbar" "message" "listview" "mode-switcher"];
43 | };
44 | "#window" = {
45 | border = 1;
46 | };
47 | "#inputbar" = {
48 | children = map mkLiteral ["prompt" "textbox-prompt-colon" "entry" "num-filtered-rows" "textbox-num-sep" "num-rows" "case-indicator"];
49 | };
50 | "#textbox-prompt-colon" = {
51 | expand = false;
52 | str = "";
53 | margin = mkLiteral "0px 0.3em 0em 0em";
54 | text-color = mkLiteral "@foreground-color";
55 | };
56 | "#entry" = {
57 | text-color = mkLiteral "inherit";
58 | placeholder-color = mkLiteral "var(lightbg)";
59 | };
60 | "#num-filtered-rows" = {
61 | expand = false;
62 | text-color = mkLiteral "inherit";
63 | };
64 | "#num-rows" = {
65 | expand = false;
66 | text-color = mkLiteral "inherit";
67 | };
68 | "#textbox-num-sep" = {
69 | expand = false;
70 | str = "/";
71 | text-color = mkLiteral "inherit";
72 | };
73 | "#case-indicator" = {
74 | spacing = 0;
75 | text-color = mkLiteral "inherit";
76 | };
77 | };
78 | };
79 | }
80 |
--------------------------------------------------------------------------------
/modules/home-manager/sops.nix:
--------------------------------------------------------------------------------
1 | {
2 | pkgs,
3 | config,
4 | inputs,
5 | ...
6 | }: {
7 | imports = [
8 | inputs.sops-nix.homeManagerModules.sops
9 | ];
10 |
11 | sops = {
12 | defaultSopsFile = ../../secrets.yaml;
13 | age = {
14 | generateKey = true;
15 | sshKeyPaths = ["${config.home.homeDirectory}/.ssh/id_ed25519"];
16 | keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; # must have no password!
17 | };
18 | secrets.OUTLOOK_CLIENT_ID = {};
19 | secrets.GMAIL_CLIENT_ID = {};
20 | secrets.GMAIL_CLIENT_SECRET = {};
21 | };
22 |
23 | home.packages = with pkgs; [
24 | ssh-to-age
25 | age
26 | sops
27 | ];
28 | }
29 |
--------------------------------------------------------------------------------
/modules/home-manager/starship.nix:
--------------------------------------------------------------------------------
1 | {
2 | config,
3 | pkgs,
4 | ...
5 | }: {
6 | programs.starship = {
7 | enable = true;
8 | enableBashIntegration = true;
9 | enableZshIntegration = true;
10 | settings = {
11 | direnv.disabled = false;
12 | directory = {
13 | truncation_symbol = "…/";
14 | truncate_to_repo = false;
15 | };
16 | git_metrics.disabled = false;
17 | git_status = {
18 | diverged = "⇡$ahead_count⇣$behind_count";
19 | conflicted = "=$count";
20 | ahead = "⇡$count";
21 | behind = "⇣$count";
22 | untracked = "?$count";
23 | stashed = "+$count";
24 | modified = "!$count";
25 | staged = "\\$$count";
26 | renamed = "»$count";
27 | deleted = "✘$count";
28 | };
29 | localip = {
30 | ssh_only = false;
31 | disabled = false;
32 | };
33 | memory_usage.disabled = false;
34 | os.disabled = false;
35 | shell.disabled = false;
36 | shlvl.disabled = false;
37 | status.disabled = false;
38 | sudo.disabled = false;
39 | time.disabled = false;
40 | continuation_prompt = "▶▶ ";
41 | fill.symbol = " ";
42 | format = "$os$all";
43 | env_var.HTTP_PROXY = {
44 | variable = "HTTP_PROXY";
45 | default = "";
46 | format = "(🛰️ [$env_value]($style) )";
47 | style = "bright-blue bold";
48 | description = "The proxy environment variable";
49 | };
50 | };
51 | };
52 | }
53 |
--------------------------------------------------------------------------------
/modules/home-manager/syncthing.nix:
--------------------------------------------------------------------------------
1 | {
2 | services.syncthing = {
3 | enable = true;
4 | };
5 | }
6 |
--------------------------------------------------------------------------------
/modules/home-manager/theme.nix:
--------------------------------------------------------------------------------
1 | { pkgs, me, ... }:
2 | {
3 | home.pointerCursor = {
4 | gtk.enable = true;
5 | x11.enable = true;
6 | hyprcursor.enable = true;
7 | };
8 | dconf.enable = true;
9 | dconf.settings = {
10 | "org/gnome/desktop/interface" = {
11 | color-scheme = "prefer-dark";
12 | };
13 | };
14 |
15 | stylix = {
16 | enable = true;
17 | polarity = "dark";
18 | image = pkgs.fetchurl {
19 | url = "https://www.bing.com/th?id=OHR.NapoliPizza_ROW8840504063_UHD.jpg";
20 | sha256 = "sha256-1Andv0jmsakNgKv4n/q+McmL+eBYByxRiZ2A32rqo+I=";
21 | };
22 | base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-hard.yaml";
23 | cursor = {
24 | name = "Adwaita";
25 | package = pkgs.libadwaita;
26 | size = 24;
27 | };
28 | targets = {
29 | hyprlock.enable = false;
30 | neovim.enable = false;
31 | qt.enable = true;
32 | firefox.profileNames = [ me.username ];
33 | };
34 | fonts = {
35 | sizes = {
36 | popups = 13;
37 | desktop = 11;
38 | };
39 | };
40 | };
41 |
42 | qt = {
43 | enable = true;
44 | };
45 |
46 | gtk = {
47 | enable = true;
48 |
49 | iconTheme = {
50 | package = pkgs.morewaita-icon-theme;
51 | name = "MoreWaita";
52 | };
53 | };
54 | }
55 |
--------------------------------------------------------------------------------
/modules/home-manager/tmux.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | programs.tmux = {
3 | enable = true;
4 | prefix = "C-q";
5 | aggressiveResize = true;
6 | clock24 = true;
7 | customPaneNavigationAndResize = true;
8 | escapeTime = 0;
9 | historyLimit = 10000;
10 | baseIndex = 1;
11 | mouse = true;
12 | keyMode = "vi";
13 | terminal = "tmux-256color";
14 | plugins = with pkgs.tmuxPlugins; [
15 | open
16 | yank
17 | sensible
18 | logging
19 | sessionist
20 | pain-control
21 | {
22 | plugin = resurrect;
23 | extraConfig = ''
24 | set -g @resurrect-capture-pane-contents 'on'
25 | set -g @resurrect-strategy-vim 'session'
26 | set -g @resurrect-strategy-nvim 'session'
27 | '';
28 | }
29 | {
30 | plugin = continuum;
31 | extraConfig = ''
32 | set -g @continuum-restore 'on'
33 | set -g @continuum-save-interval '15'
34 | '';
35 | }
36 | ];
37 | extraConfig = ''
38 | set -g status off
39 | set -g pane-border-status top
40 | set -g pane-border-format '#[bold]#{?client_prefix,#[underscore],} \
41 | [#S]:#I/#{session_windows}:#{pane_index} #{pane_current_command} #{pane_current_path} \
42 | #{?window_zoomed_flag,Z ,}#[default]'
43 | # True color support
44 | set -ag terminal-overrides ",$TERM:RGB"
45 | # Undercurl support
46 | set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
47 | # Underscore colors
48 | set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m'
49 | '';
50 | };
51 | }
52 |
--------------------------------------------------------------------------------
/modules/home-manager/translate-shell.nix:
--------------------------------------------------------------------------------
1 | {
2 | programs.translate-shell = {
3 | enable = true;
4 | settings = {
5 | hl = "en";
6 | tl = "zh";
7 | verbose = true;
8 | };
9 | };
10 | }
11 |
--------------------------------------------------------------------------------
/modules/home-manager/vscode.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | programs.vscode = {
3 | enable = true;
4 | package = pkgs.vscode.fhsWithPackages (ps:
5 | with ps; [
6 | rustup
7 | zlib
8 | openssl.dev
9 | pkg-config
10 | jdk21
11 | nodejs
12 | ]);
13 | };
14 | }
15 |
--------------------------------------------------------------------------------
/modules/home-manager/wallpaper.nix:
--------------------------------------------------------------------------------
1 | {pkgs, config, ...}: {
2 | # custom wallpaper services
3 | systemd.user = {
4 | services = {
5 | bingwallpaper-get = {
6 | Unit = {
7 | Description = "Download bing wallpaper to target path";
8 | };
9 | Service = {
10 | Type = "oneshot";
11 | Environment = "HOME=${config.home.homeDirectory}";
12 | ExecStart = "${pkgs.bingwallpaper-get}/bin/bingwallpaper-get";
13 | ExecStartPost = "${pkgs.wallpaper-switch}/bin/wallpaper-switch";
14 | };
15 | Install = {
16 | WantedBy = ["default.target"];
17 | };
18 | };
19 | wallpaper-random = {
20 | Unit = {
21 | Description = "switch random wallpaper powered by hyprpaper";
22 | After = "bingwallpaper-get.service";
23 | };
24 | Service = {
25 | Type = "oneshot";
26 | Environment = "HOME=${config.home.homeDirectory}";
27 | ExecStart = "${pkgs.wallpaper-switch}/bin/wallpaper-switch random";
28 | };
29 | Install = {
30 | WantedBy = ["default.target"];
31 | };
32 | };
33 | };
34 | timers = {
35 | bingwallpaper-get = {
36 | Unit = {
37 | Description = "Download bing wallpaper timer";
38 | };
39 | Timer = {
40 | OnCalendar = "hourly";
41 | };
42 | Install = {WantedBy = ["timers.target"];};
43 | };
44 | wallpaper-random = {
45 | Unit = {
46 | Description = "switch random wallpaper powered by hyprpaper timer";
47 | };
48 | Timer = {
49 | OnUnitActiveSec = "60min";
50 | OnBootSec = "60min";
51 | };
52 | Install = {WantedBy = ["timers.target"];};
53 | };
54 | };
55 | };
56 | }
57 |
--------------------------------------------------------------------------------
/modules/home-manager/wezterm.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | programs.wezterm = {
10 | enable = true;
11 | extraConfig = builtins.readFile ../../xdg/config/wezterm/wezterm.lua;
12 | };
13 | }
14 |
--------------------------------------------------------------------------------
/modules/home-manager/yazi.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | programs.yazi = {
3 | enable = true;
4 | enableZshIntegration = true;
5 | settings = {
6 | manager = {
7 | show_hidden = true;
8 | show_symlink = true;
9 | linemode = "mtime";
10 | };
11 | preview = {
12 | max_width = 1500;
13 | max_height = 1500;
14 | };
15 | };
16 | theme = {
17 | manager = {
18 | border_symbol = " ";
19 | };
20 | status = {
21 | separator_open = "";
22 | separator_close = "";
23 | sep_left = {
24 | open = "";
25 | close = "";
26 | };
27 | sep_right = {
28 | open = "";
29 | close = "";
30 | };
31 | };
32 | };
33 | };
34 | }
35 |
--------------------------------------------------------------------------------
/modules/home-manager/zellij.nix:
--------------------------------------------------------------------------------
1 | {
2 | programs.zellij = {
3 | enable = true;
4 | settings = {
5 | ui.pane_frames.hide_session_name = true;
6 | pane_frames = false;
7 | serialize_pane_viewport = true;
8 | default_layout = "compact";
9 | default_mode = "locked";
10 | simplified_ui = true;
11 | keybinds = {
12 | locked = {
13 | "bind \"Ctrl q\"" = {
14 | SwitchToMode = "Normal";
15 | };
16 | };
17 | normal = {
18 | "bind \"Ctrl q\"" = {
19 | SwitchToMode = "Locked";
20 | };
21 | };
22 | "shared_except \"locked\" \"renametab\" \"renamepane\"" = {
23 | "unbind \"Ctrl q\"" = [];
24 | "bind \"Q\"" = {
25 | Quit = [];
26 | };
27 | };
28 | };
29 | };
30 | };
31 | }
32 |
--------------------------------------------------------------------------------
/modules/home-manager/zsh.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | # zsh
10 | programs.zsh = {
11 | enable = true;
12 | enableCompletion = true;
13 | autosuggestion.enable = true;
14 | history = {
15 | size = 99999;
16 | ignoreAllDups = true;
17 | };
18 | syntaxHighlighting = {
19 | enable = true;
20 | };
21 | oh-my-zsh = {
22 | enable = true;
23 | plugins = [
24 | "git"
25 | "svn"
26 | "mvn"
27 | "docker"
28 | "wd"
29 | "z"
30 | "history"
31 | "extract"
32 | "systemd"
33 | "fzf"
34 | "tmux"
35 | ];
36 | extraConfig = ''
37 | COMPLETION_WAITING_DOTS=true
38 | '';
39 | };
40 | shellAliases = {
41 | lg = "lazygit";
42 | ll = "lsd -lah";
43 | py = "python";
44 | y = "yazi";
45 | m = "neomutt";
46 | n = "ncmpcpp";
47 | t = "trans";
48 | };
49 | initContent =
50 | let
51 | proxyPort = "7890";
52 | proxyAddr = "http://127.0.0.1:${proxyPort}";
53 | in
54 | ''
55 | bindkey '^[[D' wd_browse_widget
56 | bindkey '^b' backward-char
57 | PROXY_ENV=(http_proxy ftp_proxy https_proxy all_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY ALL_PROXY)
58 | NO_PROXY_ENV=(no_proxy NO_PROXY)
59 | proxy_addr=${proxyAddr}
60 | no_proxy_addr=localhost,127.0.0.1,localaddress,.localdomain.com,10.96.0.0/12,192.168.99.0/24,192.168.39.0/24,192.168.49.2/24
61 | if [ $(hostname) = "nixos-wsl" ]; then
62 | # get wsl host ip
63 | proxy_addr=http://$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):${proxyPort}
64 | fi
65 |
66 | proxyIsSet(){
67 | for envar in $PROXY_ENV
68 | do
69 | eval temp=$(echo \$$envar)
70 | if [ $temp ]; then
71 | return 0
72 | fi
73 | done
74 | return 1
75 |
76 | }
77 |
78 | assignProxy(){
79 | for envar in $PROXY_ENV
80 | do
81 | export $envar=$1
82 | done
83 | for envar in $NO_PROXY_ENV
84 | do
85 | export $envar=$2
86 | done
87 | echo "set all proxy env done"
88 | echo "proxy addr is:"
89 | echo ''${proxy_addr}
90 | echo "no proxy addr is:"
91 | echo ''${no_proxy_addr}
92 | }
93 |
94 | clrProxy(){
95 | for envar in $PROXY_ENV
96 | do
97 | unset $envar
98 | done
99 | echo "cleaned all proxy env"
100 | }
101 |
102 | # toggleProxy
103 | tp(){
104 | if proxyIsSet
105 | then
106 | clrProxy
107 | else
108 | # user=YourUserName
109 | # read -p "Password: " -s pass && echo -e " "
110 | # proxy_addr="http://$user:$pass@ProxyServerAddress:Port"
111 | assignProxy $proxy_addr $no_proxy_addr
112 | fi
113 | }
114 |
115 | timestamp(){
116 | current=`date "+%Y-%m-%d %H:%M:%S"`
117 | if [ $1 ] ;then
118 | current=$1
119 | echo $current
120 | fi
121 |
122 | timeStamp=`date -d "$current" +%s`
123 | currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000))
124 | echo $currentTimeStamp
125 | }
126 | '';
127 | };
128 | }
129 |
--------------------------------------------------------------------------------
/modules/nixos/bluetooth.nix:
--------------------------------------------------------------------------------
1 | {
2 | # bluetooth
3 | hardware.bluetooth = {
4 | enable = true;
5 | powerOnBoot = true;
6 | settings.General.Experimental = true; # for gnome-bluetooth percentage
7 | };
8 | }
9 |
--------------------------------------------------------------------------------
/modules/nixos/default.nix:
--------------------------------------------------------------------------------
1 | # Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
2 | # These should be stuff you would like to share with others, not your personal configurations.
3 | {
4 | # List your module files here
5 | # my-module = import ./my-module.nix;
6 | interception-tools = import ./interception-tools.nix;
7 | firewall = import ./firewall.nix;
8 | virt = import ./virt.nix;
9 | docker = import ./docker.nix;
10 | podman = import ./podman.nix;
11 | systemd-boot = import ./systemd-boot.nix;
12 | wsl = import ./wsl.nix;
13 | fonts = import ./fonts.nix;
14 | xserver = import ./xserver.nix;
15 | gnome = import ./gnome.nix;
16 | hyprland = import ./hyprland.nix;
17 | sing-box = import ./sing-box.nix;
18 | bluetooth = import ./bluetooth.nix;
19 | waydroid = import ./waydroid.nix;
20 | ollama = import ./ollama.nix;
21 | mihomo = import ./mihomo.nix;
22 | sops = import ./sops.nix;
23 | mail = import ./mail.nix;
24 | steam = import ./steam.nix;
25 | theme = import ./theme.nix;
26 | headscale = import ./headscale.nix;
27 | rustdesk-server = import ./rustdesk-server.nix;
28 | }
29 |
--------------------------------------------------------------------------------
/modules/nixos/docker.nix:
--------------------------------------------------------------------------------
1 | {
2 | virtualisation.docker.enable = true;
3 | }
4 |
--------------------------------------------------------------------------------
/modules/nixos/firewall.nix:
--------------------------------------------------------------------------------
1 | {config, ...}: {
2 | networking.nftables.enable = true;
3 | networking.firewall = {
4 | enable = true;
5 | checkReversePath = "loose";
6 | trustedInterfaces = ["tun*" "Meta" "tailscale*"];
7 | allowedUDPPorts = [
8 | config.services.tailscale.port
9 | # snycthing
10 | 22000
11 | 21027
12 | # tailscale direct connection
13 | 3478
14 | 41641
15 | ];
16 |
17 | allowedTCPPorts = [
18 | 80
19 | 443
20 | 4001
21 | 8080
22 | # syncthing
23 | 8384
24 | 22000
25 | ];
26 | allowedUDPPortRanges = [
27 | {
28 | from = 4000;
29 | to = 4007;
30 | }
31 | {
32 | from = 8000;
33 | to = 9000;
34 | }
35 | ];
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/modules/nixos/fonts.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | fonts = {
10 | packages = with pkgs; [
11 | noto-fonts-emoji
12 | sarasa-gothic
13 | nerd-fonts.fira-code
14 | nerd-fonts.ubuntu
15 | nerd-fonts.ubuntu-mono
16 | nerd-fonts.caskaydia-cove
17 | source-han-serif-vf-ttf
18 | source-han-serif-vf-otf
19 | source-han-serif
20 | source-han-sans-vf-ttf
21 | source-han-sans-vf-otf
22 | source-han-sans
23 | source-han-mono
24 | source-han-code-jp
25 | font-awesome
26 | lexend
27 | material-symbols
28 | wqy_zenhei
29 | wqy_microhei
30 | nur.repos.rewine.ttf-wps-fonts
31 | # microsoft fonts
32 | corefonts
33 | vistafonts-cht
34 | vistafonts-chs
35 | vistafonts
36 | ];
37 | fontDir.enable = true;
38 | enableDefaultPackages = true;
39 | fontconfig = {
40 | enable = true;
41 | defaultFonts = {
42 | emoji = ["Noto Color Emoji"];
43 | monospace = [
44 | "CaskaydiaCove Nerd Font"
45 | "Sarasa Mono SC"
46 | ];
47 | sansSerif = [
48 | "Ubuntu Nerd Font"
49 | "Sarasa UI SC"
50 | ];
51 | serif = [
52 | "Ubuntu Nerd Font"
53 | "Sarasa fixed Slab SC"
54 | ];
55 | };
56 | # SimSun alias for some office doc
57 | localConf = ''
58 |
59 | SimSun
60 |
61 | Source Han Serif SC
62 |
63 |
64 | '';
65 | };
66 | };
67 | }
68 |
--------------------------------------------------------------------------------
/modules/nixos/gnome.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | services.xserver = {
10 | displayManager.gdm.enable = true;
11 | desktopManager.gnome = {
12 | enable = true;
13 | };
14 | };
15 | programs.dconf.enable = true;
16 | services = {
17 | sysprof.enable = true;
18 | gnome = {
19 | evolution-data-server.enable = true;
20 | glib-networking.enable = true;
21 | gnome-keyring.enable = true;
22 | gnome-online-accounts.enable = true;
23 | };
24 | };
25 | environment.gnome.excludePackages =
26 | (with pkgs; [
27 | gnome-photos
28 | gnome-tour
29 | gnome-console
30 | gnome-text-editor
31 | gedit
32 | ])
33 | ++ (with pkgs.gnome; [
34 | cheese # webcam tool
35 | gnome-music
36 | gnome-terminal
37 | epiphany # web browser
38 | geary # email reader
39 | evince # document viewer
40 | totem # video player
41 | tali # poker game
42 | iagno # go game
43 | hitori # sudoku game
44 | atomix # puzzle game
45 | gnome-contacts
46 | gnome-initial-setup
47 | gnome-shell-extensions
48 | ]);
49 | }
50 |
--------------------------------------------------------------------------------
/modules/nixos/headscale.nix:
--------------------------------------------------------------------------------
1 | {
2 | config,
3 | me,
4 | domain,
5 | ...
6 | }: {
7 | services = {
8 | headscale = {
9 | enable = true;
10 | address = "0.0.0.0";
11 | port = 8080;
12 |
13 | settings = {
14 | server_url = "https://hs.${domain}";
15 | logtail = {
16 | enabled = false;
17 | };
18 | ip_prefixes = [
19 | "100.77.0.0/24"
20 | "fd7a:115c:a1e0:77::/64"
21 | ];
22 | derp = {
23 | server = {
24 | enabled = true;
25 | region_id = 999;
26 | region_code = "headscale";
27 | region_name = "Headscale Embedded DERP";
28 | stun_listen_addr = "0.0.0.0:3478";
29 | auto_update_enabled = true;
30 | automatically_add_embedded_derp_region = true;
31 | };
32 | };
33 |
34 | metrics_listen_addr = "127.0.0.1:8090";
35 | dns = {
36 | override_local_dns = true;
37 | base_domain = "ts.${domain}";
38 | magic_dns = true;
39 | nameservers.global = [
40 | "1.1.1.1"
41 | "1.0.0.1"
42 | "2606:4700:4700::1111"
43 | "2606:4700:4700::1001"
44 | ];
45 | };
46 | };
47 | };
48 | nginx = {
49 | enable = true;
50 | recommendedTlsSettings = true;
51 | recommendedProxySettings = true;
52 | recommendedGzipSettings = true;
53 | recommendedOptimisation = true;
54 | virtualHosts = {
55 | "hs.${domain}" = {
56 | forceSSL = true;
57 | enableACME = true;
58 | locations = {
59 | "/" = {
60 | proxyPass = "http://localhost:${toString config.services.headscale.port}";
61 | proxyWebsockets = true;
62 | };
63 | "/metrics" = {
64 | proxyPass = "http://${config.services.headscale.settings.metrics_listen_addr}/metrics";
65 | };
66 | };
67 | };
68 | };
69 | };
70 | };
71 | networking.firewall.allowedUDPPorts = [3478 41641];
72 | networking.firewall.allowedTCPPorts = [80 443];
73 |
74 | security.acme = {
75 | defaults.email = me.mail.outlook;
76 | acceptTerms = true;
77 | };
78 | environment.systemPackages = [
79 | config.services.headscale.package
80 | ];
81 | }
82 |
--------------------------------------------------------------------------------
/modules/nixos/hyprland.nix:
--------------------------------------------------------------------------------
1 | {
2 | config,
3 | pkgs,
4 | me,
5 | inputs,
6 | ...
7 | }: {
8 | # can't work with custom gnome module from ./gnome.nix
9 | programs.hyprland = {
10 | enable = true;
11 | withUWSM = true;
12 | xwayland.enable = true;
13 | };
14 | xdg.portal = {
15 | enable = true;
16 | };
17 |
18 | programs.nautilus-open-any-terminal = {
19 | enable = true;
20 | terminal = "footclient";
21 | };
22 |
23 | environment.systemPackages = with pkgs; [
24 | loupe
25 | adwaita-icon-theme
26 | file-roller
27 | baobab
28 | nautilus
29 | nautilus-python
30 | gnome-calendar
31 | gnome-system-monitor
32 | gnome-weather
33 | gnome-calculator
34 | gnome-clocks
35 | gnome-software # for flatpak
36 | wl-gammactl
37 | wl-clipboard
38 | wayshot
39 | pavucontrol
40 | brightnessctl
41 | ];
42 |
43 | # security.pam.services.gtklock.text = lib.readFile "${pkgs.gtklock}/etc/pam.d/gtklock";
44 | security = {
45 | polkit.enable = true;
46 | pam.services.hyprlock = {};
47 | };
48 | services = {
49 | gvfs.enable = true;
50 | devmon.enable = true;
51 | upower.enable = true;
52 | udisks2.enable = true;
53 | accounts-daemon.enable = true;
54 | };
55 |
56 | services.greetd = {
57 | enable = true;
58 | settings = {
59 | default_session = {
60 | command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland";
61 | user = me.username;
62 | };
63 | };
64 | };
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/modules/nixos/interception-tools.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | services.interception-tools = {
10 | enable = true;
11 | plugins = [
12 | pkgs.interception-tools-plugins.dual-function-keys
13 | ];
14 | udevmonConfig = ''
15 | - JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.dual-function-keys}/bin/dual-function-keys -c /etc/interception/capslock2ctrlesc.yaml | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE"
16 | DEVICE:
17 | LINK: /dev/input/by-path/platform-i8042-serio-0-event-kbd
18 | '';
19 | };
20 | environment.etc."interception/capslock2ctrlesc.yaml".text = ''
21 | TIMING:
22 | TAP_MILLISEC: 200
23 | DOUBLE_TAP_MILLISEC: 150
24 |
25 | MAPPINGS:
26 | - KEY: KEY_CAPSLOCK
27 | TAP: KEY_ESC
28 | HOLD: KEY_LEFTCTRL
29 | '';
30 | }
31 |
--------------------------------------------------------------------------------
/modules/nixos/mail.nix:
--------------------------------------------------------------------------------
1 | {
2 | pkgs,
3 | me,
4 | ...
5 | }: {
6 | services = {
7 | offlineimap = {
8 | enable = true;
9 | install = true;
10 | onCalendar = "*:0/30";
11 | path = with pkgs; [
12 | bash
13 | notmuch
14 | gnupg
15 | sops
16 | ];
17 | };
18 | # setup lmtp and rss2email for read local rss source
19 | dovecot2 = {
20 | enable = true;
21 | enableLmtp = true;
22 | mailLocation = "maildir:~/Maildir/%u/Inbox";
23 | };
24 | rss2email = {
25 | enable = true;
26 | to = me.username;
27 | interval = "1h";
28 | config = {
29 | sendmail = "/run/wrappers/bin/sendmail";
30 | email-protocol = "lmtp";
31 | lmtp-server = "/var/run/dovecot2/lmtp";
32 | lmtp-auth = "False";
33 | };
34 | feeds = {
35 | hyprland.url = "https://hyprland.org/rss.xml";
36 | neovim.url = "https://neovim.io/news.xml";
37 | vaxry-blog.url = "https://blog.vaxry.net/feed";
38 | };
39 | };
40 | };
41 | }
42 |
--------------------------------------------------------------------------------
/modules/nixos/ollama.nix:
--------------------------------------------------------------------------------
1 | {
2 | pkgs,
3 | username,
4 | config,
5 | lib,
6 | ...
7 | }
8 | : {
9 | services = {
10 | open-webui = {
11 | enable = true;
12 | port = 10000;
13 | };
14 | ollama = {
15 | enable = true;
16 | home = "/home/ollama";
17 | user = "ollama";
18 | group = "ollama";
19 | };
20 | };
21 | # changing ollama home throws error. Follows can fix it, see https://github.com/NixOS/nixpkgs/issues/357604
22 | systemd.services.ollama.serviceConfig = let
23 | cfg = config.services.ollama;
24 | ollamaPackage = cfg.package.override {inherit (cfg) acceleration;};
25 | in
26 | lib.mkForce {
27 | Type = "exec";
28 | ExecStart = "${lib.getExe ollamaPackage} serve";
29 | WorkingDirectory = cfg.home;
30 | SupplementaryGroups = ["render"];
31 | };
32 | }
33 |
--------------------------------------------------------------------------------
/modules/nixos/podman.nix:
--------------------------------------------------------------------------------
1 | {
2 | virtualisation.podman.enable = true;
3 | }
4 |
--------------------------------------------------------------------------------
/modules/nixos/rustdesk-server.nix:
--------------------------------------------------------------------------------
1 | {
2 | services = {
3 | rustdesk-server = {
4 | enable = true;
5 | relay.enable = true;
6 | signal.enable = true;
7 | openFirewall = true;
8 | signal.relayHosts = ["wenjin.me"];
9 | };
10 | };
11 | }
12 |
--------------------------------------------------------------------------------
/modules/nixos/sing-box.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | services.sing-box = {
10 | enable = true;
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/modules/nixos/sops.nix:
--------------------------------------------------------------------------------
1 | {
2 | config,
3 | username,
4 | ...
5 | }: {
6 | sops = {
7 | defaultSopsFile = ../../secrets.yaml;
8 | age = {
9 | generateKey = true;
10 | sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
11 | keyFile = "/etc/ssh/age/keys.txt";
12 | };
13 | secrets.MIHOMO_PROVIDER = {};
14 | secrets.MIHOMO_PROVIDER2 = {};
15 | };
16 | }
17 |
--------------------------------------------------------------------------------
/modules/nixos/steam.nix:
--------------------------------------------------------------------------------
1 | {
2 | pkgs,
3 | username,
4 | ...
5 | }: let
6 | gs = pkgs.writeShellScript "gs" ''
7 | set -xeuo pipefail
8 |
9 | gamescopeArgs=(
10 | --adaptive-sync # VRR support
11 | --hdr-enabled
12 | --mangoapp # performance overlay
13 | --rt
14 | --steam
15 | )
16 | steamArgs=(
17 | -pipewire-dmabuf
18 | -tenfoot
19 | )
20 | mangoConfig=(
21 | cpu_temp
22 | gpu_temp
23 | ram
24 | vram
25 | )
26 | mangoVars=(
27 | MANGOHUD=1
28 | MANGOHUD_CONFIG="$(IFS=,; echo "''${mangoConfig[*]}")"
29 | )
30 | export "''${mangoVars[@]}"
31 | exec gamescope "''${gamescopeArgs[@]}" -- steam "''${steamArgs[@]}"
32 | '';
33 | in {
34 | programs = {
35 | gamescope = {
36 | enable = true;
37 | capSysNice = true;
38 | };
39 | steam = {
40 | enable = true;
41 | remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
42 | dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
43 | localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
44 | gamescopeSession.enable = true;
45 | extest.enable = true;
46 | extraCompatPackages = with pkgs; [proton-ge-bin];
47 | extraPackages = with pkgs; [gamescope];
48 | };
49 | };
50 | hardware.xone.enable = true; # support for the xbox controller USB dongle
51 | hardware.xpadneo.enable = true;
52 |
53 | services = {
54 | # enable scx for game, needs kernel version >= 6.12, see https://github.com/sched-ext/scx/blob/main/scheds/rust/scx_lavd/README.md
55 | scx = {
56 | enable = true;
57 | scheduler = "scx_lavd";
58 | };
59 | };
60 | environment = {
61 | systemPackages = with pkgs; [
62 | mangohud
63 | gamemode
64 | ];
65 | loginShellInit = ''
66 | [[ "$(tty)" = "/dev/tty2" ]] && ${gs}
67 | '';
68 | };
69 | }
70 |
--------------------------------------------------------------------------------
/modules/nixos/systemd-boot.nix:
--------------------------------------------------------------------------------
1 | {
2 | boot = {
3 | loader = {
4 | systemd-boot = {
5 | enable = true;
6 | configurationLimit = 3;
7 | consoleMode = "keep";
8 | };
9 | };
10 | };
11 | }
12 |
--------------------------------------------------------------------------------
/modules/nixos/theme.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | stylix = {
3 | enable = true;
4 | polarity = "dark";
5 | cursor = {
6 | package = pkgs.libadwaita;
7 | name = "Adwaita";
8 | size = 24;
9 | };
10 | base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml";
11 | image = pkgs.fetchurl {
12 | url = "https://www.bing.com/th?id=OHR.NapoliPizza_ROW8840504063_UHD.jpg";
13 | sha256 = "sha256-1Andv0jmsakNgKv4n/q+McmL+eBYByxRiZ2A32rqo+I=";
14 | };
15 | targets = {
16 | qt.enable = true;
17 | };
18 | };
19 | }
20 |
--------------------------------------------------------------------------------
/modules/nixos/virt.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | # temporary disabled for compile error at this time
10 | environment.systemPackages = with pkgs; [
11 | quickemu
12 | ];
13 | # virtualisation
14 | programs.virt-manager.enable = true;
15 | virtualisation.libvirtd.enable = true;
16 | }
17 |
--------------------------------------------------------------------------------
/modules/nixos/waydroid.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | virtualisation.waydroid.enable = true;
3 | }
4 |
--------------------------------------------------------------------------------
/modules/nixos/xserver.nix:
--------------------------------------------------------------------------------
1 | {pkgs, ...}: {
2 | services.xserver = {
3 | displayManager.startx.enable = true;
4 | enable = true;
5 | # dpi = 192;
6 | # xkb.layout = "us";
7 | excludePackages = [pkgs.xterm];
8 | # libinput.enable = true;
9 | };
10 | }
11 |
--------------------------------------------------------------------------------
/nixos/configuration.nix:
--------------------------------------------------------------------------------
1 | # This is your system's configuration file.
2 | # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
3 | {
4 | inputs,
5 | outputs,
6 | lib,
7 | config,
8 | pkgs,
9 | me,
10 | ...
11 | }: {
12 | # You can import other NixOS modules here
13 | imports = with outputs.nixosModules; [
14 | # If you want to use modules your own flake exports (from modules/nixos):
15 | # outputs.nixosModules.interception-tools
16 | podman
17 | ollama
18 | mihomo
19 | mail
20 |
21 | # Or modules from other flakes (such as nixos-hardware):
22 | # inputs.hardware.nixosModules.common-cpu-amd
23 | # inputs.hardware.nixosModules.common-ssd
24 |
25 | # You can also split up your configuration and import pieces of it here:
26 | ./users.nix
27 |
28 | # Import your generated (nixos-generate-config) hardware configuration
29 | #./hardware-configuration.nix
30 | ];
31 |
32 | nixpkgs = {
33 | # You can add overlays here
34 | overlays = [
35 | # Add overlays your own flake exports (from overlays and pkgs dir):
36 | outputs.overlays.additions
37 | outputs.overlays.modifications
38 | # outputs.overlays.unstable-packages
39 |
40 | # You can also add overlays exported from other flakes:
41 | # neovim-nightly-overlay.overlays.default
42 |
43 | # Or define it inline, for example:
44 | # (final: prev: {
45 | # hi = final.hello.overrideAttrs (oldAttrs: {
46 | # patches = [ ./change-hello-to-hi.patch ];
47 | # });
48 | # })
49 | ];
50 | # Configure your nixpkgs instance
51 | config = {
52 | # Disable if you don't want unfree packages
53 | allowUnfree = true;
54 | };
55 | };
56 |
57 | nix = let
58 | flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
59 | in {
60 | settings = {
61 | # Enable flakes and new 'nix' command
62 | experimental-features = "nix-command flakes";
63 | # Opinionated: disable global registry
64 | # flake-registry = "";
65 | # Workaround for https://github.com/NixOS/nix/issues/9574
66 | nix-path = config.nix.nixPath;
67 | # Deduplicate and optimize nix store
68 | auto-optimise-store = true;
69 | trusted-users = ["${me.username}"];
70 | # the system-level substituers & trusted-public-keys
71 | # given the users in this list the right to specify additional substituters via:
72 | # 1. `nixConfig.substituers` in `flake.nix`
73 | substituters = [
74 | # cache mirror located in China
75 | # status: https://mirror.sjtu.edu.cn/
76 | # "https://mirror.sjtu.edu.cn/nix-channels/store"
77 | # status: https://mirrors.ustc.edu.cn/status/
78 | "https://mirrors.ustc.edu.cn/nix-channels/store"
79 | "https://cache.nixos.org"
80 | ];
81 | trusted-public-keys = [
82 | # the default public key of cache.nixos.org, it's built-in, no need to add it here
83 | # "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
84 | ];
85 | };
86 | # Opinionated: make flake registry and nix path match flake inputs
87 | registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs;
88 | nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
89 | # Opinionated: disable channels
90 | channel.enable = false;
91 | };
92 |
93 | time.timeZone = "Asia/Shanghai";
94 |
95 | # Configure network proxy if necessary
96 | # networking.proxy.default = "http://user:password@proxy:port/";
97 | # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
98 |
99 | # Select internationalisation properties.
100 | i18n.defaultLocale = "en_US.UTF-8";
101 | console.packages = with pkgs; [
102 | terminus_font
103 | ];
104 | console = {
105 | earlySetup = true;
106 | font = "ter-132b";
107 | # keyMap = "us";
108 | # useXkbConfig = true; # use xkb.options in tty.
109 | };
110 | # Enable the X11 windowing system.
111 | # services.xserver.enable = true;
112 | # services.xserver = {
113 | # layout = "us";
114 | # xkbVariant = "";
115 | # }
116 |
117 | # Configure keymap in X11
118 | # services.xserver.xkb.layout = "us";
119 | # services.xserver.xkb.options = "eurosign:e,caps:escape";
120 |
121 | # Enable CUPS to print documents.
122 | # services.printing.enable = true;
123 |
124 | # Enable sound.
125 | # sound.enable = true;
126 | services.pulseaudio.enable = false;
127 | security.rtkit.enable = true;
128 | services.pipewire = {
129 | enable = true;
130 | alsa.enable = true;
131 | alsa.support32Bit = true;
132 | pulse.enable = true;
133 | jack.enable = true;
134 | wireplumber.enable = true;
135 | };
136 |
137 | # Enable touchpad support (enabled default in most desktopManager).
138 | # services.xserver.libinput.enable = true;
139 |
140 | # List packages installed in system profile. To search, run:
141 | # $ nix search wget
142 | environment = {
143 | wordlist.enable = true;
144 | systemPackages = with pkgs; [
145 | neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
146 | wget
147 | git
148 | parted
149 | fbida
150 | pciutils
151 | mesa-demos
152 | vulkan-tools
153 | home-manager
154 | # to run nixos-anywhere store and kexec locally:
155 | # nix build .#nixosConfigurations.my-server.config.system.build.toplevel -o result-nixos
156 | # nix build .#nixosConfigurations.my-server.config.system.build.diskoScript -o result-disko
157 | # nixos-anywhere --store-paths result-disko result-nixos --kexec ./nixos-kexec-installer-noninteractive-x86_64-linux.tar.gz --no-substitute-on-destination myserver.example.com
158 | nixos-anywhere
159 | tree
160 | ];
161 | };
162 |
163 | # Some programs need SUID wrappers, can be configured further or are
164 | # started in user sessions.
165 | # programs.mtr.enable = true;
166 | programs = {
167 | gnupg.agent = {
168 | enable = true;
169 | enableSSHSupport = true;
170 | };
171 | zsh.enable = true;
172 | nix-ld.enable = true;
173 | };
174 |
175 | systemd.sleep.extraConfig = ''
176 | [Sleep]
177 | HibernateMode=shutdown
178 | '';
179 |
180 | # This setups a SSH server. Very important if you're setting up a headless system.
181 | # Feel free to remove if you don't need it.
182 | services.openssh = {
183 | enable = true;
184 | settings = {
185 | # Opinionated: forbid root login through SSH.
186 | PermitRootLogin = "no";
187 | # Opinionated: use keys only.
188 | # Remove if you want to SSH using passwords
189 | PasswordAuthentication = false;
190 | };
191 | };
192 |
193 | services.tailscale = {
194 | enable = true;
195 | openFirewall = true;
196 | };
197 |
198 | security.pam.loginLimits = [
199 | {
200 | domain = "*";
201 | item = "nofile";
202 | type = "-";
203 | value = "32768";
204 | }
205 | ];
206 |
207 | # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
208 | system.stateVersion = "23.11";
209 | }
210 |
--------------------------------------------------------------------------------
/nixos/hosts/aliyun/configuration.nix:
--------------------------------------------------------------------------------
1 | {
2 | modulesPath,
3 | config,
4 | lib,
5 | outputs,
6 | pkgs,
7 | me,
8 | ...
9 | }: {
10 | imports = with outputs.nixosModules; [
11 | (modulesPath + "/installer/scan/not-detected.nix")
12 | (modulesPath + "/profiles/qemu-guest.nix")
13 | ./disk-config.nix
14 | (headscale {
15 | inherit config me;
16 | domain = "wenjin.me";
17 | })
18 | rustdesk-server
19 | ];
20 | boot.loader.grub = {
21 | # no need to set devices, disko will add all devices that have a EF02 partition to the list already
22 | # devices = [ ];
23 | efiSupport = true;
24 | efiInstallAsRemovable = true;
25 | };
26 | services = {
27 | openssh.enable = true;
28 | };
29 |
30 | environment.systemPackages = map lib.lowPrio [
31 | pkgs.curl
32 | pkgs.gitMinimal
33 | ];
34 |
35 | users.users.root.openssh.authorizedKeys.keys = [
36 | # change this to your ssh key
37 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOpMRzF5l2trX2SwRxYn4KcSahIKVbU+T+Li+IE5qMIw wenjin@nixos-wsl"
38 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEtBUbTuGD34mJCUZp7hIFuDR9kACg4y8iWhjAPB5R66 wenjin@nixos"
39 | ];
40 |
41 | system.stateVersion = "24.11";
42 | }
43 |
--------------------------------------------------------------------------------
/nixos/hosts/aliyun/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | imports = [
3 | ./configuration.nix
4 | ];
5 | }
6 |
--------------------------------------------------------------------------------
/nixos/hosts/aliyun/disk-config.nix:
--------------------------------------------------------------------------------
1 | # Example to create a bios compatible gpt partition
2 | { lib, ... }:
3 | {
4 | disko.devices = {
5 | disk.disk1 = {
6 | device = lib.mkDefault "/dev/vda";
7 | type = "disk";
8 | content = {
9 | type = "gpt";
10 | partitions = {
11 | boot = {
12 | name = "boot";
13 | size = "1M";
14 | type = "EF02";
15 | };
16 | esp = {
17 | name = "ESP";
18 | size = "500M";
19 | type = "EF00";
20 | content = {
21 | type = "filesystem";
22 | format = "vfat";
23 | mountpoint = "/boot";
24 | };
25 | };
26 | root = {
27 | name = "root";
28 | size = "100%";
29 | content = {
30 | type = "lvm_pv";
31 | vg = "pool";
32 | };
33 | };
34 | };
35 | };
36 | };
37 | lvm_vg = {
38 | pool = {
39 | type = "lvm_vg";
40 | lvs = {
41 | root = {
42 | size = "100%FREE";
43 | content = {
44 | type = "filesystem";
45 | format = "ext4";
46 | mountpoint = "/";
47 | mountOptions = [
48 | "defaults"
49 | ];
50 | };
51 | };
52 | };
53 | };
54 | };
55 | };
56 | }
57 |
--------------------------------------------------------------------------------
/nixos/hosts/aliyun/hardware-configuration.nix:
--------------------------------------------------------------------------------
1 | # Do not modify this file! It was generated by ‘nixos-generate-config’
2 | # and may be overwritten by future invocations. Please make changes
3 | # to /etc/nixos/configuration.nix instead.
4 | { config, lib, pkgs, modulesPath, ... }:
5 |
6 | {
7 | imports =
8 | [ (modulesPath + "/profiles/qemu-guest.nix")
9 | ];
10 |
11 | boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_blk" ];
12 | boot.initrd.kernelModules = [ ];
13 | boot.kernelModules = [ ];
14 | boot.extraModulePackages = [ ];
15 |
16 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
17 | # (the default) this is the recommended approach. When using systemd-networkd it's
18 | # still possible to use this option, but it's recommended to use it in conjunction
19 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`.
20 | networking.useDHCP = lib.mkDefault true;
21 | # networking.interfaces.ens5.useDHCP = lib.mkDefault true;
22 |
23 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
24 | }
25 |
--------------------------------------------------------------------------------
/nixos/hosts/aws/configuration.nix:
--------------------------------------------------------------------------------
1 | {
2 | modulesPath,
3 | outputs,
4 | config,
5 | lib,
6 | pkgs,
7 | me,
8 | ...
9 | }: {
10 | imports = with outputs.nixosModules; [
11 | (modulesPath + "/virtualisation/amazon-image.nix")
12 | (headscale {
13 | inherit config me;
14 | domain = "hewenjin.org";
15 | })
16 | ];
17 |
18 | services.openssh.enable = true;
19 |
20 | users.users.root.openssh.authorizedKeys.keys = [
21 | # change this to your ssh key
22 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOpMRzF5l2trX2SwRxYn4KcSahIKVbU+T+Li+IE5qMIw wenjin@nixos-wsl"
23 | "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEtBUbTuGD34mJCUZp7hIFuDR9kACg4y8iWhjAPB5R66 wenjin@nixos"
24 | ];
25 |
26 | system.stateVersion = "24.11";
27 | }
28 |
--------------------------------------------------------------------------------
/nixos/hosts/aws/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | imports = [
10 | ./configuration.nix
11 | ];
12 | }
13 |
--------------------------------------------------------------------------------
/nixos/hosts/nix-on-droid/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | config,
3 | lib,
4 | pkgs,
5 | ...
6 | }: {
7 | # Simply install just the packages
8 | environment.packages = with pkgs; [
9 | # User-facing stuff that you really really want to have
10 | neovim # or some other editor, e.g. nano or neovim
11 | git
12 |
13 | # Some common stuff that people expect to have
14 | #procps
15 | #killall
16 | #diffutils
17 | #findutils
18 | #utillinux
19 | #tzdata
20 | #hostname
21 | #man
22 | #gnugrep
23 | #gnupg
24 | #gnused
25 | #gnutar
26 | #bzip2
27 | #gzip
28 | #xz
29 | #zip
30 | #unzip
31 | ];
32 |
33 | # Backup etc files instead of failing to activate generation if a file already exists in /etc
34 | environment.etcBackupExtension = ".bak";
35 |
36 | # Read the changelog before changing this value
37 | system.stateVersion = "23.11";
38 |
39 | # Set up nix for flakes
40 | nix.extraOptions = ''
41 | experimental-features = nix-command flakes
42 | '';
43 |
44 | # Set your time zone
45 | #time.timeZone = "Europe/Berlin";
46 |
47 | # Configure home-manager
48 | home-manager = {
49 | config = ../../../home-manager/hosts/nix-on-droid.nix;
50 | backupFileExtension = "hm-bak";
51 | useGlobalPkgs = true;
52 | };
53 | }
54 |
--------------------------------------------------------------------------------
/nixos/hosts/nixos-wsl/default.nix:
--------------------------------------------------------------------------------
1 | # This is your system's configuration file.
2 | # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
3 | {
4 | inputs,
5 | me,
6 | outputs,
7 | lib,
8 | config,
9 | pkgs,
10 | ...
11 | }: {
12 | # You can import other NixOS modules here
13 | imports = [
14 | # If you want to use modules your own flake exports (from modules/nixos):
15 | inputs.nixos-wsl.nixosModules.default
16 | ../../configuration.nix
17 |
18 | # Or modules from other flakes (such as nixos-hardware):
19 | # inputs.hardware.nixosModules.common-cpu-amd
20 | # inputs.hardware.nixosModules.common-ssd
21 |
22 | # You can also split up your configuration and import pieces of it here:
23 | # ./users.nix
24 | ];
25 |
26 | services.openssh = {
27 | ports = [
28 | 2222
29 | ];
30 | };
31 |
32 | services.ollama.acceleration = "cuda";
33 |
34 | networking = {
35 | firewall.enable = false;
36 | hostName = "nixos-wsl";
37 | };
38 |
39 | wsl = {
40 | enable = true;
41 | defaultUser = "${me.username}";
42 | startMenuLaunchers = true;
43 | useWindowsDriver = true;
44 | };
45 | }
46 |
--------------------------------------------------------------------------------
/nixos/hosts/nixos/configuration.nix:
--------------------------------------------------------------------------------
1 | # This is your system's configuration file.
2 | # Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
3 | {
4 | inputs,
5 | outputs,
6 | lib,
7 | config,
8 | pkgs,
9 | ...
10 | }: {
11 | # You can import other NixOS modules here
12 | imports = with outputs.nixosModules; [
13 | # If you want to use modules your own flake exports (from modules/nixos):
14 | interception-tools
15 | firewall
16 | virt
17 | systemd-boot
18 | waydroid
19 | fonts
20 | hyprland
21 | bluetooth
22 | steam
23 | theme
24 |
25 | # Or modules from other flakes (such as nixos-hardware):
26 | # inputs.hardware.nixosModules.common-cpu-amd
27 | # inputs.hardware.nixosModules.common-ssd
28 |
29 | # You can also split up your configuration and import pieces of it here:
30 | # ./users.nix
31 |
32 | # Import your generated (nixos-generate-config) hardware configuration
33 | #./hardware-configuration.nix
34 | ];
35 |
36 | # Pick only one of the below networking options.
37 | # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
38 | networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
39 |
40 | programs.kdeconnect = {
41 | package = pkgs.kdePackages.kdeconnect-kde;
42 | enable = true;
43 | };
44 |
45 | nixpkgs.config.rocmSupport = true;
46 |
47 | boot.kernelPackages = pkgs.linuxPackages_latest;
48 |
49 | services.ollama = {
50 | environmentVariables = {
51 | HCC_AMDGPU_TARGET = "gfx1101"; # used to be necessary, but doesn't seem to anymore
52 | OLLAMA_KEEP_ALIVE = "30m";
53 | };
54 | rocmOverrideGfx = "11.0.1";
55 | };
56 |
57 | environment.systemPackages = with pkgs; [
58 | lact
59 | nvtopPackages.amd
60 | nvtopPackages.intel
61 | ];
62 | systemd.packages = with pkgs; [lact];
63 | systemd.services.lactd.wantedBy = ["multi-user.target"];
64 | services = {
65 | printing.enable = true;
66 | flatpak.enable = true;
67 | tlp = {
68 | enable = true;
69 | settings = {
70 | INTEL_GPU_MIN_FREQ_ON_AC = 500;
71 | INTEL_GPU_MIN_FREQ_ON_BAT = 500;
72 | START_CHARGE_THRESH_BAT0 = 75;
73 | STOP_CHARGE_THRESH_BAT0 = 80;
74 | PLATFORM_PROFILE_ON_AC = "performance";
75 | PLATFORM_PROFILE_ON_BAT = "balanced";
76 |
77 | CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
78 | CPU_ENERGY_PERF_POLICY_ON_BAT = "balance_performance";
79 |
80 | CPU_BOOST_ON_AC = 1;
81 | CPU_BOOST_ON_BAT = 0;
82 | };
83 | };
84 | };
85 |
86 | xdg.terminal-exec = {
87 | enable = true;
88 | settings = {
89 | default = [
90 | "org.codeberg.dnkl.footclient.desktop"
91 | ];
92 | };
93 | };
94 |
95 | boot.binfmt.emulatedSystems = [
96 | "aarch64-linux"
97 | ];
98 |
99 | networking.hostName = "nixos";
100 | }
101 |
--------------------------------------------------------------------------------
/nixos/hosts/nixos/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | ...
8 | }: {
9 | imports = [
10 | ./hardware-configuration.nix
11 | ./configuration.nix
12 | ../../configuration.nix
13 | ];
14 | }
15 |
--------------------------------------------------------------------------------
/nixos/hosts/nixos/hardware-configuration.nix:
--------------------------------------------------------------------------------
1 | # Do not modify this file! It was generated by ‘nixos-generate-config’
2 | # and may be overwritten by future invocations. Please make changes
3 | # to /etc/nixos/configuration.nix instead.
4 | {
5 | config,
6 | lib,
7 | pkgs,
8 | modulesPath,
9 | ...
10 | }: {
11 | imports = [
12 | (modulesPath + "/installer/scan/not-detected.nix")
13 | ];
14 |
15 | boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "nvme" "uas" "sd_mod"];
16 | boot.initrd.kernelModules = [];
17 | boot.kernelModules = ["kvm-intel"];
18 | boot.extraModulePackages = [];
19 | boot.resumeDevice = "/dev/disk/by-uuid/63c28fde-17cc-44bb-aa1b-6658c4107d3f";
20 | # btrfs resume_offset calc
21 | # btrfs inspect-internal map-swapfile -r swap_file
22 | boot.kernelParams = ["resume_offset=13194284"];
23 |
24 | fileSystems."/" = {
25 | device = "/dev/disk/by-uuid/63c28fde-17cc-44bb-aa1b-6658c4107d3f";
26 | fsType = "btrfs";
27 | # zstd has better performance then btrfs default. related benchmark: https://www.phoronix.com/review/btrfs-zstd-compress
28 | # see also compress exists dir https://discourse.nixos.org/t/how-to-deal-with-actions-on-fs-when-nix-store-is-readonly/22829
29 | options = ["compress=zstd"];
30 | };
31 |
32 | fileSystems."/home" = {
33 | device = "/dev/disk/by-uuid/6fffbeb9-2862-4a72-8726-ae3db395bbfb";
34 | fsType = "btrfs";
35 | options = ["compress=zstd"];
36 | };
37 |
38 | fileSystems."/boot" = {
39 | device = "/dev/disk/by-uuid/1CEE-62D7";
40 | fsType = "vfat";
41 | options = ["fmask=0022" "dmask=0022"];
42 | };
43 |
44 | fileSystems."/swap" = {
45 | device = "/dev/disk/by-uuid/63c28fde-17cc-44bb-aa1b-6658c4107d3f";
46 | fsType = "btrfs";
47 | options = ["subvol=swap" "noatime"];
48 | };
49 |
50 | fileSystems."/windows" = {
51 | options = ["nofail" "uid=wenjin" "gid=users" "dmask=007" "fmask=117"];
52 | device = "/dev/disk/by-label/Windows";
53 | fsType = "ntfs";
54 | };
55 | fileSystems."/game" = {
56 | options = ["compress=zstd" "nofail" "noauto"];
57 | device = "/dev/disk/by-uuid/6f35c79a-6aac-485c-ab6c-48df5d2be0e3";
58 | fsType = "btrfs";
59 | };
60 |
61 | swapDevices = [{device = "/swap/swapfile";priority = 0;}];
62 |
63 | # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
64 | # (the default) this is the recommended approach. When using systemd-networkd it's
65 | # still possible to use this option, but it's recommended to use it in conjunction
66 | # with explicit per-interface declarations with `networking.interfaces..useDHCP`.
67 | networking.useDHCP = lib.mkDefault true;
68 | # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
69 |
70 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
71 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
72 | }
73 |
--------------------------------------------------------------------------------
/nixos/users.nix:
--------------------------------------------------------------------------------
1 | {
2 | inputs,
3 | outputs,
4 | lib,
5 | config,
6 | pkgs,
7 | me,
8 | ...
9 | }: {
10 | # TODO: Configure your system-wide user settings (groups, etc), add more users as needed.
11 | users.defaultUserShell = pkgs.zsh;
12 | users.users = {
13 | ${me.username} = {
14 | # You can set an initial password for your user.
15 | # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install.
16 | # Be sure to change it (using passwd) after rebooting!
17 | isNormalUser = true;
18 | openssh.authorizedKeys.keys = [
19 | # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect
20 | ];
21 | home = "/home/${me.username}";
22 | # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc)
23 | extraGroups = [
24 | "wheel"
25 | "networkmanager"
26 | "docker"
27 | "audio"
28 | "video"
29 | "libvirtd"
30 | ];
31 | };
32 | ollama = {
33 | home = "/home/ollama";
34 | isSystemUser = true;
35 | createHome = true;
36 | };
37 | };
38 | }
39 |
--------------------------------------------------------------------------------
/overlays/default.nix:
--------------------------------------------------------------------------------
1 | # This file defines overlays
2 | { inputs, ... }:
3 | let
4 | electron-flags = [
5 | "--password-store=gnome-libsecret"
6 | "--enable-features=UseOzonePlatform"
7 | "--ozone-platform=wayland"
8 | "--enable-wayland-ime"
9 | ];
10 | in
11 | rec {
12 | # This one brings our custom packages from the 'pkgs' directory
13 | additions = final: _prev: import ../pkgs { pkgs = final; };
14 |
15 | # This one contains whatever you want to overlay
16 | # You can change versions, add patches, set compilation flags, anything really.
17 | # https://nixos.wiki/wiki/Overlays
18 | modifications = final: prev: {
19 | # example = prev.example.overrideAttrs (oldAttrs: rec {
20 | # ...
21 | # });
22 | microsoft-edge = prev.microsoft-edge.override {
23 | commandLineArgs = electron-flags;
24 | };
25 | vscode = prev.vscode.override {
26 | commandLineArgs = electron-flags;
27 | };
28 | nautilus = prev.nautilus.overrideAttrs (nsuper: {
29 | buildInputs =
30 | nsuper.buildInputs
31 | ++ (with prev.gst_all_1; [
32 | gst-plugins-good
33 | gst-plugins-bad
34 | ]);
35 | });
36 | # rss2email from main branch that support lmtp feature
37 | rss2email = prev.rss2email.overrideAttrs (old: {
38 | src = prev.pkgs.fetchFromGitHub {
39 | owner = "rss2email";
40 | repo = "rss2email";
41 | rev = "0efe6c299b4e9f2545455d6bc6b6c2753cff1440";
42 | hash = "sha256-QuNRXtKDEx20On4dyCgJ6yGSI0WSxdwr/IuzD35JzVQ=";
43 | };
44 | patches = null;
45 | installCheckPhase = null;
46 | });
47 | # fix scan not work
48 | rofi-bluetooth = prev.rofi-bluetooth.overrideAttrs (old: {
49 | src = prev.fetchFromGitHub {
50 | owner = "alyraffauf";
51 | repo = "rofi-bluetooth";
52 | rev = "50252e4a9aebe4899a6ef2f7bc11d91b7e4aa8ae";
53 | hash = "sha256-o0Sr3/888L/2KzZZP/EcXx+8ZUzdHB/I/VIeVuJvJks=";
54 | };
55 | });
56 | # use rofi wayland
57 | rofi-pulse-select = prev.rofi-pulse-select.override {
58 | rofi-unwrapped = prev.pkgs.rofi-wayland-unwrapped;
59 | };
60 | # use rofi wayland
61 | rofi-systemd = prev.rofi-systemd.override {
62 | rofi = prev.pkgs.rofi-wayland;
63 | };
64 | pass = prev.pass.override {
65 | waylandSupport = true;
66 | };
67 | rofi-pass-wayland = prev.rofi-pass-wayland.overrideAttrs (old: {
68 | src = prev.fetchFromGitHub {
69 | owner = "wenjinnn";
70 | repo = "rofi-pass";
71 | rev = "3cf83dc03e0b3018ba1636cbbcbd6a194f4873e5";
72 | hash = "sha256-Vt5aGhb79G7gLcVOJKaEodC4gnXiSzxc97imttdUcMU=";
73 | };
74 | });
75 | # IM support patch
76 | swappy = prev.swappy.overrideAttrs (old: {
77 | src = prev.fetchFromGitHub {
78 | owner = "jtheoof";
79 | repo = "swappy";
80 | rev = "fca4f6dcdb05c78ad63a0924412a4ef3345484a0";
81 | hash = "sha256-gwlUklfr/NA7JIkB9YloS9f8+3h5y3rSs3ISeVXAPZk=";
82 | };
83 | });
84 | };
85 |
86 | # When applied, the unstable nixpkgs set (declared in the flake inputs) will
87 | # be accessible through 'pkgs.unstable'
88 | # unstable-packages = final: _prev: {
89 | # unstable = import inputs.nixpkgs-unstable {
90 | # system = final.system;
91 | # config.allowUnfree = true;
92 | # overlays = [modifications];
93 | # };
94 | # };
95 | }
96 |
--------------------------------------------------------------------------------
/pkgs/bingwallpaper-get/bingwallpaper-get.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | bing_url='https://www.bing.com'
4 | bing_img_url="${bing_url}/HPImageArchive.aspx"
5 | bing_img_params='format=js&idx=0&n=8&mbl=1&mkt=zh-HK'
6 | bing_img_headers='Accept: application/json'
7 | resolution='UHD'
8 | file_type='.jpg'
9 | bing_wallpaper_dir="$HOME/Pictures/BingWallpaper/"
10 |
11 | datestr=$(date '+%Y%m%d')
12 | target_file="${bing_wallpaper_dir}${datestr}*${resolution}${file_type}"
13 | if [[ -f "${target_file}" ]]; then
14 | echo "Today wallpaper ${target_file} exist, abort"
15 | exit 0
16 | fi
17 |
18 | echo "starting query ${datestr} wallpaper"
19 | response=$(wget -qO- "${bing_img_url}?${bing_img_params}" --header="${bing_img_headers}")
20 |
21 | if [[ $? -eq 0 ]]; then
22 | images=$(echo "${response}" | jq -r '.images')
23 | if [[ -f "${images}" ]]; then
24 | echo "get image failed"
25 | exit 1
26 | fi
27 | latest=$(echo "${images}" | jq -r '.[0]')
28 | startdate=$(echo "${latest}" | jq -r '.startdate')
29 | urlbase=$(echo "${latest}" | jq -r '.urlbase')
30 | img_url="${bing_url}${urlbase}_${resolution}${file_type}"
31 | file_prefix=$(echo "${img_url}" | sed 's/^.*[\\\/]//;s/th?id=OHR.//')
32 | file_name="${bing_wallpaper_dir}${startdate}-${file_prefix}"
33 |
34 | if [[ -f ${file_name} ]]; then
35 | echo "${file_name} wallpaper exist, abort"
36 | exit 0
37 | fi
38 |
39 | echo "Bing wallpaper prepare download from ${img_url} to ${file_name}"
40 | mkdir -p "${bing_wallpaper_dir}"
41 | wget -O "${file_name}" "${img_url}" -q --read-timeout=10
42 | echo 'Download success'
43 | exit 0
44 | else
45 | echo "Request failed with status code: ${?}"
46 | fi
47 |
--------------------------------------------------------------------------------
/pkgs/bingwallpaper-get/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | runCommandNoCC,
3 | lib,
4 | makeWrapper,
5 | jq,
6 | wget,
7 | coreutils-full,
8 | gnused,
9 | }:
10 | runCommandNoCC "bingwallpaper-get" {
11 | nativeBuildInputs = [makeWrapper];
12 | } ''
13 | mkdir -p $out/bin
14 | dest="$out/bin/bingwallpaper-get"
15 | cp ${./bingwallpaper-get.sh} $dest
16 | chmod +x $dest
17 | patchShebangs $dest
18 |
19 | wrapProgram $dest \
20 | --prefix PATH : ${lib.makeBinPath [jq wget gnused coreutils-full]}
21 | ''
22 |
--------------------------------------------------------------------------------
/pkgs/default.nix:
--------------------------------------------------------------------------------
1 | # Custom packages, that can be defined similarly to ones from nixpkgs
2 | # You can build them using 'nix build .#example'
3 | {pkgs, ...}: {
4 | # example = pkgs.callPackage ./example { };
5 | bingwallpaper-get = pkgs.callPackage ./bingwallpaper-get {};
6 | wallpaper-switch = pkgs.callPackage ./wallpaper-switch {};
7 | fhs = pkgs.callPackage ./fhs {};
8 | rofi-screenshot-wayland = pkgs.callPackage ./rofi-screenshot-wayland {};
9 | gh-models = pkgs.callPackage ./gh-models {};
10 | lemminx-maven = pkgs.callPackage ./lemminx-maven {};
11 | }
12 |
--------------------------------------------------------------------------------
/pkgs/fhs/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | config,
3 | pkgs,
4 | lib,
5 | ...
6 | }:
7 | # create a fhs environment by command `fhs`, so we can run non-nixos packages in nixos!
8 | let
9 | base = pkgs.appimageTools.defaultFhsEnvArgs;
10 | in
11 | pkgs.buildFHSEnv (base
12 | // {
13 | name = "fhs";
14 | targetPkgs = pkgs: (
15 | # pkgs.appimageTools offered common used pkgs
16 | (base.targetPkgs pkgs)
17 | ++ (with pkgs; [
18 | pkg-config
19 | ncurses
20 | # add whether pkgs here
21 | ])
22 | );
23 | profile = "export FHS=1";
24 | runScript = "zsh";
25 | extraOutputsToInstall = ["dev"];
26 | })
27 |
--------------------------------------------------------------------------------
/pkgs/gh-models/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | stdenv,
3 | lib,
4 | fetchurl,
5 | }:
6 | let
7 | inherit (stdenv.hostPlatform) system;
8 | throwSystem = throw "Unsupported system: ${system}";
9 |
10 | systemToPlatform = {
11 | "x86_64-linux" = {
12 | name = "linux-amd64";
13 | hash = "sha256-Y6DfvMZKgMR1MWfs4i9r+wirQRKPGnlYwzWWuUxLHv8=";
14 | };
15 | "aarch64-linux" = {
16 | name = "linux-arm64";
17 | hash = "sha256-BkRnAIPjQbgklV960Rku4exk3p3V/rv0AaofdhXfepc=";
18 | };
19 | "x86_64-darwin" = {
20 | name = "darwin-amd64";
21 | hash = "sha256-I4EG6T//+YFLOlQMpW1ERpBzR/882lXMPqpO7em/QJY=";
22 | };
23 | "aarch64-darwin" = {
24 | name = "darwin-arm64";
25 | hash = "sha256-QtHCvTgfrQilIbd3S3/zkyBLccukGfFckCrZPCIMNMg=";
26 | };
27 | };
28 | platform = systemToPlatform.${system} or throwSystem;
29 | in
30 | stdenv.mkDerivation (finalAttrs: {
31 | pname = "gh-models";
32 | version = "0.0.6";
33 |
34 | src = fetchurl {
35 | name = "gh-models";
36 | url = "https://github.com/github/gh-models/releases/download/v${finalAttrs.version}/${platform.name}";
37 | hash = platform.hash;
38 | };
39 |
40 | dontUnpack = true;
41 |
42 | installPhase = ''
43 | runHook preInstall
44 |
45 | install -m755 -D $src $out/bin/gh-models
46 |
47 | runHook postInstall
48 | '';
49 |
50 | meta = {
51 | changelog = "https://github.com/github/gh-models/releases/tag/v${finalAttrs.version}";
52 | description = "CLI extension for the GitHub Models service";
53 | homepage = "https://github.com/github/gh-models";
54 | license = lib.licenses.mit;
55 | mainProgram = "gh-models";
56 | maintainers = with lib.maintainers; [ wenjinnn ];
57 | platforms = lib.attrNames systemToPlatform;
58 | };
59 | })
60 |
--------------------------------------------------------------------------------
/pkgs/lemminx-maven/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | stdenv,
3 | lib,
4 | fetchurl,
5 | jre_headless,
6 | unzip,
7 | makeWrapper,
8 | }:
9 | stdenv.mkDerivation rec {
10 | pname = "lemminx-maven";
11 | version = "0.11.1";
12 |
13 | src = fetchurl {
14 | url = "https://repo.eclipse.org/content/repositories/lemminx-releases/org/eclipse/lemminx/${pname}/${version}/${pname}-${version}-vscode-uber-jars.zip";
15 | sha256 = "YmvH6v3RrRMc3rcoTdJ287tWmNs8GzbpfrPGwlJp9SQ=";
16 | };
17 |
18 | nativeBuildInputs = [ unzip ];
19 |
20 | buildInputs = [ makeWrapper ];
21 |
22 | unpackPhase = ''
23 | unzip ${src}
24 | '';
25 |
26 | installPhase = ''
27 | runHook preInstall
28 |
29 | mkdir -p $out/share
30 | cp -r ./**.jar $out/share
31 |
32 | makeWrapper ${jre_headless}/bin/java $out/bin/lemminx \
33 | --add-flags "-XX:TieredStopAtLevel=1" \
34 | --add-flags "-XX:+UseParallelGC" \
35 | --add-flags "-XX:MinHeapFreeRatio=5" \
36 | --add-flags "-XX:MaxHeapFreeRatio=10" \
37 | --add-flags "-XX:GCTimeRatio=4" \
38 | --add-flags "-XX:AdaptiveSizePolicyWeight=90" \
39 | --add-flags "-Dsun.zip.disableMemoryMapping=true" \
40 | --add-flags "-cp" \
41 | --add-flags "$(ls -d -1 $out/share/** | tr '\n' ':')" \
42 | --add-flags "org.eclipse.lemminx.XMLServerLauncher"
43 |
44 | runHook postInstall
45 | '';
46 |
47 | meta = {
48 | description = "lemminx-maven";
49 | homepage = "https://github.com/eclipse-lemminx/lemminx-maven";
50 | license = lib.licenses.epl20;
51 | mainProgram = "lemminx";
52 | maintainers = with lib.maintainers; [ wenjinnn ];
53 | platforms = [ "x86_64-linux" ];
54 | };
55 | }
56 |
--------------------------------------------------------------------------------
/pkgs/rofi-screenshot-wayland/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | lib,
3 | stdenv,
4 | fetchFromGitHub,
5 | makeWrapper,
6 | rofi-wayland,
7 | slurp,
8 | grim,
9 | ffmpeg,
10 | wl-screenrec,
11 | coreutils,
12 | libnotify,
13 | hyprland,
14 | jq,
15 | }:
16 | stdenv.mkDerivation {
17 | pname = "rofi-screenshot-wayland";
18 | version = "unstable-2025-01-11";
19 |
20 | src = fetchFromGitHub {
21 | owner = "wenjinnn";
22 | repo = "rofi-screenshot-wayland";
23 | rev = "f1c7b23afeb5003b81e11052edef2dd79913f521";
24 | sha256 = "sha256-O99KmZX2MaQwPIZB3+vUfC8RmU/UJwzR+UAistkBfU0=";
25 | };
26 |
27 | nativeBuildInputs = [makeWrapper];
28 |
29 | installPhase = ''
30 | runHook preInstall
31 |
32 | install -Dm 0755 rofi-screenshot $out/bin/rofi-screenshot
33 |
34 | wrapProgram $out/bin/rofi-screenshot \
35 | --prefix PATH ":" ${
36 | lib.makeBinPath [
37 | rofi-wayland
38 | slurp
39 | grim
40 | ffmpeg
41 | wl-screenrec
42 | coreutils
43 | libnotify
44 | hyprland
45 | jq
46 | ]
47 | }
48 |
49 | runHook postInstall
50 | '';
51 |
52 | meta = with lib; {
53 | description = "Use rofi and ffcast to perform various types of screenshots and screen captures";
54 | homepage = "https://github.com/wenjinnn/rofi-screenshot-wayland";
55 | license = licenses.mit;
56 | maintainers = with maintainers; [wenjinnn];
57 | mainProgram = "rofi-screenshot";
58 | platforms = platforms.linux;
59 | };
60 | }
61 |
--------------------------------------------------------------------------------
/pkgs/wallpaper-switch/default.nix:
--------------------------------------------------------------------------------
1 | {
2 | runCommandNoCC,
3 | lib,
4 | makeWrapper,
5 | hyprland,
6 | hyprpaper,
7 | gawk,
8 | bash,
9 | coreutils-full,
10 | findutils,
11 | }:
12 | runCommandNoCC "wallpaper-switch" {
13 | nativeBuildInputs = [makeWrapper];
14 | } ''
15 | mkdir -p $out/bin
16 | dest="$out/bin/wallpaper-switch"
17 | cp ${./wallpaper-switch.sh} $dest
18 | chmod +x $dest
19 | patchShebangs $dest
20 |
21 | wrapProgram $dest \
22 | --prefix PATH : ${lib.makeBinPath [hyprland hyprpaper gawk findutils coreutils-full bash]}
23 | ''
24 |
--------------------------------------------------------------------------------
/pkgs/wallpaper-switch/wallpaper-switch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | wallpaperpath=$HOME/Pictures/BingWallpaper
3 |
4 | if [[ -n "$1" && "random" == "$1" ]]; then
5 | next=$(find "$wallpaperpath" -maxdepth 1 -type f -not -path '*/.*' | shuf -n 1)
6 | else
7 | next=$(find "$wallpaperpath" -maxdepth 1 -type f -not -path '*/.*' -printf '%T+\t%p\n' | sort -k 1 -r | head -1 | awk '{print $NF}')
8 | fi
9 | echo "next wallpaper: $next"
10 | hyprctl hyprpaper preload "$next"
11 | # sleep here is because hyprctl sometimes throws errors if the interval between the two commands we send is too short.
12 | sleep 1
13 | hyprctl hyprpaper wallpaper ",$next"
14 | sleep 1
15 | hyprctl hyprpaper unload all
16 |
--------------------------------------------------------------------------------
/secrets.yaml:
--------------------------------------------------------------------------------
1 | ANTHROPIC_API_KEY: ENC[AES256_GCM,data:jM4AfQjL4tkv14UkNfV5yczmpWxwmKc2VRhgyr1EUJ59BT42w/igkBDVw4TB9NIFASn2UNjDOJDZDoeorWY8m66XY4Ed36Gx4s1q28pQRViTh4XZ+BKTIK3kP9IOvj44NRWY6jbw666AdnA1,iv:YfyUJ5JayqeKN6ZXAKsFoCAR80F3jnYHPUZiExYvxns=,tag:+dzC5HfUe32EnNderNWkpw==,type:str]
2 | DEEPSEEK_API_KEY: ENC[AES256_GCM,data:zwLJxB4qjuaEzmUZ18RXKwtR7mJzy45ft3+FEgAtdvy9tr0=,iv:q6Ozvz1a2Z3h0mBZKKBsGiOTUwo8cN00MhFPoV8dZhY=,tag:h11iu2zjyxq7RBXYDaJ5og==,type:str]
3 | MIHOMO_PROVIDER: ENC[AES256_GCM,data:gkpluErFa7PqB/NWsv+VlTnDStPetSuxz0Ke4jBbFet8u+6Pd6/5iNmFtyoxRf1mXCYtzd2OsB2YTpIuzg0gCGiUr4vIxwG6eQ==,iv:QKDLfBW17+RHCd+GBlinugWfmLhjaJLaxJzCIVdrbMk=,tag:j8gAB/tHkUOpRmEqomUQGg==,type:str]
4 | MIHOMO_PROVIDER2: ENC[AES256_GCM,data:dU5o7g4IU5xYQD4tjR1oLeMA9yosFRRIDchKJDX6F6CKY73hlMSAZieoxh8y1P7CQrkms6TnLfTb2J/jeAb/jjFZ,iv:ayZ9FHSo2yF+RUCmTEP9wvoE69+JXQyKjDBWl4Q8jsY=,tag:gZt++yzicQlauUM/K8w2hQ==,type:str]
5 | OUTLOOK_CLIENT_ID: ENC[AES256_GCM,data:EfGTnc0zF0MUtPm8zyGQEpMP8niyFyXcIw3664+K3QaSmhR6,iv:AtSYW8EGHwyfGMciYzgmuua7N6UmuVcAk0P6uB/m0ng=,tag:EUAU0+uyFmT4MSLveHvwYg==,type:str]
6 | GMAIL_CLIENT_ID: ENC[AES256_GCM,data:GS6Wr7LdAcmRnYiMTo66xZyo1KdegZYgqwDIId1RXLu2FSFX2q6N0Nt92VjySd/CKGimgk/6T/+8PvAz3sddu6QOyT4LrzPJ,iv:HmUzBQ8DnM/CrohdZeQTpQmabwiB62akG7oOfsCNpc4=,tag:iZuPJoYQiljnlF8hR6Pl1A==,type:str]
7 | GMAIL_CLIENT_SECRET: ENC[AES256_GCM,data:Auhr5mNQA2GDRXuS6Ln9uQu2WLngrTVVGIrei7s0bg/5dlw=,iv:VWjEyxl+l0ii8WZNwI5SkMbHPievORm8ul8F7EhRrEA=,tag:RoX/+HebfZQCHunkc0toiw==,type:str]
8 | SILICONFLOW_API_KEY: ENC[AES256_GCM,data:yjwCkKYpKV9clLBJVnKR0wx8pdkPuGNjl0EGQb+Kdj3TwKiP1CPmor0aWeWZ051p1Md5,iv:cdWRgqFiJB8IECU+sZmM6YXgXZ5YpDvtoyeqATl2pgc=,tag:dzUBjL3q0UPUCFKEYSpbmg==,type:str]
9 | sops:
10 | kms: []
11 | gcp_kms: []
12 | azure_kv: []
13 | hc_vault: []
14 | age:
15 | - recipient: age1swanwyhp3k6nycu2q3pyurgugzj4wlxg84gaj272rky0xu8j7ynq2eek7w
16 | enc: |
17 | -----BEGIN AGE ENCRYPTED FILE-----
18 | YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBIT3pjNGNmdlkvVDBFMHU5
19 | MHpLcHg1bFI0M1RjNitEMkJWTUZBZEhtNUJVCjRCdHMxdHQ0eUlLYmo5MjRNb0N3
20 | QWRFcld0QmpIRVF1TC9TZWRJbEtjMWcKLS0tIElyWGRkcFAxRmZnVUtEWk1RMmN4
21 | cFRSTVFGQ2h0WTNZankrYkRWSng5NlkKrapspMzqpkwg2gOWEds2fY3EtvzQFzOw
22 | jr2mJIcSb1iErhtKL+6FptHqnEZRL7Z1xfR8qsjmar3ylYM51lepgg==
23 | -----END AGE ENCRYPTED FILE-----
24 | - recipient: age1r9aqhunddlxpjnw2lezhq3zn7edgqqju2mfjyxra58kg95f2mg6s0qz6v5
25 | enc: |
26 | -----BEGIN AGE ENCRYPTED FILE-----
27 | YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBMb2YyQjN1eklteFh5UkFs
28 | SnpsSm5UUHJSYWp0MmpTV0ltNmF0WlZYcW1rCkdycSt4emwrU3JzMk9BUnAybVNC
29 | ajl3NStSd1I4UDZHWU9WTW1QUndGaGsKLS0tIHk0QnNoNHZHNzNBalRJNk92bEEx
30 | RGllYjlnVEJJTVF1YjY2dTBNV0Uxd1kKCcmaIMWypUg9BRz8dnJMIgQFrpp9tSlO
31 | 1tldvp+9eQwFJ6VJrWOwl4GhtprXB2gMyBD0bTOuPcQtNGi5JpgJAw==
32 | -----END AGE ENCRYPTED FILE-----
33 | - recipient: age1u7g2z73c3fq28purtn9kvkpsxlq4srkkn4944u5krfwqjkeqeshq9zgs3m
34 | enc: |
35 | -----BEGIN AGE ENCRYPTED FILE-----
36 | YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA2aXNWNkE3YlowTmVtMFpr
37 | Y3VqS2E4b2xTWTNvUW96YnJaV21VaVczYkY4Ck5ySTlxRncxL3FGZDZYTFVjNHV2
38 | V0RrakpaNUxqSitNYTZHaFduSmEzT3MKLS0tIHIwa293ZVhIWDB4MXFrcS9QWHZM
39 | U3FidVhMRXhEZmNRNUVXUUNId0hQTTgKHrtyOAdLFwM42kQ7gM9xjVjSm0E+QanT
40 | hEs/i/N6pyKVXukWmElLqXcvTGGkyO1Rpc1XKxLA+l6BWCkDNknQCw==
41 | -----END AGE ENCRYPTED FILE-----
42 | - recipient: age10ff9heqlh8qjunnt9060a97aqxa7vqj4nclmzm0gwe54fe95mdlqc7k6r4
43 | enc: |
44 | -----BEGIN AGE ENCRYPTED FILE-----
45 | YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAyRFJHdlk2REpIdkJkUHRB
46 | R1hwblZEM0o4MVpYTXlobnd3WnRMYWtONDJRCnhBV2pMZ0RFdVdCVkhsRkp1UDVF
47 | V25FaWx1a25FbklmR3BmSWhTNEdsMTQKLS0tIE5SbWpqY2NEMXlXZnpSRUozQm1o
48 | OUpHQ0drcUdlaGt2ZUwrLzkybElOTTgKiX2BeIu5zQ66HnId43yUvfUBKBHaWXu2
49 | y9p55rHuijfC39stSWHMW1Q7ugbPHd7EYDrGgpvrMeQ+C07HpnZXRA==
50 | -----END AGE ENCRYPTED FILE-----
51 | lastmodified: "2025-02-25T06:25:47Z"
52 | mac: ENC[AES256_GCM,data:N9xYgIzuk6Jlg11ynXcFTSLL6O/Ydrzvl4zW0ivHQOwkOZZzrWYypUSbiTq5+CS+AAUd+6+BsNpp3kPAZs9WvUJNfb5ixR945HoRXT+NADELNdiwNp7vLgE1F2qbjqRcm/fW0XXH+XiYBLsIXBg5ZKS3BFsHFNBNirpdjD8kX10=,iv:p+Itq6ZcjLsuKXWUHpeL8Chf4SjGwG3GL8EB0B57HL8=,tag:UnBhL00q70Lp4hOWdUx9qw==,type:str]
53 | pgp: []
54 | unencrypted_suffix: _unencrypted
55 | version: 3.9.4
56 |
--------------------------------------------------------------------------------
/xdg/config/ctags/my.ctags:
--------------------------------------------------------------------------------
1 | --recurse=yes
2 | --exclude=.git
3 | --exclude=BUILD
4 | --exclude=.svn
5 | --exclude=*vendor/*
6 | --exclude=*node_modules/*
7 | --exclude=*target/*
8 | --exclude=*log/*
9 | --exclude=\*.min.\*
10 | --exclude=\*.swp
11 | --exclude=\*.bak
12 | --exclude=\*.pyc
13 | --exclude=\*.class
14 | --exclude=\*.sln
15 | --exclude=\*.csproj
16 | --exclude=\*.csproj.user
17 | --exclude=\*.cache
18 | --exclude=\*.dll
19 | --exclude=\*.pdb
20 |
--------------------------------------------------------------------------------
/xdg/config/nvim/.gitignore:
--------------------------------------------------------------------------------
1 | **/tags
2 | **/*.spl
3 |
--------------------------------------------------------------------------------
/xdg/config/nvim/.stylua.toml:
--------------------------------------------------------------------------------
1 | column_width = 120
2 | line_endings = "Unix"
3 | indent_type = "Spaces"
4 | indent_width = 2
5 | quote_style = "AutoPreferSingle"
6 | call_parentheses = "Always"
7 | collapse_simple_statement = "Always"
8 |
--------------------------------------------------------------------------------
/xdg/config/nvim/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 wenjin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/ftplugin/java.vim:
--------------------------------------------------------------------------------
1 | " lua require('lsp.java.jdtls').setup()
2 | setlocal path=.,src/main/java/**,src/test/java/**,**/src/main/java/**,**/src/test/java/**
3 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/ftplugin/json.vim:
--------------------------------------------------------------------------------
1 | setlocal shiftwidth=2
2 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/ftplugin/lua.vim:
--------------------------------------------------------------------------------
1 | setlocal shiftwidth=2
2 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/ftplugin/markdown.vim:
--------------------------------------------------------------------------------
1 | setlocal conceallevel=2
2 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/ftplugin/nix.vim:
--------------------------------------------------------------------------------
1 | setlocal shiftwidth=2
2 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/ftplugin/org.vim:
--------------------------------------------------------------------------------
1 | setlocal conceallevel=2
2 |
3 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/ftplugin/vue.vim:
--------------------------------------------------------------------------------
1 | setlocal shiftwidth=2
2 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/cssls.lua:
--------------------------------------------------------------------------------
1 | local capabilities = require('util.lsp').make_capabilities()
2 | capabilities.textDocument.completion.completionItem.snippetSupport = true
3 | return {
4 | {
5 | capabilities = capabilities,
6 | },
7 | }
8 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/eslint.lua:
--------------------------------------------------------------------------------
1 | return {
2 | on_attach = function(client, bufnr)
3 | vim.lsp.config.eslint.on_attach(client, bufnr)
4 | vim.api.nvim_create_autocmd('BufWritePre', {
5 | buffer = bufnr,
6 | command = 'LspEslintFixAll',
7 | })
8 | end,
9 | settings = {
10 | format = { enable = true },
11 | autoFixOnSave = true,
12 | codeActionsOnSave = {
13 | mode = 'all',
14 | rules = { '!debugger', '!no-only-tests/*' },
15 | },
16 | lintTask = {
17 | enable = true,
18 | },
19 | },
20 | }
21 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/jsonls.lua:
--------------------------------------------------------------------------------
1 | return {
2 | settings = {
3 | json = {
4 | schemas = require('schemastore').json.schemas(),
5 | validate = { enable = true },
6 | },
7 | },
8 | }
9 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/kulala_ls.lua:
--------------------------------------------------------------------------------
1 | return {
2 | cmd = { 'npx', '--yes', '--', '@mistweaverco/kulala-ls', '--stdio' },
3 | }
4 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/lua_ls.lua:
--------------------------------------------------------------------------------
1 | return {
2 | on_init = function(client)
3 | local path = client.workspace_folders[1].name
4 | if vim.loop.fs_stat(path .. '/.luarc.json') or vim.loop.fs_stat(path .. '/.luarc.jsonc') then return end
5 |
6 | client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
7 | runtime = {
8 | -- Tell the language server which version of Lua you're using
9 | -- (most likely LuaJIT in the case of Neovim)
10 | version = 'LuaJIT',
11 | },
12 | -- Make the server aware of Neovim runtime files
13 | workspace = {
14 | maxPreload = 2000,
15 | preloadFileSize = 1000,
16 | checkThirdParty = false,
17 | library = {
18 | vim.env.VIMRUNTIME,
19 | -- Depending on the usage, you might want to add additional paths here.
20 | -- "${3rd}/luv/library"
21 | -- "${3rd}/busted/library",
22 | },
23 | -- or pull in all of 'runtimepath'. NOTE: this is a lot slower
24 | -- library = vim.api.nvim_get_runtime_file("", true)
25 | },
26 | hint = {
27 | enable = true,
28 | },
29 | format = {
30 | enable = true,
31 | defaultConfig = {
32 | indent_size = '2',
33 | quote_style = 'double',
34 | trailing_table_separator = 'smart',
35 | align_call_args = 'false',
36 | align_function_params = 'false',
37 | align_continuous_assign_statement = 'false',
38 | align_continuous_rect_table_field = 'false',
39 | align_if_branch = 'false',
40 | align_array_table = 'false',
41 | align_continuous_similar_call_args = 'false',
42 | align_continuous_inline_comment = 'false',
43 | align_chain_expr = 'none',
44 | },
45 | },
46 | })
47 | end,
48 | settings = {
49 | Lua = {},
50 | },
51 | }
52 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/nixd.lua:
--------------------------------------------------------------------------------
1 | local hostname = vim.fn.hostname()
2 | local username = os.getenv('USER')
3 | return {
4 | settings = {
5 | nixd = {
6 | formatting = {
7 | command = { 'nixfmt' },
8 | },
9 | options = {
10 | nixos = {
11 | expr = string.format(
12 | '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.%s.options',
13 | hostname
14 | ),
15 | },
16 | home_manager = {
17 | expr = string.format(
18 | '(builtins.getFlake ("git+file://" + toString ./.)).homeConfigurations."%s@%s".options',
19 | username,
20 | hostname
21 | ),
22 | },
23 | },
24 | },
25 | },
26 | }
27 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/pylsp.lua:
--------------------------------------------------------------------------------
1 | local lsp = require('util.lsp')
2 | return {
3 | on_attach = function(client, bufnr)
4 | lsp.setup(client, bufnr)
5 | local map = lsp.buf_map(bufnr)
6 | local dap_python = require('dap-python')
7 | map('n', 'dm', dap_python.test_method, 'Dap test method')
8 | map('n', 'da', dap_python.test_class, 'Dap test class')
9 | map('v', 'dv', dap_python.debug_selection, 'Dap debug selection')
10 | end,
11 | }
12 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/texlab.lua:
--------------------------------------------------------------------------------
1 | return {
2 | filetypes = {
3 | 'bib',
4 | 'gitcommit',
5 | 'markdown',
6 | 'org',
7 | 'plaintex',
8 | 'rst',
9 | 'rnoweb',
10 | 'tex',
11 | 'pandoc',
12 | 'quarto',
13 | 'rmd',
14 | 'context',
15 | 'html',
16 | 'xhtml',
17 | 'mail',
18 | 'text',
19 | },
20 | }
21 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/ts_ls.lua:
--------------------------------------------------------------------------------
1 | local vue_language_server_path = os.getenv('VUE_LANGUAGE_SERVER_PATH')
2 | local inlay_hints_settings = {
3 | includeInlayEnumMemberValueHints = true,
4 | includeInlayFunctionLikeReturnTypeHints = true,
5 | includeInlayFunctionParameterTypeHints = true,
6 | includeInlayParameterNameHints = 'literal',
7 | includeInlayParameterNameHintsWhenArgumentMatchesName = false,
8 | includeInlayPropertyDeclarationTypeHints = true,
9 | includeInlayVariableTypeHints = false,
10 | includeInlayVariableTypeHintsWhenTypeMatchesName = false,
11 | }
12 | return {
13 | init_options = {
14 | plugins = {
15 | {
16 | name = '@vue/typescript-plugin',
17 | -- environment variable has highest priority, then relative path, then absolute path
18 | location = vue_language_server_path
19 | or 'node_modules/@vue/language-server'
20 | or '/usr/local/lib/node_modules/@vue/language-server',
21 | languages = { 'javascript', 'typescript', 'vue' },
22 | },
23 | },
24 | },
25 | filetypes = {
26 | 'javascript',
27 | 'javascriptreact',
28 | 'javascript.jsx',
29 | 'typescript',
30 | 'typescriptreact',
31 | 'typescript.tsx',
32 | 'vue',
33 | },
34 | settings = {
35 | format = { enable = false },
36 | typescript = {
37 | inlayHints = inlay_hints_settings,
38 | implementationsCodeLens = { enabled = true },
39 | referencesCodeLens = { enabled = true },
40 | },
41 | javascript = {
42 | inlayHints = inlay_hints_settings,
43 | implementationsCodeLens = { enabled = true },
44 | referencesCodeLens = { enabled = true },
45 | },
46 | },
47 | }
48 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/vue_ls.lua:
--------------------------------------------------------------------------------
1 | return {
2 | init_options = {
3 | typescript = {
4 | tsdk = os.getenv('TYPESCRIPT_LIBRARY') or 'node_modules/typescript/lib',
5 | },
6 | },
7 | settings = {
8 | -- let eslint take over format capability
9 | format = { enable = false },
10 | },
11 | }
12 |
--------------------------------------------------------------------------------
/xdg/config/nvim/after/lsp/yamlls.lua:
--------------------------------------------------------------------------------
1 | return {
2 | settings = {
3 | yaml = {
4 | schemaStore = {
5 | -- You must disable built-in schemaStore support if you want to use
6 | -- this plugin and its advanced options like `ignore`.
7 | enable = false,
8 | },
9 | schemas = require('schemastore').yaml.schemas(),
10 | },
11 | },
12 | }
13 |
--------------------------------------------------------------------------------
/xdg/config/nvim/colors/wenvim-brown.lua:
--------------------------------------------------------------------------------
1 | ---@diagnostic disable: param-type-mismatch
2 | local base_color = {
3 | background = '#202020',
4 | foreground = '#ddc7a1',
5 | saturation = 'mediumhigh',
6 | }
7 | require('mini.hues').setup(base_color)
8 | require('util.color').setup_wenvim_color(base_color)
9 |
10 | vim.g.colors_name = 'wenvim-blue'
11 |
--------------------------------------------------------------------------------
/xdg/config/nvim/colors/wenvim-dark.lua:
--------------------------------------------------------------------------------
1 | ---@diagnostic disable: param-type-mismatch
2 | local base_color = {
3 | background = '#1e1e1e',
4 | foreground = '#e5e5e5',
5 | saturation = 'high',
6 | }
7 | require('mini.hues').setup(base_color)
8 | require('util.color').setup_wenvim_color(base_color)
9 |
10 | vim.g.colors_name = 'wenvim-blue'
11 |
--------------------------------------------------------------------------------
/xdg/config/nvim/colors/wenvim-purple.lua:
--------------------------------------------------------------------------------
1 | ---@diagnostic disable: param-type-mismatch
2 | local base_color = {
3 | background = '#1e2131',
4 | foreground = '#c4c6cd',
5 | }
6 | require('mini.hues').setup(base_color)
7 | require('util.color').setup_wenvim_color(base_color)
8 |
9 | vim.g.colors_name = 'wenvim-blue'
10 |
--------------------------------------------------------------------------------
/xdg/config/nvim/init.lua:
--------------------------------------------------------------------------------
1 | -- my nvim config write in lua
2 | vim.g.mapleader = ' '
3 | vim.g.maplocalleader = ' '
4 |
5 | -- Put this at the top of 'init.lua'
6 | local path_package = vim.fn.stdpath('data') .. '/site'
7 | local path_snapshot = vim.fn.stdpath('config') .. '/mini-deps-snap'
8 | local mini_path = path_package .. '/pack/deps/start/mini.nvim'
9 | if not vim.loop.fs_stat(mini_path) then
10 | vim.cmd('echo "Installing `mini.nvim`" | redraw')
11 | local clone_cmd = {
12 | 'git',
13 | 'clone',
14 | '--filter=blob:none',
15 | -- Uncomment next line to use 'stable' branch
16 | -- '--branch', 'stable',
17 | 'https://github.com/echasnovski/mini.nvim',
18 | mini_path,
19 | }
20 | vim.fn.system(clone_cmd)
21 | vim.cmd('packadd mini.nvim | helptags ALL')
22 | end
23 | require('mini.deps').setup({
24 | path = {
25 | package = path_package,
26 | snapshot = path_snapshot,
27 | },
28 | })
29 | require('plugin').setup()
30 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/lsp/jdtls/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 | local util = require('util.lsp')
3 | local jdtls = require('jdtls')
4 | function M.setup_dap()
5 | jdtls.setup_dap()
6 | require('jdtls.dap').setup_dap_main_class_configs({
7 | config_overrides = { vmArgs = os.getenv('JDTLS_DAP_VMARGS') or '-Xms128m -Xmx512m' },
8 | })
9 | local dap = require('dap')
10 | -- for all launch.json options see https://github.com/microsoft/vscode-java-debug#options
11 | require('dap.ext.vscode').load_launchjs()
12 | local project_name = os.getenv('DAP_PROJECT_NAME')
13 | local host_name = os.getenv('DAP_HOST')
14 | local host_port = os.getenv('DAP_HOST_PORT') or 5005
15 | if host_name ~= nil then
16 | dap.configurations.java = {
17 | {
18 | type = 'java',
19 | request = 'attach',
20 | projectName = project_name or '',
21 | name = string.format('Java attach: %s:%s %s', host_name, host_port, project_name or ''),
22 | hostName = host_name,
23 | port = host_port,
24 | },
25 | }
26 | end
27 | end
28 |
29 | function M.setup_jdtls_buf_keymap(bufnr)
30 | local map = util.buf_map(bufnr)
31 | local jdtls_tests = require('jdtls.tests')
32 | map('n', 'cC', 'JdtCompile full', 'Jdt compile full')
33 | map('n', 'cc', 'JdtCompile incremental', 'Jdt compile incremental')
34 | map('n', 'cu', 'JdtUpdateHotcode', 'Jdt update hotcode')
35 | map('n', 'cg', jdtls_tests.generate, 'Jdt test generate')
36 | map('n', 'co', jdtls.organize_imports, 'Jdt Organize Imports')
37 | map('n', 'cv', jdtls.extract_variable, 'Jdt Extract Variable')
38 | map('n', 'cT', jdtls_tests.goto_subjects, 'Jdt Test Goto Subjects')
39 | -- If using nvim-dap
40 | -- This requires java-debug and vscode-java-test bundles, see install steps in this README further below.
41 | map('n', 'da', jdtls.test_class, 'Jdt Test Class')
42 | map('n', 'dm', jdtls.test_nearest_method, 'Jdt Test Method')
43 | map('n', 'cV', jdtls.extract_constant, 'Jdt Extract Constant')
44 | map('v', 'cv', function() jdtls.extract_variable(true) end, 'Jdt Extract Variable')
45 | map('v', 'cV', function() jdtls.extract_constant(true) end, 'Jdt Extract Constant')
46 | map('v', 'ce', function() jdtls.extract_method(true) end, 'Jdt Extract Method')
47 | end
48 |
49 | function M.start()
50 | local on_attach = function(client, bufnr)
51 | M.setup_dap()
52 | M.setup_jdtls_buf_keymap(bufnr)
53 | util.setup(client, bufnr)
54 | end
55 | local root_dir = vim.fs.root(0, { 'mvnw', 'gradlew', '.git', '.svn' })
56 | local ws_name, _ = string.gsub(vim.fn.fnamemodify(root_dir, ':p'), '/', '_')
57 | local jdtls_data_path = vim.fn.stdpath('data') .. '/jdtls'
58 | local jdtls_debug_path = os.getenv('JAVA_DEBUG_PATH') or jdtls_data_path
59 | local jdtls_test_path = os.getenv('JAVA_TEST_PATH') or jdtls_data_path
60 |
61 | local bundles = { vim.fn.glob(jdtls_debug_path .. '/server/com.microsoft.java.debug.plugin-*.jar') }
62 | local test_bundles = vim.split(vim.fn.glob(jdtls_test_path .. '/server/*.jar', true), '\n')
63 | vim.list_extend(bundles, test_bundles)
64 |
65 | local extendedClientCapabilities = jdtls.extendedClientCapabilities
66 | local jdtls_cache_path = vim.fn.stdpath('cache') .. '/jdtls'
67 | local lombok_path = os.getenv('LOMBOK_PATH')
68 | local config = {
69 | settings = require('lsp.jdtls.settings'),
70 | capabilities = util.make_capabilities(),
71 | root_dir = root_dir,
72 | on_attach = on_attach,
73 | filetypes = { 'java' },
74 | init_options = {
75 | bundles = bundles,
76 | extendedClientCapabilities = extendedClientCapabilities,
77 | },
78 | handlers = {
79 | -- filter noisy notifications
80 | ['$/progress'] = function(err, result, ctx)
81 | local msg = result.value.message
82 | if msg and msg:sub(1, 18) == 'Validate documents' then return end
83 | if msg and msg:sub(1, 19) == 'Publish Diagnostics' then return end
84 | -- pass through to normal handler
85 | vim.lsp.handlers['$/progress'](err, result, ctx)
86 | end,
87 | },
88 | cmd = util.java_cmd_optimize('jdtls', {
89 | '--jvm-arg=-Dlog.protocol=true',
90 | '--jvm-arg=-Dlog.level=ALL',
91 | '--jvm-arg=-Dfile.encoding=utf-8',
92 | '--jvm-arg=-Djava.import.generatesMetadataFilesAtProjectRoot=false',
93 | '--jvm-arg=-Xms256m',
94 | '--jvm-arg=-Xmx' .. (os.getenv('JDTLS_XMX') or '1G'),
95 | lombok_path ~= nil and string.format('--jvm-arg=-javaagent:%s/lombok.jar', lombok_path) or '',
96 | '-configuration',
97 | jdtls_cache_path .. '/config',
98 | '-data',
99 | jdtls_cache_path .. '/workspace/' .. ws_name,
100 | }, '--jvm-arg='),
101 | }
102 |
103 | -- Server
104 | jdtls.start_or_attach(config)
105 | end
106 |
107 | function M.setup()
108 | local jdtls_setup_group = require('util').augroup('jdtls_setup')
109 | vim.api.nvim_create_autocmd({ 'FileType' }, {
110 | group = jdtls_setup_group,
111 | pattern = 'java',
112 | callback = M.start,
113 | })
114 | end
115 |
116 | return M
117 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/lsp/jdtls/settings.lua:
--------------------------------------------------------------------------------
1 | local home = os.getenv('HOME')
2 | local jdtls_maven_settings = os.getenv('JDTLS_MAVEN_SETTINGS')
3 | local java_8_home = os.getenv('JAVA_8_HOME')
4 | local java_17_home = os.getenv('JAVA_17_HOME')
5 | local java_21_home = os.getenv('JAVA_21_HOME')
6 | local config_path = vim.fn.stdpath('config')
7 | local M = {
8 | java = {
9 | settings = {
10 | url = config_path .. '/lua/lsp/jdtls/settings.prefs',
11 | },
12 | eclipse = {
13 | downloadSources = true,
14 | },
15 | symbols = {
16 | includeSourceMethodDeclarations = true,
17 | },
18 | selectionRange = { enabled = true },
19 | recommendations = {
20 | dependency = {
21 | analytics = {
22 | show = true,
23 | },
24 | },
25 | },
26 | format = {
27 | enabled = true,
28 | comments = {
29 | enabled = false,
30 | },
31 | onType = {
32 | enabled = false,
33 | },
34 | },
35 | maxConcurrentBuilds = 5,
36 | saveActions = {
37 | organizeImports = false,
38 | },
39 | trace = {
40 | server = 'verbose',
41 | },
42 | referencesCodeLens = { enabled = true },
43 | implementationsCodeLens = { enabled = true },
44 | signatureHelp = {
45 | enabled = true,
46 | description = {
47 | enabled = true,
48 | },
49 | },
50 | inlayHints = {
51 | parameterNames = { enabled = 'all' },
52 | },
53 | contentProvider = { preferred = 'fernflower' },
54 | templates = {
55 | typeComment = {
56 | '/**',
57 | ' * @author: ${user}',
58 | ' * @date: ${date}',
59 | ' * @description: ',
60 | ' */',
61 | },
62 | },
63 | typeHierarchy = {
64 | lazyLoad = true,
65 | },
66 | import = {
67 | gradle = { enabled = true },
68 | generatesMetadataFilesAtProjectRoot = false,
69 | maven = { enabled = true },
70 | exclusions = {
71 | '**/node_modules/**',
72 | '**/.metadata/**',
73 | '**/archetype-resources/**',
74 | '**/META-INF/maven/**',
75 | '**/Frontend/**',
76 | '**/CSV_Aggregator/**',
77 | },
78 | },
79 | maven = {
80 | downloadSources = true,
81 | },
82 | autobuild = { enabled = true },
83 | completion = {
84 | maxResults = 0,
85 | filteredTypes = {
86 | 'com.sun.*',
87 | 'io.micrometer.shaded.*',
88 | 'java.awt.*',
89 | 'jdk.*',
90 | 'sun.*',
91 | },
92 | project = {
93 | resourceFilters = {
94 | 'build',
95 | 'node_modules',
96 | '\\.git',
97 | '\\.idea',
98 | '\\.cache',
99 | '\\.vscode',
100 | '\\.settings',
101 | },
102 | },
103 | overwrite = false,
104 | guessMethodArguments = true,
105 | favoriteStaticMembers = {
106 | 'org.hamcrest.MatcherAssert.assertThat',
107 | 'org.hamcrest.Matchers.*',
108 | 'org.hamcrest.CoreMatchers.*',
109 | 'org.junit.jupiter.api.Assertions.*',
110 | 'java.util.Objects.requireNonNull',
111 | 'java.util.Objects.requireNonNullElse',
112 | 'org.mockito.Mockito.*',
113 | },
114 | },
115 | sources = {
116 | organizeImports = { starThreshold = 9999, staticStarThreshold = 9999 },
117 | },
118 | codeGeneration = {
119 | generateComments = true,
120 | useBlocks = true,
121 | toString = {
122 | template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}',
123 | },
124 | },
125 | configuration = {
126 | updateBuildConfiguration = 'automatic',
127 | maven = {
128 | globalSettings = '/opt/maven/conf/settings.xml',
129 | userSettings = jdtls_maven_settings or home .. '/.m2/settings.xml',
130 | },
131 | runtimes = {
132 | {
133 | name = 'JavaSE-1.8',
134 | path = java_8_home or '/usr/lib/jvm/java-8-openjdk/',
135 | default = true,
136 | },
137 | {
138 | name = 'JavaSE-17',
139 | path = java_17_home or '/usr/lib/jvm/java-17-openjdk/',
140 | default = true,
141 | },
142 | {
143 | name = 'JavaSE-21',
144 | path = java_21_home or '/usr/lib/jvm/java-21-openjdk/',
145 | },
146 | },
147 | },
148 | },
149 | }
150 |
151 | return M
152 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/lsp/jdtls/settings.prefs:
--------------------------------------------------------------------------------
1 | org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
2 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/colorscheme.lua:
--------------------------------------------------------------------------------
1 | if vim.g.vscode then return end
2 |
3 | local now = MiniDeps.now
4 | now(function()
5 | require('mini.colors').setup()
6 | vim.cmd.colorscheme('wenvim-brown')
7 | end)
8 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/core.lua:
--------------------------------------------------------------------------------
1 | local add, now, later = MiniDeps.add, MiniDeps.now, MiniDeps.later
2 | now(function() add('nvim-lua/plenary.nvim') end)
3 |
4 | now(function()
5 | require('mini.misc').setup()
6 | MiniMisc.setup_auto_root()
7 | MiniMisc.setup_termbg_sync()
8 | MiniMisc.setup_restore_cursor()
9 | local use_nested_comments = function() MiniMisc.use_nested_comments() end
10 | vim.api.nvim_create_autocmd('BufEnter', { callback = use_nested_comments })
11 | require('util').map('n', 'z', 'lua MiniMisc.zoom()', 'Zoom current window')
12 | end)
13 |
14 | later(function() require('mini.extra').setup() end)
15 |
16 | later(function()
17 | require('mini.basics').setup({
18 | extra_ui = true,
19 | mappings = { windows = false },
20 | })
21 | -- disable mini.basics C-s mapping
22 | vim.keymap.del({ 'n', 'i', 'x' }, '')
23 | end)
24 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/dap.lua:
--------------------------------------------------------------------------------
1 | if vim.g.vscode then return end
2 |
3 | -- nvim debug
4 | local add, later = MiniDeps.add, MiniDeps.later
5 | later(function()
6 | add({
7 | source = 'mfussenegger/nvim-dap',
8 | depends = {
9 | 'theHamsta/nvim-dap-virtual-text',
10 | 'mfussenegger/nvim-dap-python',
11 | 'jbyuki/one-small-step-for-vimkind',
12 | },
13 | })
14 | local dap = require('dap')
15 | local util = require('util')
16 | local map = util.map
17 |
18 | dap.defaults.fallback.terminal_win_cmd = 'tabnew'
19 |
20 | dap.adapters.gdb = {
21 | type = 'executable',
22 | command = 'gdb',
23 | args = { '-i', 'dap' },
24 | }
25 |
26 | dap.configurations.lua = {
27 | {
28 | type = 'nlua',
29 | request = 'attach',
30 | name = 'Attach to running Neovim instance',
31 | },
32 | }
33 |
34 | dap.adapters.nlua = function(callback, config)
35 | callback({ type = 'server', host = config.host or '127.0.0.1', port = config.port or 8086 })
36 | end
37 |
38 | dap.configurations.rust = {
39 | {
40 | name = 'Launch',
41 | type = 'gdb',
42 | request = 'launch',
43 | program = function() return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') end,
44 | cwd = '${workspaceFolder}',
45 | stopAtBeginningOfMainSubprogram = false,
46 | },
47 | }
48 |
49 | -- enable dap builtin auto completion
50 | vim.api.nvim_create_autocmd({ 'FileType' }, {
51 | pattern = 'dap-repl',
52 | group = util.augroup('dap_repl'),
53 | callback = function() require('dap.ext.autocompl').attach() end,
54 | })
55 |
56 | -- setup dap python and virtual text
57 | require('dap-python').setup('python')
58 | require('nvim-dap-virtual-text').setup({
59 | all_frames = true,
60 | virt_text_pos = 'eol',
61 | })
62 |
63 | -- dap function wrapper for keymap
64 | local function breakpoints_quickfix()
65 | dap.list_breakpoints()
66 | vim.cmd('copen')
67 | end
68 | local function dap_continue()
69 | -- fix java dap setup failed sometime
70 | if vim.bo.filetype == 'java' and require('dap').configurations.java == nil then require('lsp.jdtls').setup_dap() end
71 | dap.continue()
72 | end
73 |
74 | local function dap_set_breakpoint() dap.set_breakpoint(vim.fn.input('Breakpoint condition: ')) end
75 | local function dap_set_logpoint() dap.set_breakpoint(nil, nil, vim.fn.input('Log point message: ')) end
76 | local function dap_set_exc_breakpoint() dap.set_exception_breakpoints('default') end
77 | local function dap_repl_toggle()
78 | dap.repl.toggle()
79 | vim.cmd('wincmd p')
80 | local filetype = vim.api.nvim_get_option_value('filetype', { buf = 0 })
81 | if filetype == 'dap-repl' then vim.cmd('startinsert') end
82 | end
83 | local widgets = require('dap.ui.widgets')
84 | local function dap_hover() widgets.hover('', { title = 'dap-hover' }) end
85 |
86 | -- simple custom dap ui, cursor float window takes up the least screen space.
87 | local function dap_ui(widget, title)
88 | return function() widgets.cursor_float(widget, { title = title }) end
89 | end
90 |
91 | local function osv_launch() require('osv').launch({ port = 8086 }) end
92 |
93 | map('n', 'db', dap.toggle_breakpoint, 'Dap toggle breakpoint')
94 | map('n', 'dd', dap.clear_breakpoints, 'Dap clear breakpoint')
95 | map('n', 'dr', dap.run_last, 'Dap run last')
96 | map('n', 'dC', dap.run_to_cursor, 'Dap run to cursor')
97 | map('n', 'do', dap.step_over, 'Dap step over')
98 | map('n', 'dp', dap.step_back, 'Dap step back')
99 | map('n', 'di', dap.step_into, 'Dap step into')
100 | map('n', 'dO', dap.step_out, 'Dap step out')
101 | map('n', 'de', dap.reverse_continue, 'Dap reverse continue')
102 | map('n', 'dF', dap.restart_frame, 'Dap restart frame')
103 | map('n', 'ds', dap_ui(widgets.scopes, 'dap-scopes'), 'Dap scopes')
104 | map('n', 'df', dap_ui(widgets.frames, 'dap-frames'), 'Dap frames')
105 | map('n', 'de', dap_ui(widgets.expression, 'dap-expression'), 'Dap expression')
106 | map('n', 'dt', dap_ui(widgets.threads, 'dap-threads'), 'Dap threads')
107 | map('n', 'dS', dap_ui(widgets.sessions, 'dap-sessions'), 'Dap sessions')
108 | map('n', 'dq', breakpoints_quickfix, 'Dap list breakpoints')
109 | map('n', 'dc', dap_continue, 'Dap continue')
110 | map('n', 'dB', dap_set_breakpoint, 'Dap condition breakpoint')
111 | map('n', 'dl', dap_set_logpoint, 'Dap log breakpoint')
112 | map('n', 'dL', osv_launch, 'Dap osv launch')
113 | map('n', 'dE', 'DapEval', 'Dap eval buffer')
114 | map('n', 'dx', dap_set_exc_breakpoint, 'Dap exception breakpoint')
115 | map('n', 'dR', dap_repl_toggle, 'Dap repl toggle')
116 | map('n', 'dh', dap_hover, 'Dap hover')
117 | map('n', 'dn', 'DapNew', 'Dap new')
118 | end)
119 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/finder.lua:
--------------------------------------------------------------------------------
1 | if vim.g.vscode then return end
2 |
3 | local map = require('util').map
4 | local now, later = MiniDeps.now, MiniDeps.later
5 |
6 | -- Load mini.files immediately for sometimes we are gonna open folder with nvim
7 | -- In this case mini.files can't be lazy load
8 | now(function()
9 | require('mini.files').setup({
10 | windows = {
11 | preview = true,
12 | width_preview = 40,
13 | },
14 | })
15 | map('n', 'fe', MiniFiles.open, 'MiniFiles open')
16 | -- send notification to lsp when mini.files rename actions triggered, modified from snacks.nvim
17 | vim.api.nvim_create_autocmd('User', {
18 | pattern = 'MiniFilesActionRename',
19 | callback = function(event) require('util.lsp').on_rename_file(event.data.from, event.data.to) end,
20 | })
21 | -- Create mappings to modify target window via split
22 | local map_split = function(buf_id, lhs, direction)
23 | local rhs = function()
24 | -- Make new window and set it as target
25 | local cur_target = MiniFiles.get_explorer_state().target_window
26 | local new_target = vim.api.nvim_win_call(cur_target, function()
27 | vim.cmd(direction .. ' split')
28 | return vim.api.nvim_get_current_win()
29 | end)
30 |
31 | MiniFiles.set_target_window(new_target)
32 |
33 | -- This intentionally doesn't act on file under cursor in favor of
34 | -- explicit "go in" action (`l` / `L`). To immediately open file,
35 | -- add appropriate `MiniFiles.go_in()` call instead of this comment.
36 | end
37 |
38 | -- Adding `desc` will result into `show_help` entries
39 | local desc = 'Split ' .. direction
40 | vim.keymap.set('n', lhs, rhs, { buffer = buf_id, desc = desc })
41 | end
42 |
43 | -- Create mappings which use data from entry under cursor
44 | -- Set focused directory as current working directory
45 | local set_cwd = function()
46 | local path = (MiniFiles.get_fs_entry() or {}).path
47 | if path == nil then return vim.notify('Cursor is not on valid entry') end
48 | vim.fn.chdir(vim.fs.dirname(path))
49 | end
50 |
51 | -- Yank in register full path of entry under cursor
52 | local yank_path = function()
53 | local path = (MiniFiles.get_fs_entry() or {}).path
54 | if path == nil then return vim.notify('Cursor is not on valid entry') end
55 | vim.fn.setreg(vim.v.register, path)
56 | end
57 |
58 | -- Open path with system default handler (useful for non-text files)
59 | local ui_open = function() vim.ui.open(MiniFiles.get_fs_entry().path) end
60 |
61 | vim.api.nvim_create_autocmd('User', {
62 | pattern = 'MiniFilesBufferCreate',
63 | callback = function(args)
64 | local buf_id = args.data.buf_id
65 | -- Tweak keys to your liking
66 | map_split(buf_id, '', 'belowright horizontal')
67 | map_split(buf_id, '', 'belowright vertical')
68 | vim.keymap.set('n', 'g~', set_cwd, { buffer = buf_id, desc = 'Set cwd' })
69 | vim.keymap.set('n', 'gx', ui_open, { buffer = buf_id, desc = 'OS open' })
70 | vim.keymap.set('n', 'gy', yank_path, { buffer = buf_id, desc = 'Yank path' })
71 | end,
72 | })
73 | -- Set custom bookmarks
74 | local set_mark = function(id, path, desc) MiniFiles.set_bookmark(id, path, { desc = desc }) end
75 | vim.api.nvim_create_autocmd('User', {
76 | pattern = 'MiniFilesExplorerOpen',
77 | callback = function()
78 | local dotfiles_path = os.getenv('DOTFILES')
79 | local config_path = dotfiles_path and dotfiles_path .. '/xdg/config/nvim' or vim.fn.stdpath('config')
80 | set_mark('c', config_path, 'Config') -- path
81 | set_mark('w', vim.fn.getcwd, 'Working directory') -- callable
82 | set_mark('~', '~', 'Home directory')
83 | set_mark('.', function() return vim.fn.expand('#:p:h') end, 'Current directory')
84 | end,
85 | })
86 | end)
87 |
88 | -- visit recent files and we could add labels for files, easy to group files
89 | later(function()
90 | require('mini.visits').setup()
91 | map('n', 'v', MiniVisits.add_label, 'MiniVisits add label')
92 | map('n', 'V', MiniVisits.remove_label, 'MiniVisits remove label')
93 | end)
94 |
95 | -- mini.pick with lot custom keymaps
96 | later(function()
97 | require('mini.pick').setup()
98 | vim.ui.select = MiniPick.ui_select
99 | local show_with_icons = function(buf_id, items, query)
100 | return MiniPick.default_show(buf_id, items, query, { show_icons = true })
101 | end
102 | -- pick grep function that pass args to rg
103 | MiniPick.registry.grep_args = function()
104 | local args = vim.fn.input('Ripgrep args: ')
105 | local command = {
106 | 'rg',
107 | '--column',
108 | '--line-number',
109 | '--no-heading',
110 | '--field-match-separator=\\0',
111 | '--no-follow',
112 | '--color=never',
113 | }
114 | local args_table = vim.fn.split(args, ' ')
115 | vim.list_extend(command, args_table)
116 |
117 | return MiniPick.builtin.cli(
118 | { command = command },
119 | { source = { name = string.format('Grep (rg %s)', args), show = show_with_icons } }
120 | )
121 | end
122 | local function filter_buffers(pattern, cmd_opts)
123 | cmd_opts = cmd_opts or {}
124 | local items = {}
125 | local buffers_output =
126 | vim.api.nvim_exec2('filter' .. (cmd_opts.revert and '! ' or ' ') .. pattern .. ' ls', { output = true })
127 | if buffers_output.output ~= '' then
128 | for _, l in ipairs(vim.split(buffers_output.output, '\n')) do
129 | local buf_str, name = l:match('^%s*%d+'), l:match('"(.*)"')
130 | local buf_id = tonumber(buf_str)
131 | local item = { text = name, bufnr = buf_id }
132 | table.insert(items, item)
133 | end
134 | end
135 | return items
136 | end
137 | local function get_terminal_items(local_opts)
138 | local dap_terms = filter_buffers('/^\\[dap-terminal\\]/')
139 | local terms = filter_buffers('/^term:\\/\\//')
140 | return vim.list_extend(terms, dap_terms)
141 | end
142 | -- select terminals
143 | MiniPick.registry.terminals = function(local_opts)
144 | local items = get_terminal_items(local_opts)
145 | local terminal_opts = { source = { name = 'Terminal buffers', show = show_with_icons, items = items } }
146 | return MiniPick.start(terminal_opts)
147 | end
148 | vim.api.nvim_create_user_command('PickOrNewTerminal', function()
149 | local items = get_terminal_items()
150 | if #items == 0 then
151 | vim.cmd('terminal')
152 | elseif #items == 1 then
153 | vim.cmd('buffer ' .. items[1].bufnr)
154 | vim.cmd('startinsert')
155 | else
156 | vim.cmd('Pick terminals')
157 | end
158 | end, { desc = 'Pick terminals or new one' })
159 | map('n', 'ft', 'PickOrNewTerminal', 'Pick terminals or new one')
160 | map('n', 'fG', 'Pick grep_args', 'Pick grep with rg args')
161 | map('n', 'ff', 'Pick files', 'Pick files')
162 | map('n', 'fg', 'Pick grep_live', 'Pick grep live')
163 | map('n', 'fH', 'Pick help', 'Pick help')
164 | map('n', 'fb', 'Pick buffers', 'Pick buffers')
165 | map('n', 'fc', 'Pick cli', 'Pick cli')
166 | map('n', 'fR', 'Pick resume', 'Pick resume')
167 | map('n', 'fd', "Pick diagnostic scope='current'", 'Pick current diagnostic')
168 | map('n', 'fD', "Pick diagnostic scope='all'", 'Pick all diagnostic')
169 | map('n', 'gb', 'Pick git_branches', 'Pick git branches')
170 | map('n', 'gC', 'Pick git_commits', 'Pick git commits')
171 | map('n', 'gc', "Pick git_commits path='%'", 'Pick git commits current')
172 | map('n', 'gf', 'Pick git_files', 'Pick git files')
173 | map('n', 'gH', 'Pick git_hunks', 'Pick git hunks')
174 | map('n', 'fP', 'Pick hipatterns', 'Pick hipatterns')
175 | map('n', 'fh', 'Pick history', 'Pick history')
176 | map('n', 'fL', 'Pick hl_groups', 'Pick hl groups')
177 | map('n', 'fk', 'Pick keymaps', 'Pick keymaps')
178 | map('n', 'fl', "Pick list scope='location'", 'Pick location')
179 | map('n', 'fj', "Pick list scope='jump'", 'Pick jump')
180 | map('n', 'fq', "Pick list scope='quickfix'", 'Pick quickfix')
181 | map('n', 'fC', "Pick list scope='change'", 'Pick change')
182 | map('n', 'fm', 'Pick marks', 'Pick marks')
183 | map('n', 'fo', 'Pick oldfiles', 'Pick oldfiles')
184 | map('n', 'fO', 'Pick options', 'Pick options')
185 | map('n', 'fr', 'Pick registers', 'Pick registers')
186 | map('n', 'fp', 'Pick spellsuggest', 'Pick spell suggest')
187 | map('n', 'fT', 'Pick treesitter', 'Pick treesitter')
188 | map('n', 'fv', 'Pick visit_paths', 'Pick visit paths')
189 | map('n', 'fV', 'Pick visit_labels', 'Pick visit labels')
190 | map('n', 'cd', "Pick lsp scope='definition'", 'Pick lsp definition')
191 | map('n', 'cD', "Pick lsp scope='declaration'", 'Pick lsp declaration')
192 | map('n', 'cr', "Pick lsp scope='references'", 'Pick lsp references')
193 | map('n', 'ci', "Pick lsp scope='implementation'", 'Pick lsp implementation')
194 | map('n', 'ct', "Pick lsp scope='type_definition'", 'Pick lsp type definition')
195 | map('n', 'fs', "Pick lsp scope='document_symbol'", 'Pick lsp document symbol')
196 | map(
197 | 'n',
198 | 'fS',
199 | "Pick lsp scope='workspace_symbol' symbol_query=vim.fn.input('Symbol:\\ ')",
200 | 'Pick lsp workspace symbol'
201 | )
202 | end)
203 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/git.lua:
--------------------------------------------------------------------------------
1 | local later = MiniDeps.later
2 | local map = require('util').map
3 |
4 | -- git
5 | later(function()
6 | require('mini.git').setup()
7 | map({ 'n', 'x' }, 'ga', MiniGit.show_at_cursor, 'Git show at cursor')
8 | map({ 'n', 'v' }, 'gh', MiniGit.show_range_history, 'Git show range history')
9 | map({ 'n', 'v' }, 'gd', MiniGit.show_diff_source, 'Git show diff source')
10 | end)
11 |
12 | later(function()
13 | require('mini.diff').setup()
14 | map('n', 'go', MiniDiff.toggle_overlay, 'Git toggle overlay')
15 | end)
16 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | function M.setup()
4 | for _, file in ipairs(vim.fn.readdir(vim.fn.stdpath('config') .. '/lua/plugin', [[v:val =~ '\.lua$']])) do
5 | local module = file:gsub('%.lua$', '')
6 | if module ~= 'init' then require('plugin.' .. module) end
7 | end
8 | end
9 |
10 | return M
11 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/lspconfig.lua:
--------------------------------------------------------------------------------
1 | if vim.g.vscode then return end
2 |
3 | local add, later = MiniDeps.add, MiniDeps.later
4 | local map = require('util').map
5 |
6 | -- Lspconfig related
7 | later(function()
8 | add({
9 | source = 'neovim/nvim-lspconfig',
10 | depends = {
11 | 'b0o/SchemaStore.nvim',
12 | 'mfussenegger/nvim-jdtls',
13 | 'https://gitlab.com/schrieveslaach/sonarlint.nvim',
14 | },
15 | })
16 | vim.lsp.enable({
17 | 'eslint',
18 | 'jsonls',
19 | 'lua_ls',
20 | 'vue_ls',
21 | 'ts_ls',
22 | 'yamlls',
23 | 'nixd',
24 | 'pylsp',
25 | 'texlab',
26 | 'bashls',
27 | 'cssls',
28 | 'html',
29 | 'lemminx',
30 | 'vale_ls',
31 | 'vimls',
32 | 'clangd',
33 | 'taplo',
34 | 'rust_analyzer',
35 | 'gopls',
36 | 'kulala_ls',
37 | })
38 | -- custom jdtls setup
39 | require('lsp.jdtls').setup()
40 | -- if didn't have this env, don't enable sonarlint LSP
41 | local util = require('util.lsp')
42 | local sonarlint_path = os.getenv('SONARLINT_PATH')
43 | if sonarlint_path ~= nil then
44 | require('sonarlint').setup({
45 | server = {
46 | cmd = {
47 | util.get_java_cmd(),
48 | '-jar',
49 | sonarlint_path .. '/server/sonarlint-ls.jar',
50 | -- Ensure that sonarlint-language-server uses stdio channel
51 | '-stdio',
52 | '-analyzers',
53 | -- paths to the analyzers you need, using those for python and java in this example
54 | sonarlint_path .. '/analyzers/sonarpython.jar',
55 | sonarlint_path .. '/analyzers/sonarcfamily.jar',
56 | sonarlint_path .. '/analyzers/sonarjava.jar',
57 | sonarlint_path .. '/analyzers/sonarjs.jar',
58 | sonarlint_path .. '/analyzers/sonarxml.jar',
59 | sonarlint_path .. '/analyzers/sonarhtml.jar',
60 | sonarlint_path .. '/analyzers/sonargo.jar',
61 | },
62 | },
63 | filetypes = {
64 | 'python',
65 | 'cpp',
66 | 'java',
67 | 'javascript',
68 | 'typescript',
69 | 'xml',
70 | 'go',
71 | },
72 | })
73 | end
74 | -- finally, some LSP related keymaps
75 | local function inlay_hint_toggle()
76 | vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled({ bufnr = 0 }), { bufnr = 0 })
77 | end
78 | local function list_workspace_folders() vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders())) end
79 | map({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, 'Lsp code action')
80 | map('n', 'k', vim.lsp.buf.signature_help, 'Lsp signature help')
81 | map('n', 'cw', vim.lsp.buf.add_workspace_folder, 'Lsp add workspace folder')
82 | map('n', 'cW', vim.lsp.buf.remove_workspace_folder, 'Lsp remove workspace folder')
83 | map('n', 'cR', vim.lsp.buf.rename, 'Lsp rename')
84 | map('n', 'cl', vim.diagnostic.setloclist, 'Lsp diagnostic location list')
85 | map('n', 'cI', vim.lsp.buf.incoming_calls, 'Lsp incoming calls')
86 | map('n', 'ch', vim.lsp.buf.outgoing_calls, 'Lsp outgoing calls')
87 | map('n', 'cH', inlay_hint_toggle, 'Lsp inlay hint toggle')
88 | map('n', 'cL', list_workspace_folders, 'Lsp list workspace folder')
89 | end)
90 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/motion.lua:
--------------------------------------------------------------------------------
1 | local later = MiniDeps.later
2 |
3 | later(function()
4 | local map = require('util').map
5 | require('mini.jump').setup()
6 | require('mini.jump2d').setup({ view = { dim = true } })
7 | map({ 'n', 'x', 'o' }, ';', function() MiniJump.jump(nil, false) end, 'Jump forward')
8 | map({ 'n', 'x', 'o' }, ',', function() MiniJump.jump(nil, true) end, 'Jump backward')
9 | -- Personally, I prefer using mini.jump2d's query. With it, the number of keystrokes is almost constant
10 | local function jump2d_query() MiniJump2d.start(MiniJump2d.builtin_opts.query) end
11 | map({ 'n', 'x', 'o' }, '', jump2d_query, 'Jump2d query')
12 | end)
13 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/note.lua:
--------------------------------------------------------------------------------
1 | local add, later = MiniDeps.add, MiniDeps.later
2 |
3 | -- obsidian.nvim for note-taking
4 | later(function()
5 | add('obsidian-nvim/obsidian.nvim')
6 | -- setup obsidian.nvim only when NOTE env exists
7 | local note_path = os.getenv('NOTE')
8 | if note_path ~= nil then
9 | require('obsidian').setup({
10 | workspaces = {
11 | { name = 'life', path = note_path .. '/life' },
12 | { name = 'work', path = note_path .. '/work' },
13 | },
14 | })
15 | end
16 | end)
17 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/plugin/ui.lua:
--------------------------------------------------------------------------------
1 | if vim.g.vscode then return end
2 |
3 | local now, later = MiniDeps.now, MiniDeps.later
4 | local map = require('util').map
5 |
6 | -- Starter should load immediately
7 | now(function()
8 | local starter = require('mini.starter')
9 | starter.setup({
10 | items = {
11 | starter.sections.sessions(5, true),
12 | starter.sections.recent_files(5, true, true),
13 | starter.sections.recent_files(5, false, true),
14 | {
15 | name = 'Switch',
16 | action = function() vim.cmd('Obsidian quick_switch') end,
17 | section = 'Note',
18 | },
19 | {
20 | name = 'Search',
21 | action = function() vim.cmd('Obsidian search') end,
22 | section = 'Note',
23 | },
24 | {
25 | name = 'Dailies',
26 | action = function() vim.cmd('Obsidian dailies') end,
27 | section = 'Note',
28 | },
29 | {
30 | name = 'New',
31 | action = function() vim.cmd('Obsidian new') end,
32 | section = 'Note',
33 | },
34 | starter.sections.builtin_actions(),
35 | },
36 | })
37 | end)
38 |
39 | -- Icons
40 | now(function()
41 | require('mini.icons').setup()
42 | MiniIcons.mock_nvim_web_devicons()
43 | end)
44 |
45 | -- Just use mini.notify for LSP process, because it could have lot message in the sametime
46 | -- so command line is not enough
47 | later(function()
48 | require('mini.notify').setup()
49 | map('n', 'N', MiniNotify.clear, 'Notify clear')
50 | end)
51 |
52 | -- line and indentscope
53 | now(function()
54 | require('mini.statusline').setup()
55 | require('mini.tabline').setup()
56 | require('mini.indentscope').setup({
57 | draw = {
58 | animation = require('mini.indentscope').gen_animation.none(),
59 | },
60 | })
61 | end)
62 |
63 | -- colors
64 | later(function()
65 | local hipatterns = require('mini.hipatterns')
66 | local hi_words = require('mini.extra').gen_highlighter.words
67 | hipatterns.setup({
68 | highlighters = {
69 | fixme = hi_words({ 'FIXME', 'Fixme', 'fixme' }, 'MiniHipatternsFixme'),
70 | fix = hi_words({ 'FIX', 'Fix', 'fix' }, 'MiniHipatternsFixme'),
71 | hack = hi_words({ 'HACK', 'Hack', 'hack' }, 'MiniHipatternsHack'),
72 | todo = hi_words({ 'TODO', 'Todo', 'todo' }, 'MiniHipatternsTodo'),
73 | note = hi_words({ 'NOTE', 'Note', 'note' }, 'MiniHipatternsNote'),
74 | done = hi_words({ 'DONE', 'Done', 'done' }, 'MiniHipatternsNote'),
75 | hex_color = hipatterns.gen_highlighter.hex_color(),
76 | },
77 | })
78 | end)
79 |
80 | -- clue with some custom postkeys, mostly for zl zh and dap
81 | later(function()
82 | local miniclue = require('mini.clue')
83 | local z_post_keys = { zl = 'z', zh = 'z', zL = 'z', zH = 'z' }
84 | local clue_z_keys = miniclue.gen_clues.z()
85 | for _, v in ipairs(clue_z_keys) do
86 | for key, postkeys in pairs(z_post_keys) do
87 | if v.keys == key then v.postkeys = postkeys end
88 | end
89 | end
90 | require('mini.clue').setup({
91 | triggers = {
92 | -- Leader triggers
93 | { mode = 'n', keys = '' },
94 | { mode = 'x', keys = '' },
95 | -- Built-in completion
96 | { mode = 'i', keys = '' },
97 | -- `g` key
98 | { mode = 'n', keys = 'g' },
99 | { mode = 'x', keys = 'g' },
100 | -- Marks
101 | { mode = 'n', keys = '`' },
102 | { mode = 'x', keys = '`' },
103 | -- Registers
104 | { mode = 'n', keys = '"' },
105 | { mode = 'x', keys = '"' },
106 | { mode = 'i', keys = '' },
107 | { mode = 'c', keys = '' },
108 | -- Window commands
109 | { mode = 'n', keys = '' },
110 | -- `z` key
111 | { mode = 'n', keys = 'z' },
112 | { mode = 'x', keys = 'z' },
113 | -- mini.surround
114 | { mode = 'n', keys = 's' },
115 | -- mini.bracketed
116 | { mode = 'n', keys = ']' },
117 | { mode = 'n', keys = '[' },
118 | { mode = 'n', keys = '\\' },
119 | -- Operator-pending mode key
120 | { mode = 'o', keys = 'a' },
121 | { mode = 'o', keys = 'i' },
122 | },
123 | clues = {
124 | -- Enhance this by adding descriptions for mapping groups
125 | miniclue.gen_clues.builtin_completion(),
126 | miniclue.gen_clues.g(),
127 | miniclue.gen_clues.marks(),
128 | miniclue.gen_clues.registers(),
129 | miniclue.gen_clues.windows({ submode_resize = true }),
130 | clue_z_keys,
131 | -- nvim-dap
132 | { mode = 'n', keys = 'dC', postkeys = 'd' },
133 | { mode = 'n', keys = 'do', postkeys = 'd' },
134 | { mode = 'n', keys = 'dp', postkeys = 'd' },
135 | { mode = 'n', keys = 'di', postkeys = 'd' },
136 | { mode = 'n', keys = 'dO', postkeys = 'd' },
137 | { mode = 'n', keys = 'de', postkeys = 'd' },
138 | },
139 | })
140 | end)
141 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/util/color.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | -- Setup 16 colors for terminal, otherwise some colors will looks strange.
4 | function M.setup_terminal_color(base_color)
5 | local palette = require('mini.hues').make_palette(base_color)
6 | vim.g.terminal_color_0 = palette.bg_mid2
7 | vim.g.terminal_color_1 = palette.red_mid2
8 | vim.g.terminal_color_2 = palette.green_mid2
9 | vim.g.terminal_color_3 = palette.yellow_mid2
10 | vim.g.terminal_color_4 = palette.azure_mid2
11 | vim.g.terminal_color_5 = palette.purple_mid2
12 | vim.g.terminal_color_6 = palette.cyan_mid2
13 | vim.g.terminal_color_7 = palette.fg_mid2
14 | vim.g.terminal_color_8 = palette.bg_mid
15 | vim.g.terminal_color_9 = palette.red_mid
16 | vim.g.terminal_color_10 = palette.green_mid
17 | vim.g.terminal_color_11 = palette.yellow_mid
18 | vim.g.terminal_color_12 = palette.azure_mid
19 | vim.g.terminal_color_13 = palette.purple_mid
20 | vim.g.terminal_color_14 = palette.cyan_mid
21 | vim.g.terminal_color_15 = palette.fg_mid
22 | end
23 |
24 | -- Make override highlight easier
25 | function M.override_hl(name, opts)
26 | local hl = vim.api.nvim_get_hl(0, { name = name })
27 | hl = vim.tbl_deep_extend('force', hl, opts)
28 | vim.api.nvim_set_hl(0, name, hl)
29 | end
30 |
31 | -- Some personal preferences for highlighting settings
32 | function M.setup_mini_hues_hl()
33 | vim.api.nvim_set_hl(0, '@lsp.type.interface', { link = '@interface' })
34 | vim.api.nvim_set_hl(0, '@interface', { link = '@constant' })
35 | vim.api.nvim_set_hl(0, '@lsp.type.class', { link = '@punctuation' })
36 | M.override_hl('Visual', { bold = true })
37 | M.override_hl('Comment', { italic = true })
38 | M.override_hl('DiagnosticError', { italic = true })
39 | M.override_hl('DiagnosticWarn', { italic = true })
40 | M.override_hl('DiagnosticInfo', { italic = true })
41 | M.override_hl('DiagnosticHint', { italic = true })
42 | M.override_hl('DiagnosticOk', { italic = true })
43 | end
44 |
45 | -- A wrapper for above functions
46 | function M.setup_wenvim_color(base_color)
47 | M.setup_terminal_color(base_color)
48 | M.setup_mini_hues_hl()
49 | end
50 |
51 | return M
52 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/util/init.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | -- We don't want spell, miniindentscope enable in terminal
4 | function M.setup_term_opt(_)
5 | vim.b.miniindentscope_disable = true
6 | vim.opt_local.spell = false
7 | end
8 |
9 | -- Delete all dap terminals, useful when session restored, cuz in that timing sometimes we have some dead dap terminals.
10 | function M.delete_dap_terminals()
11 | local dap_terminals_output = vim.api.nvim_exec2('filter /\\[dap-terminal\\]/ buffers', { output = true })
12 | local dap_terminals = vim.split(dap_terminals_output.output, '\n')
13 | local buffers_index = {}
14 | for _, terminal in ipairs(dap_terminals) do
15 | local buf_args = vim.split(vim.trim(terminal), ' ')
16 | local buf_index = tonumber(buf_args[1])
17 | if buf_index ~= nil then table.insert(buffers_index, buf_index) end
18 | end
19 | if #buffers_index > 0 then vim.cmd('bd! ' .. vim.fn.join(buffers_index, ' ')) end
20 | end
21 |
22 | -- Wrapper for QoL
23 | function M.keycode(key) return vim.api.nvim_replace_termcodes(key, true, true, true) end
24 |
25 | function M.feedkey(key, mode) vim.api.nvim_feedkeys(M.keycode(key), mode, true) end
26 |
27 | function M.augroup(name, opts)
28 | local final_opts = opts or { clear = true }
29 | return vim.api.nvim_create_augroup('wenvim_' .. name, final_opts)
30 | end
31 |
32 | function M.map(mode, lhs, rhs, opts)
33 | -- default options
34 | local final_opts = { noremap = true, silent = true }
35 | if type(opts) == 'string' then
36 | -- in most case we just want add some description
37 | final_opts.desc = opts
38 | elseif type(opts) == 'table' then
39 | -- other case, just take the opts
40 | final_opts = opts
41 | end
42 | vim.keymap.set(mode, lhs, rhs, final_opts)
43 | end
44 |
45 | function M.source_all()
46 | local config_bundles = vim.split(vim.fn.glob(vim.fn.stdpath('config') .. '/**/*.lua'), '\n')
47 | for _, config in pairs(config_bundles) do
48 | vim.cmd.source(config)
49 | end
50 | end
51 |
52 | function M.toggle_win_diff()
53 | if vim.wo.diff then
54 | vim.cmd('windo diffoff')
55 | else
56 | vim.cmd('windo diffthis')
57 | vim.cmd('windo set wrap')
58 | end
59 | end
60 |
61 | return M
62 |
--------------------------------------------------------------------------------
/xdg/config/nvim/lua/util/lsp.lua:
--------------------------------------------------------------------------------
1 | local M = {}
2 |
3 | function M.buf_map(bufnr)
4 | return function(mode, lhs, rhs, desc)
5 | local opts = M.make_opts({ desc = desc, buffer = bufnr })
6 | vim.keymap.set(mode, lhs, rhs, opts)
7 | end
8 | end
9 |
10 | M.opts = { noremap = true, silent = true }
11 |
12 | function M.make_opts(opts) return vim.tbl_extend('keep', opts, M.opts) end
13 |
14 | function M.setup(client, bufnr)
15 | local augroup = require('util').augroup
16 | if client.server_capabilities.documentHighlightProvider then
17 | local lsp_document_highlight = augroup('lsp_document_highlight', { clear = false })
18 | vim.api.nvim_clear_autocmds({
19 | buffer = bufnr,
20 | group = lsp_document_highlight,
21 | })
22 | vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
23 | group = lsp_document_highlight,
24 | buffer = bufnr,
25 | callback = vim.lsp.buf.document_highlight,
26 | })
27 | vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
28 | group = lsp_document_highlight,
29 | buffer = bufnr,
30 | callback = vim.lsp.buf.clear_references,
31 | })
32 | end
33 | -- inlay hint
34 | if client.supports_method('textDocument/inlayHint', { bufnr = bufnr }) then
35 | vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
36 | end
37 | if vim.fn.has("nvim-0.12") == 1 then
38 | vim.lsp.document_color.enable(true, bufnr)
39 | end
40 | -- code lens
41 | if client.supports_method('textDocument/codeLens', { bufnr = bufnr }) then
42 | vim.lsp.codelens.refresh({ bufnr = bufnr })
43 | vim.api.nvim_create_autocmd({ 'BufEnter', 'InsertLeave' }, {
44 | group = augroup('lsp_codelens'),
45 | buffer = bufnr,
46 | callback = function() vim.lsp.codelens.refresh({ bufnr = bufnr }) end,
47 | })
48 | end
49 | end
50 |
51 | function M.make_capabilities()
52 | local capabilities = vim.lsp.protocol.make_client_capabilities()
53 | return capabilities
54 | end
55 |
56 | function M.make_lspconfig(opts)
57 | local config = {
58 | capabilities = M.make_capabilities(),
59 | on_attach = function(client, bufnr) M.setup(client, bufnr) end,
60 | }
61 | if type(opts) == 'table' then config = vim.tbl_deep_extend('force', config, opts) end
62 | return config
63 | end
64 |
65 | -- notice lsp when filename changed, modified from folke snacks.nvim
66 | function M.on_rename_file(from, to)
67 | local changes = {
68 | files = { {
69 | oldUri = vim.uri_from_fname(from),
70 | newUri = vim.uri_from_fname(to),
71 | } },
72 | }
73 |
74 | local clients = vim.lsp.get_clients()
75 | for _, client in ipairs(clients) do
76 | if client.supports_method('workspace/willRenameFiles') then
77 | local resp = client.request_sync('workspace/willRenameFiles', changes, 1000, 0)
78 | if resp and resp.result ~= nil then vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding) end
79 | end
80 | end
81 |
82 | for _, client in ipairs(clients) do
83 | if client.supports_method('workspace/didRenameFiles') then client.notify('workspace/didRenameFiles', changes) end
84 | end
85 | end
86 |
87 | function M.get_java_cmd()
88 | local java_home = os.getenv('JDTLS_JAVA_HOME') or os.getenv('JAVA_21_HOME') or os.getenv('JAVA_HOME')
89 | return java_home and java_home .. '/bin/java' or 'java'
90 | end
91 |
92 | function M.java_cmd_optimize(java_cmd, custom_cmd, prefix)
93 | prefix = prefix or ''
94 | local cmd = {
95 | java_cmd or M.get_java_cmd(),
96 | -- The following 6 lines is for optimize memory use, see https://github.com/redhat-developer/vscode-java/pull/1262#discussion_r386912240
97 | prefix .. '-XX:+UseParallelGC',
98 | prefix .. '-XX:MinHeapFreeRatio=5',
99 | prefix .. '-XX:MaxHeapFreeRatio=10',
100 | prefix .. '-XX:GCTimeRatio=4',
101 | prefix .. '-XX:AdaptiveSizePolicyWeight=90',
102 | prefix .. '-Dsun.zip.disableMemoryMapping=true',
103 | }
104 | vim.list_extend(cmd, custom_cmd)
105 | return cmd
106 | end
107 |
108 | return M
109 |
--------------------------------------------------------------------------------
/xdg/config/nvim/mini-deps-snap:
--------------------------------------------------------------------------------
1 | return {
2 | ["SchemaStore.nvim"] = "386bdbf18abb6ca103495c5bdbab65e46f3c361d",
3 | VectorCode = "75f1766ee6f8b97b01fd75a29f9d1489de5d1ee8",
4 | ["codecompanion-history.nvim"] = "dce0e48cbd14d65fce64c056747c0b537968e247",
5 | ["codecompanion.nvim"] = "df4459401180612bc5b7b167eff7133324e85f1c",
6 | ["conform.nvim"] = "6feb2f28f9a9385e401857b21eeac3c1b66dd628",
7 | ["copilot.lua"] = "96e1bb1963f351700bf6737ef3695e8a0b90b12a",
8 | firenvim = "c4ab7d2aeb145cd93db8660cb134f771722f2b5e",
9 | ["friendly-snippets"] = "572f5660cf05f8cd8834e096d7b4c921ba18e175",
10 | ["grug-far.nvim"] = "7df08fff7da6ee08006fe8eaccc3407b89da368b",
11 | ["kulala.nvim"] = "b384bf96f3f64f981b13f9f9a1067c48004b9c9a",
12 | ["live-preview.nvim"] = "598672eaf91b38946626677f8e80426e6e7ceccc",
13 | ["mcphub.nvim"] = "dd569381e7d4428469b319a285c6e1d8c1ab404d",
14 | ["mini.nvim"] = "94cae4660a8b2d95dbbd56e1fbc6fcfa2716d152",
15 | neogen = "d7f9461727751fb07f82011051338a9aba07581d",
16 | ["nvim-dap"] = "f80de8ad944b1c464941cfcede597ab859060359",
17 | ["nvim-dap-python"] = "261ce649d05bc455a29f9636dc03f8cdaa7e0e2c",
18 | ["nvim-dap-virtual-text"] = "df66808cd78b5a97576bbaeee95ed5ca385a9750",
19 | ["nvim-jdtls"] = "c23f200fee469a415c77265ca55b496feb646992",
20 | ["nvim-lint"] = "fdb04e9285edefbe25a02a31a35e8fbb10fe054d",
21 | ["nvim-lspconfig"] = "7dd39252b3c4a526b99c4c218a57aca40c6f11b6",
22 | ["nvim-scissors"] = "8123690127a599b7d5669b074d572e6239222c45",
23 | ["nvim-treesitter"] = "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79",
24 | ["nvim-treesitter-context"] = "4976d8b90401cba9b85f6861e4e5a6edef2f2086",
25 | ["nvim-treesitter-textobjects"] = "15f945eabde2a293ccf48eb28c214a69b643d6e1",
26 | ["nvim-ts-autotag"] = "a1d526af391f6aebb25a8795cbc05351ed3620b5",
27 | ["obsidian.nvim"] = "ac55448f2dcd0c4161d8c6c80c21b5beb79f22b4",
28 | ["one-small-step-for-vimkind"] = "69c0dc61f2298862b3a38bdf3c4158c181cf15be",
29 | ["plenary.nvim"] = "857c5ac632080dba10aae49dba902ce3abf91b35",
30 | ["rainbow-delimiters.nvim"] = "55ad4fb76ab68460f700599b7449385f0c4e858e",
31 | sniprun = "a90c65846c3c18efc3f799d8b6dc26af9d4a69ed",
32 | ["sonarlint.nvim"] = "2aa7a9fd9d8022d1c8d472fb63ce62e021d70130",
33 | ["venn.nvim"] = "b09c2f36ddf70b498281845109bedcf08a7e0de0",
34 | ["vim-dadbod"] = "e95afed23712f969f83b4857a24cf9d59114c2e6",
35 | ["vim-dadbod-completion"] = "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6",
36 | ["vim-dadbod-ui"] = "460432301a5cb280ea265ddfa15c9f3dcd1d26b7"
37 | }
38 |
--------------------------------------------------------------------------------
/xdg/config/nvim/plugin/autocmd.lua:
--------------------------------------------------------------------------------
1 | local augroup = require('util').augroup
2 | local au = vim.api.nvim_create_autocmd
3 |
4 | -- Check if we need to reload the file when it changed
5 | au({ 'FocusGained', 'TermClose', 'TermLeave' }, {
6 | group = augroup('checktime'),
7 | callback = function()
8 | if vim.o.buftype ~= 'nofile' then vim.cmd('checktime') end
9 | end,
10 | })
11 |
12 | -- resize splits if window got resized
13 | au({ 'VimResized' }, {
14 | group = augroup('resize_splits'),
15 | callback = function()
16 | local current_tab = vim.fn.tabpagenr()
17 | vim.cmd('tabdo wincmd =')
18 | vim.cmd('tabnext ' .. current_tab)
19 | end,
20 | })
21 |
22 | -- close some filetypes with
23 | au('FileType', {
24 | group = augroup('close_with_q'),
25 | pattern = {
26 | 'PlenaryTestPopup',
27 | 'help',
28 | 'lspinfo',
29 | 'dap-float',
30 | 'dap-repl',
31 | 'man',
32 | 'notify',
33 | 'qf',
34 | 'query',
35 | 'git',
36 | 'spectre_panel',
37 | 'startuptime',
38 | 'tsplayground',
39 | 'checkhealth',
40 | 'httpResult',
41 | 'dbout',
42 | },
43 | callback = function(event)
44 | vim.bo[event.buf].buflisted = false
45 | vim.keymap.set('n', 'q', 'close', { buffer = event.buf, silent = true })
46 | end,
47 | })
48 |
49 | -- wrap vim diff buffer
50 | au({ 'VimEnter' }, {
51 | group = augroup('vim_enter'),
52 | pattern = '*',
53 | callback = function(event)
54 | if vim.o.diff then vim.wo.wrap = true end
55 | end,
56 | })
57 |
58 | -- fcitx5 auto switch to default input method
59 | if vim.fn.executable('fcitx5') == 1 then
60 | au({ 'InsertLeave' }, {
61 | group = augroup('fcitx5'),
62 | pattern = '*',
63 | callback = function() vim.cmd("silent call system('fcitx5-remote -c')") end,
64 | })
65 | end
66 |
67 | -- Copy/Paste when using wsl
68 | au('VimEnter', {
69 | group = augroup('clipboard'),
70 | callback = function()
71 | if vim.fn.has('wsl') == 1 then
72 | vim.g.clipboard = {
73 | name = 'WslClipboard',
74 | copy = {
75 | ['+'] = 'clip.exe',
76 | ['*'] = 'clip.exe',
77 | },
78 | paste = {
79 | ['+'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
80 | ['*'] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
81 | },
82 | cache_enabled = 0,
83 | }
84 | end
85 | end,
86 | })
87 |
88 | -- terminal buffer specific options
89 | au({ 'TermEnter', 'TermOpen' }, {
90 | group = augroup('terminal_buffer'),
91 | pattern = '*',
92 | callback = require('util').setup_term_opt,
93 | })
94 |
95 | -- work with bigfile that bigger then 5MB
96 | -- modified from folke snacks.nvim
97 | local bigfile_size = 5 * 1024 * 1024
98 | vim.filetype.add({
99 | pattern = {
100 | ['.*'] = {
101 | function(path, buf)
102 | return vim.bo[buf]
103 | and vim.bo[buf].filetype ~= 'bigfile'
104 | and path
105 | and vim.fn.getfsize(path) > bigfile_size
106 | and 'bigfile'
107 | or nil
108 | end,
109 | },
110 | },
111 | })
112 |
113 | au({ 'FileType' }, {
114 | group = augroup('bigfile', { clear = true }),
115 | pattern = 'bigfile',
116 | callback = function(event)
117 | local buf = event.buf
118 | local path = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(buf), ':p:~:.')
119 | local ft = vim.filetype.match({ buf = buf }) or ''
120 | vim.notify(string.format('Big file detected `%s`.', path), vim.log.levels.WARN)
121 | vim.api.nvim_buf_call(buf, function()
122 | vim.schedule(function() vim.bo[buf].syntax = ft end)
123 | end)
124 | end,
125 | })
126 |
--------------------------------------------------------------------------------
/xdg/config/nvim/plugin/keymaps.lua:
--------------------------------------------------------------------------------
1 | -- The keymaps here are independent of plugins
2 | -- all the keymap that related to plugin it self are declared after plugin
3 | local util = require('util')
4 | local map = util.map
5 | map('n', 'S', 'windo set scrollbind!', 'Scroll all buffer')
6 | map('n', 'O', 'only', 'Only')
7 | map('n', 'X', util.toggle_win_diff, 'Diffthis windowed buffers')
8 | map('n', 'R', util.source_all, 'Resource all config')
9 |
10 | -- copy/paste to system clipboard
11 | map({ 'n', 'v' }, 'y', '"+y', 'Yank to system clipboard')
12 | map('n', 'Y', '"+Y', 'Yank line to system clipboard')
13 | map({ 'n', 'v' }, '0', '"0p', 'Paste from last yank')
14 | map('n', 'p', '"+p', 'Paste from system clipboard')
15 |
16 | --keywordprg
17 | map('n', 'K', 'norm! K', 'Keywordprg')
18 | map('n', 'L', 'lopen', 'Location list')
19 | map('n', 'Q', 'copen', 'Quickfix list')
20 | map('n', ']', '!ctags', 'Ctags')
21 | if vim.g.vscode then
22 | local action = function(action, opts)
23 | return function() require('vscode-neovim').action(action, opts) end
24 | end
25 | map('n', 'K', action('editor.action.showHover'))
26 | map('n', 'gd', action('editor.action.peekDefinition'))
27 | map('n', 'gD', action('editor.action.peekDeclaration'))
28 | map('n', 'gh', action('editor.action.showDefinitionPreviewHover'))
29 | map('n', 'gi', action('editor.action.goToImplementation'))
30 | map('n', 'gI', action('editor.showIncomingCalls'))
31 | map('n', 'gO', action('editor.showOutgoingCalls'))
32 | map('n', 'gr', action('editor.action.goToReferences'))
33 | map('v', 'tt', action('translates.translates', { args = { 1 } }))
34 | map('n', 'fe', action('workbench.view.explorer'))
35 | map('n', 'ff', action('workbench.action.quickOpen'))
36 | map('n', 'fe', action('workbench.view.explorer'))
37 | map('n', 'ff', action('workbench.view.search'))
38 | map('n', 'fg', action('workbench.view.search'))
39 | map('n', 'fb', action('workbench.action.quickOpenPreviousRecentlyUsedEditor'))
40 | map('n', '[b', action('workbench.action.quickOpenPreviousRecentlyUsedEditor'))
41 | map('n', ']b', action('workbench.action.quickOpenLeastRecentlyUsedEditor'))
42 | map('n', '', action('workbench.action.terminal.toggleTerminal'))
43 | map('n', 'mm', action('editor.action.formatDocument'))
44 | map('v', 'mm', action('editor.action.formatSelection'))
45 | map({ 'n', 'v' }, 'ca', action('editor.action.quickFix'))
46 | map('n', 'x', action('workbench.action.closeActiveEditor'))
47 | end
48 |
--------------------------------------------------------------------------------
/xdg/config/nvim/plugin/options.lua:
--------------------------------------------------------------------------------
1 | local opt = vim.opt
2 |
3 | opt.breakindent = true
4 | opt.grepprg = 'rg --vimgrep'
5 | opt.grepformat = '%f:%l:%c:%m'
6 | opt.formatoptions = 'jcroqlnt'
7 | opt.linebreak = true
8 | opt.clipboard = vim.env.SSH_TTY and '' or 'unnamedplus'
9 | opt.inccommand = 'nosplit'
10 | opt.showcmd = true
11 | opt.number = true
12 | opt.signcolumn = 'yes'
13 | opt.relativenumber = true
14 | opt.cursorline = true
15 | opt.virtualedit = { 'block', 'onemore' }
16 | -- ignore filetype when file search
17 | opt.wildignore:append({
18 | '*/tmp/*',
19 | '*.so',
20 | '*.swp',
21 | '*.png',
22 | '*.jpg',
23 | '*.jpeg',
24 | '*.gif',
25 | '*.class',
26 | '*.pyc',
27 | '*.pyd',
28 | })
29 | -- code indent
30 | opt.cindent = true
31 | opt.cinoptions = { 'g0', ':0', 'N-s', '(0' }
32 | opt.smartindent = true
33 | -- tab & space
34 | opt.expandtab = true
35 | opt.tabstop = 4
36 | opt.shiftwidth = 4
37 | opt.shiftround = true
38 | opt.softtabstop = 4
39 | opt.sidescroll = 10
40 | opt.sidescrolloff = 8
41 | opt.scrolloff = 5
42 |
43 | opt.spell = true
44 | opt.spelllang = { 'en', 'cjk' }
45 | opt.spelloptions:append({ 'camel', 'noplainbuffer' })
46 |
47 | opt.list = true
48 | opt.listchars = {
49 | tab = '>-',
50 | precedes = '«',
51 | extends = '»',
52 | trail = '·',
53 | lead = '·',
54 | nbsp = '␣',
55 | conceal = '_',
56 | }
57 |
58 | opt.undofile = true
59 | opt.undolevels = 10000
60 | opt.wrap = true
61 | opt.mouse = 'a'
62 |
63 | -- search
64 | opt.ignorecase = true
65 |
66 | opt.autowrite = true
67 | opt.autowriteall = true
68 | opt.confirm = true
69 | opt.updatetime = 500
70 | opt.fileencodings:append({ 'gbk', 'cp936', 'gb2312', 'gb18030', 'big5', 'euc-jp', 'euc-kr', 'prc' })
71 | opt.termguicolors = true
72 | opt.completeopt = { 'menuone', 'noselect', 'fuzzy' }
73 | opt.pumheight = 20
74 | opt.sessionoptions:remove({ 'blank' })
75 | opt.wildmode = 'longest:full,full'
76 | opt.shortmess:append({ I = true })
77 | opt.winminwidth = 5
78 | opt.smoothscroll = true
79 | opt.winborder = 'single'
80 |
81 | opt.foldlevel = 99
82 | vim.diagnostic.config({ virtual_text = true })
83 | if vim.g.vscode then vim.notify = require('vscode-neovim').notify end
84 |
85 | if vim.fn.has('nvim-0.12') == 1 then require('vim._extui').enable({}) end
86 |
--------------------------------------------------------------------------------
/xdg/config/nvim/queries/vue/highlights.scm:
--------------------------------------------------------------------------------
1 | ((template_element) @_template_element (#set! @_template_element bo.commentstring ""))
2 |
--------------------------------------------------------------------------------
/xdg/config/nvim/readme.md:
--------------------------------------------------------------------------------
1 |
2 | # wenvim
3 | ### wenjinnn's neovim configuration
4 |
5 |
6 |
7 |
8 |
9 | # Screenshots
10 | | | | | |
11 | | :--------------: | :--------------: | :--------------: | :--------------: |
12 | |  |  |  |  |
13 | |  |  |  |  |
14 | |  |  |  |  |
15 |
16 |
17 | ## Principle and Goal
18 |
19 | * Simple, yet powerful, always on develop.
20 | * Lazy load all plugins if it could, to optimize startup time to the shortest possible time, right now on my PC, the startup time are less then 30ms.
21 | * Avoid sidebar, focus on editing. personally, I prefer to use float window, sidebar buffer just distract me a lot.
22 | * Avoid extra UI plugins. In common scenarios, [mini.notify](https://github.com/echasnovski/mini.notify) and [mini.pick](https://github.com/echasnovski/mini.pick) with `vim.ui.select()` wrapper already done well enough for notify and float window.
23 | * Provide out-of-box experience for web development.
24 | * AI powered.
25 |
26 | > [!NOTE]
27 | > * This configuration only guaranteed to be compatible with the latest stable version.
28 | > * I'm not using mason.nvim now, The LSP package should managed by you own system.
29 | > * To make [olimorris/codecompanion.nvim](https://dotfyle.com/plugins/olimorris/codecompanion.nvim) work,
30 | > you need to setup your own api key in [lua/plugin/extra.lua](lua/plugin/extra.lua#L198).
31 | > * To get all the custom keymap clue you need, just press `space`.
32 |
33 | ## Installation Instructions
34 |
35 | > Installation requires Neovim 0.10+. Always review the code before installing a configuration.
36 |
37 | Clone the repository and install the plugins:
38 |
39 | ```sh
40 | git clone git@github.com:wenjinnn/wenvim ~/.config/wenjinnn/wenvim
41 | ```
42 |
43 | Open Neovim with this config:
44 |
45 | ```sh
46 | NVIM_APPNAME=wenjinnn/wenvim nvim
47 | ```
48 |
49 | ## Special notes
50 |
51 | Some behavior are not common in this configuration, but it's reasonable in my opinion:
52 |
53 | * `` in normal mode will trigger `MiniJump2d.query()`
54 | * if you login to Copilot, `` in insert mode will accept Copilot suggestion.
55 |
56 | ## Directory notes
57 |
58 | [plugin](plugin) vim custom autocmd keymap option and more
59 |
60 | [lsp](./lsp)
61 | Custom LSP config and settings
62 |
63 | [lua/lsp](lua/lsp)
64 | Some LSP that didn't depends on neovim built-in lsp-config like jdtls
65 |
66 | [lua/plugin](lua/plugin)
67 | plugins with particular settings and keymap
68 |
69 | [lua/util](lua/util)
70 | common utils
71 |
72 | [after](after)
73 | just some filetype settings
74 |
75 | ## Defined environment variables cheatsheets:
76 |
77 | ### Dap
78 |
79 | `DAP_PROJECT_NAME` nvim-dap config for dap configuration `projectName`
80 |
81 | `DAP_HOST` nvim-dap config for setting host, most used at remote debug situations.
82 |
83 | `DAP_HOST_PORT` like above, but for host port
84 |
85 | ### Java
86 |
87 | `JAVA_HOME` fallback java home
88 |
89 | `JAVA_8_HOME` java 8 home
90 |
91 | `JAVA_17_HOME` java 17 home
92 |
93 | `JAVA_21_HOME` java 21 home
94 |
95 | `JDTLS_MAVEN_SETTINGS` jdtls maven user settings.xml path
96 |
97 | `JDTLS_JAVA_HOME` jdtls java home, if not set, fallback to `JAVA_21_HOME`
98 |
99 | `JAVA_TEST_PATH` path to [vscode-java-test](https://github.com/microsoft/vscode-java-test) jars
100 |
101 | `JAVA_DEBUG_PATH` path to [vscode-java-debug](https://github.com/microsoft/vscode-java-debug) jars
102 |
103 | `LOMBOK_PATH` path to [lombok](https://projectlombok.org/) java agent jar
104 |
105 | `JDTLS_XMX` jdtls xmx jvm arg value
106 |
107 | `JDTLS_DAP_VMARGS` jdtls dap vm args
108 |
109 |
110 | ### Sonarlint
111 | `SONARLINT_PATH` path to sonarlint language server jars
112 |
113 | ### Vue
114 |
115 | `VUE_LANGUAGE_SERVER_PATH` path to vue language server
116 |
117 | ### AI
118 |
119 | `NVIM_AI_ADAPTER` ai adapter for codecompanion.nvim, default to `ollama`
120 | `NVIM_OLLAMA_MODEL` ollama model to use for codecompanion.nvim, default to `llama3.2`
121 |
122 | ### Note taking
123 | `NOTE` note directory path for obsidian
124 |
125 | ### Must have
126 | 1. [ripgrep](https://github.com/BurntSushi/ripgrep) depend by many plugin.
127 | 2. All the LSP package that configured in [lua/lsp/init.lua](lua/lsp/init.lua), if you're going to use.
128 |
129 | ### Recommend
130 | 1. [tmux](https://github.com/tmux/tmux) for terminal multiplexing, I'm almost using it only in WSL.
131 | 2. [lazygit](https://github.com/jesseduffield/lazygit) smooth git operation.
132 |
133 | ## Main Plugins
134 |
135 | ### ai
136 |
137 | + [olimorris/codecompanion.nvim](https://dotfyle.com/plugins/olimorris/codecompanion.nvim)
138 | ### code-runner
139 |
140 | + [michaelb/sniprun](https://dotfyle.com/plugins/michaelb/sniprun)
141 | ### comment
142 |
143 | + [danymat/neogen](https://dotfyle.com/plugins/danymat/neogen)
144 | + [JoosepAlviste/nvim-ts-context-commentstring](https://dotfyle.com/plugins/JoosepAlviste/nvim-ts-context-commentstring)
145 | ### debugging
146 |
147 | + [mfussenegger/nvim-dap](https://dotfyle.com/plugins/mfussenegger/nvim-dap)
148 | + [theHamsta/nvim-dap-virtual-text](https://dotfyle.com/plugins/theHamsta/nvim-dap-virtual-text)
149 | ### editing-support
150 |
151 | + [nvim-treesitter/nvim-treesitter-context](https://dotfyle.com/plugins/nvim-treesitter/nvim-treesitter-context)
152 | + [windwp/nvim-ts-autotag](https://dotfyle.com/plugins/windwp/nvim-ts-autotag)
153 | ### formatting
154 |
155 | + [stevearc/conform.nvim](https://dotfyle.com/plugins/stevearc/conform.nvim)
156 | ### lsp
157 |
158 | + [b0o/SchemaStore.nvim](https://dotfyle.com/plugins/b0o/SchemaStore.nvim)
159 | + [mfussenegger/nvim-lint](https://dotfyle.com/plugins/mfussenegger/nvim-lint)
160 | + [mfussenegger/nvim-jdtls](https://dotfyle.com/plugins/mfussenegger/nvim-jdtls)
161 | + [neovim/nvim-lspconfig](https://dotfyle.com/plugins/neovim/nvim-lspconfig)
162 | ### markdown-and-latex
163 |
164 | + [iamcco/markdown-preview.nvim](https://dotfyle.com/plugins/iamcco/markdown-preview.nvim)
165 | ### note-taking
166 |
167 | + [nvim-orgmode/orgmode](https://dotfyle.com/plugins/nvim-orgmode/orgmode)
168 | + [chipsenkbeil/org-roam.nvim](https://dotfyle.com/plugins/chipsenkbeil/org-roam.nvim)
169 | + [jbyuki/venn.nvim](https://dotfyle.com/plugins/jbyuki/venn.nvim)
170 | ### nvim-dev
171 |
172 | + [nvim-lua/plenary.nvim](https://dotfyle.com/plugins/nvim-lua/plenary.nvim)
173 | ### search
174 |
175 | + [MagicDuck/grug-far.nvim](https://dotfyle.com/plugins/MagicDuck/grug-far.nvim)
176 | ### snippet
177 |
178 | + [rafamadriz/friendly-snippets](https://dotfyle.com/plugins/rafamadriz/friendly-snippets)
179 | + [chrisgrieser/nvim-scissors](https://dotfyle.com/plugins/chrisgrieser/nvim-scissors)
180 | ### syntax
181 |
182 | + [nvim-treesitter/nvim-treesitter-textobjects](https://dotfyle.com/plugins/nvim-treesitter/nvim-treesitter-textobjects)
183 | + [nvim-treesitter/nvim-treesitter](https://dotfyle.com/plugins/nvim-treesitter/nvim-treesitter)
184 | ### utility
185 |
186 | + [echasnovski/mini.nvim](https://dotfyle.com/plugins/echasnovski/mini.nvim)
187 | ### web-development
188 |
189 | + [mistweaverco/kulala.nvim](https://dotfyle.com/plugins/mistweaverco/kulala.nvim)
190 |
191 | Part of this readme was generated by [Dotfyle](https://dotfyle.com)
192 |
--------------------------------------------------------------------------------
/xdg/config/nvim/snippets/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "Current datetime": {
3 | "prefix": "cdtm",
4 | "body": "$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
5 | "description": "Insert current datetime (YYYY-mm-dd HH:MM:SS)"
6 | },
7 | "Current date": {
8 | "prefix": "cdate",
9 | "body": "$CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE",
10 | "description": "Insert current date (YYYY-mm-dd)"
11 | },
12 | "Current time": {
13 | "prefix": "ctime",
14 | "body": "$CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND",
15 | "description": "Insert current time (HH:MM:SS)"
16 | },
17 | "UUID": {
18 | "prefix": "uuid",
19 | "body": "$UUID",
20 | "description": "Insert a version 4 UUID"
21 | },
22 | "Random digits": {
23 | "prefix": "rd",
24 | "body": "$RANDOM",
25 | "description": "6 random Base-10 digits"
26 | },
27 | "Random hex digits": {
28 | "prefix": "rdh",
29 | "body": "$RANDOM_HEX",
30 | "description": "6 random Base-16 digits"
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/xdg/config/nvim/snippets/java.json:
--------------------------------------------------------------------------------
1 | {
2 | "log": {
3 | "body": "private static final Logger log = LoggerFactory.getLogger($1);",
4 | "prefix": "log"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/xdg/config/nvim/snippets/lua.json:
--------------------------------------------------------------------------------
1 | {
2 | "autocmd": {
3 | "body": [
4 | "vim.api.nvim_create_autocmd({ \"${1:event}\" }, {",
5 | " callback = function()",
6 | " $0",
7 | " end,",
8 | "})"
9 | ],
10 | "prefix": "autocmd"
11 | },
12 | "invscode": {
13 | "body": "if vim.g.vscode then return end",
14 | "prefix": "invscode"
15 | },
16 | "keymap": {
17 | "body": "vim.keymap.set(${1:mode}, ${2:lhs}, ${3:rhs}, $0)",
18 | "prefix": "keymap"
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/xdg/config/nvim/snippets/nix.json:
--------------------------------------------------------------------------------
1 | {}
--------------------------------------------------------------------------------
/xdg/config/nvim/snippets/package.json:
--------------------------------------------------------------------------------
1 | {"name":"my-snippets","description":"This package.json has been generated by nvim-scissors.","contributes":{"snippets":[{"path":".\/nix.json","language":["nix"]},{"path":".\/lua.json","language":["lua"]},{"path":".\/java.json","language":["java"]}]}}
--------------------------------------------------------------------------------
/xdg/config/nvim/spell/en.utf-8.add:
--------------------------------------------------------------------------------
1 | args
2 | TODO
3 | github
4 | aarch
5 | linux
6 | darwin
7 | nixos
8 | nixpkgs
9 | hostname
10 | filetype
11 | config
12 | keymap
13 | init
14 | vscode
15 | lsp
16 | substituters
17 | param
18 | DTO
19 | apache
20 | auth
21 | localhost
22 | iot
23 | neovim
24 | sql
25 | hewenjin
26 | ai
27 | stylua
28 | jdtls
29 | nvim
30 | sonarlint
31 | dap
32 | src
33 | vertx
34 | io
35 | focus_on_activate/!
36 | redis
37 | eslint
38 | fcitx
39 | BIM
40 | wenjin
41 | json
42 | linter
43 | textobject
44 | treesitter
45 | textobjects
46 | sys
47 | api
48 |
--------------------------------------------------------------------------------