mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-05-28 18:39:31 +02:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e3a17925f2 | |||
| c170e251ac | |||
| ec1747707b | |||
| 56f2abc737 | |||
| cb6f46aea8 | |||
| dfab5ddacc | |||
| 0e2faec44f | |||
| 88671c40e7 | |||
| 9f59301a0e | |||
| d13a353921 | |||
| 989989ecc6 | |||
| 0a66a3b0a3 | |||
| be036118ca | |||
| 601fcafd31 | |||
| 087d38487c | |||
| b0e481a1f1 | |||
| 1ca7607814 | |||
| 59ea29a7ab | |||
| 486a3b343c | |||
| 3b7772712e | |||
| 37b34beca4 |
@@ -47,16 +47,20 @@ gc:
|
|||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
darwin-set-proxy:
|
darwin-set-proxy:
|
||||||
sudo python3 scripts/darwin_set_proxy.py
|
echo "skip setting proxy, use global proxy instead"
|
||||||
|
# sudo python3 scripts/darwin_set_proxy.py
|
||||||
|
|
||||||
ha: darwin-set-proxy
|
ha: darwin-set-proxy
|
||||||
nix build .#darwinConfigurations.harmonica.system
|
nix build .#darwinConfigurations.harmonica.system
|
||||||
./result/sw/bin/darwin-rebuild switch --flake .
|
./result/sw/bin/darwin-rebuild switch --flake .
|
||||||
|
sleep 3
|
||||||
|
sudo chmod 644 /etc/agenix/alias-for-work.*
|
||||||
|
|
||||||
ha-debug: darwin-set-proxy
|
ha-debug: darwin-set-proxy
|
||||||
nix build .#darwinConfigurations.harmonica.system --show-trace --verbose
|
nix build .#darwinConfigurations.harmonica.system --show-trace --verbose
|
||||||
./result/sw/bin/darwin-rebuild switch --flake .#harmonica --show-trace --verbose
|
./result/sw/bin/darwin-rebuild switch --flake .#harmonica --show-trace --verbose
|
||||||
|
sleep 3
|
||||||
|
sudo chmod 644 /etc/agenix/alias-for-work.*
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -26,27 +26,29 @@ Nix allows for easy-to-manage, collaborative, reproducible deployments. This mea
|
|||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
| | NixOS(Wayland) | NixOS(Xorg) |
|
| | NixOS(Wayland) | NixOS(Xorg) |
|
||||||
| --------------------------- | :--------------------------------------------------------------------------------------------- | :------------------------------------------------------ |
|
| --------------------------- | :---------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------- |
|
||||||
| **Window Manager** | [Hyprland][Hyprland] | [i3][i3] |
|
| **Window Manager** | [Hyprland][Hyprland] | [i3][i3] |
|
||||||
| **Terminal Emulator** | [Kitty][Kitty] | [Kitty][Kitty] |
|
| **Terminal Emulator** | [Kitty][Kitty] | [Kitty][Kitty] |
|
||||||
| **Bar** | [Waybar][Waybar] | [i3block][i3block] |
|
| **Bar** | [Waybar][Waybar] | [i3block][i3block] |
|
||||||
| **Application Launcher** | [anyrun][anyrun] | [rofi][rofi] |
|
| **Application Launcher** | [anyrun][anyrun] | [rofi][rofi] |
|
||||||
| **Notification Daemon** | [Mako][Mako] | [Dunst][Dunst] |
|
| **Notification Daemon** | [Mako][Mako] | [Dunst][Dunst] |
|
||||||
| **Display Manager** | [GDM][GDM] | [GDM][GDM] |
|
| **Display Manager** | [GDM][GDM] | [GDM][GDM] |
|
||||||
| **Color Scheme** | [Catppuccin][Catppuccin] | [Catppuccin][Catppuccin] |
|
| **Color Scheme** | [Catppuccin][Catppuccin] | [Catppuccin][Catppuccin] |
|
||||||
| **network management tool** | [NetworkManager][NetworkManager] | [NetworkManager][NetworkManager] |
|
| **network management tool** | [NetworkManager][NetworkManager] | [NetworkManager][NetworkManager] |
|
||||||
| **Input method framework** | [Fcitx5][Fcitx5] | [Fcitx5][Fcitx5] |
|
| **Input method framework** | [Fcitx5][Fcitx5] | [Fcitx5][Fcitx5] |
|
||||||
| **System resource monitor** | [Btop][Btop] | [Btop][Btop] |
|
| **System resource monitor** | [Btop][Btop] | [Btop][Btop] |
|
||||||
| **File Manager** | [ranger][ranger] + [thunar][thunar] | [ranger][ranger] + [thunar][thunar] |
|
| **File Manager** | [ranger][ranger] + [thunar][thunar] | [ranger][ranger] + [thunar][thunar] |
|
||||||
| **Shell** | [Nushell][Nushell] + [Starship][Starship] | [Nushell][Nushell] + [Starship][Starship] |
|
| **Shell** | [Nushell][Nushell] + [Starship][Starship] | [Nushell][Nushell] + [Starship][Starship] |
|
||||||
| **Music Player** | [mpd][mpd], [ncmpcpp][ncmpcpp], [mpc][mpc], [Netease-cloud-music-gtk][netease-cloud-music-gtk] | [Netease-cloud-music-gtk][netease-cloud-music-gtk] |
|
| **Music Player** | [mpd][mpd], [ncmpcpp][ncmpcpp], [mpc][mpc], [Netease-cloud-music-gtk][netease-cloud-music-gtk] | [Netease-cloud-music-gtk][netease-cloud-music-gtk] |
|
||||||
| **Media Player** | [mpv][mpv] | [mpv][mpv] |
|
| **Media Player** | [mpv][mpv] | [mpv][mpv] |
|
||||||
| **Text Editor** | [Neovim][Neovim] | [Neovim][Neovim] |
|
| **Text Editor** | [Neovim][Neovim] | [Neovim][Neovim] |
|
||||||
| **Fonts** | [Nerd fonts][Nerd fonts] | [Nerd fonts][Nerd fonts] |
|
| **Fonts** | [Nerd fonts][Nerd fonts] | [Nerd fonts][Nerd fonts] |
|
||||||
| **Image Viewer** | [imv][imv] | [imv][imv] |
|
| **Image Viewer** | [imv][imv] | [imv][imv] |
|
||||||
| **Screenshot Software** | [grim][grim] | [flameshot](https://github.com/flameshot-org/flameshot) |
|
| **Screenshot Software** | [grim][grim] | [flameshot](https://github.com/flameshot-org/flameshot) |
|
||||||
| **Screen Recording** | [OBS][OBS] | [OBS][OBS] |
|
| **Screen Recording** | [OBS][OBS] | [OBS][OBS] |
|
||||||
|
| **Filesystem & Encryption** | tmpfs on `/`, [Btrfs][Btrfs] subvolumes on a [LUKS][LUKS] crypted partition for persistent, unlock via passphrase | tmpfs on `/`, [Btrfs][Btrfs] subvolumes on a [LUKS][LUKS] crypted partition for persistent, unlock via passphrase |
|
||||||
|
| **Secure Boot** | [lanzaboote][lanzaboote] | [lanzaboote][lanzaboote] |
|
||||||
|
|
||||||
Wallpapers: https://github.com/ryan4yin/wallpapers
|
Wallpapers: https://github.com/ryan4yin/wallpapers
|
||||||
|
|
||||||
@@ -69,7 +71,6 @@ See [./home/base/desktop/neovim](./home/base/desktop/neovim) for details.
|
|||||||
|
|
||||||
See [./hosts](./hosts) for details.
|
See [./hosts](./hosts) for details.
|
||||||
|
|
||||||
|
|
||||||
## Secrets Management
|
## Secrets Management
|
||||||
|
|
||||||
See [./secrets](./secrets) for details.
|
See [./secrets](./secrets) for details.
|
||||||
@@ -108,25 +109,6 @@ make i3-debug
|
|||||||
|
|
||||||
To deploy this flake from NixOS's official ISO image(purest installation method), please refer to [ryan4yin/nix-config/nixos-install](https://github.com/ryan4yin/nix-config/tree/nixos-install)
|
To deploy this flake from NixOS's official ISO image(purest installation method), please refer to [ryan4yin/nix-config/nixos-install](https://github.com/ryan4yin/nix-config/tree/nixos-install)
|
||||||
|
|
||||||
## Install Apps from Flatpak
|
|
||||||
|
|
||||||
We can install apps from flathub, which has a lot of apps that are not supported well in nixpkgs.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Add the Flathub repository
|
|
||||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
|
||||||
|
|
||||||
# install apps from flathub
|
|
||||||
flatpak install netease-cloud-music-gtk
|
|
||||||
|
|
||||||
# install 3d printer slicer - cura
|
|
||||||
flatpak install flathub com.ultimaker.cura
|
|
||||||
|
|
||||||
# or you can search apps from flathub
|
|
||||||
flatpak search <keyword>
|
|
||||||
# search on website is also supported: https://flathub.org/
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to create & managage VM from this flake?
|
## How to create & managage VM from this flake?
|
||||||
|
|
||||||
use `aquamarine` as an example, we can create a virtual machine with the following command:
|
use `aquamarine` as an example, we can create a virtual machine with the following command:
|
||||||
@@ -213,3 +195,6 @@ Other dotfiles that inspired me:
|
|||||||
[thunar]: https://gitlab.xfce.org/xfce/thunar
|
[thunar]: https://gitlab.xfce.org/xfce/thunar
|
||||||
[ranger]: https://github.com/ranger/ranger
|
[ranger]: https://github.com/ranger/ranger
|
||||||
[Catppuccin]: https://github.com/catppuccin/catppuccin
|
[Catppuccin]: https://github.com/catppuccin/catppuccin
|
||||||
|
[Btrfs]: https://btrfs.readthedocs.io
|
||||||
|
[LUKS]: https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system
|
||||||
|
[lanzaboote]: https://github.com/nix-community/lanzaboote
|
||||||
|
|||||||
Generated
+4
-4
@@ -45,16 +45,16 @@
|
|||||||
"astronvim": {
|
"astronvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1699528269,
|
"lastModified": 1701266895,
|
||||||
"narHash": "sha256-cC1isyscpvNQ07n/Eb6rlfvuQ/K+7mCjdGJq4m/PUHk=",
|
"narHash": "sha256-wttBcj9OoFHx+EukGzQYKHVlApphZXzZqY5zP5chU6g=",
|
||||||
"owner": "AstroNvim",
|
"owner": "AstroNvim",
|
||||||
"repo": "AstroNvim",
|
"repo": "AstroNvim",
|
||||||
"rev": "59d657c223038359b2b5e230805abca8d919280d",
|
"rev": "bdbc0fef3f33443251e6b45b252b98c42335b881",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "AstroNvim",
|
"owner": "AstroNvim",
|
||||||
"ref": "v3.37.12",
|
"ref": "v3.39.0",
|
||||||
"repo": "AstroNvim",
|
"repo": "AstroNvim",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -329,7 +329,7 @@
|
|||||||
|
|
||||||
# AstroNvim is an aesthetic and feature-rich neovim config.
|
# AstroNvim is an aesthetic and feature-rich neovim config.
|
||||||
astronvim = {
|
astronvim = {
|
||||||
url = "github:AstroNvim/AstroNvim/v3.37.12";
|
url = "github:AstroNvim/AstroNvim/v3.39.0";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -409,29 +409,17 @@
|
|||||||
|
|
||||||
# the nixConfig here only affects the flake itself, not the system configuration!
|
# the nixConfig here only affects the flake itself, not the system configuration!
|
||||||
nixConfig = {
|
nixConfig = {
|
||||||
substituters = [
|
# substituers will be appended to the default substituters when fetching packages
|
||||||
# cache mirror located in China
|
extra-substituters = [
|
||||||
# status: https://mirror.sjtu.edu.cn/
|
|
||||||
"https://mirror.sjtu.edu.cn/nix-channels/store"
|
|
||||||
# status: https://mirrors.ustc.edu.cn/status/
|
|
||||||
# "https://mirrors.ustc.edu.cn/nix-channels/store"
|
|
||||||
|
|
||||||
# my own cache server
|
# my own cache server
|
||||||
"https://ryan4yin.cachix.org"
|
"https://ryan4yin.cachix.org"
|
||||||
"https://anyrun.cachix.org"
|
"https://anyrun.cachix.org"
|
||||||
"https://hyprland.cachix.org"
|
"https://hyprland.cachix.org"
|
||||||
|
|
||||||
"https://cache.nixos.org"
|
|
||||||
];
|
|
||||||
|
|
||||||
# nix community's cache server
|
|
||||||
extra-substituters = [
|
|
||||||
"https://nix-community.cachix.org"
|
"https://nix-community.cachix.org"
|
||||||
"https://nixpkgs-wayland.cachix.org"
|
"https://nixpkgs-wayland.cachix.org"
|
||||||
];
|
];
|
||||||
extra-trusted-public-keys = [
|
extra-trusted-public-keys = [
|
||||||
"ryan4yin.cachix.org-1:Gbk27ZU5AYpGS9i3ssoLlwdvMIh0NxG0w8it/cv9kbU="
|
"ryan4yin.cachix.org-1:Gbk27ZU5AYpGS9i3ssoLlwdvMIh0NxG0w8it/cv9kbU="
|
||||||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
|
||||||
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
||||||
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
"nixpkgs-wayland.cachix.org-1:3lwxaILxMRkVhehr5StQprHdEo4IrE8sRho9R9HOLYA="
|
||||||
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
|
||||||
|
|||||||
@@ -16,8 +16,9 @@
|
|||||||
|
|
||||||
# aliyun
|
# aliyun
|
||||||
aliyun-cli
|
aliyun-cli
|
||||||
];
|
] ++ (if pkgs.stdenv.isLinux then [
|
||||||
|
# cloud tools that nix do not have cache for.
|
||||||
programs = {
|
terraform
|
||||||
};
|
terraformer # generate terraform configs from existing cloud resources
|
||||||
|
] else []);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,30 +8,28 @@
|
|||||||
# Basic settings for development environment
|
# Basic settings for development environment
|
||||||
#
|
#
|
||||||
# Please avoid to install language specific packages here(globally),
|
# Please avoid to install language specific packages here(globally),
|
||||||
# instead, install them independently using dev-templates:
|
# instead, install them:
|
||||||
# https://github.com/the-nix-way/dev-templates
|
# 1. per IDE, such as `programs.neovim.extraPackages`
|
||||||
|
# 2. per-project, using https://github.com/the-nix-way/dev-templates
|
||||||
#
|
#
|
||||||
#############################################################
|
#############################################################
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
pkgs-unstable.devbox
|
(python3.withPackages (
|
||||||
|
ps:
|
||||||
|
with ps; [
|
||||||
|
ipython
|
||||||
|
pandas
|
||||||
|
requests
|
||||||
|
pyquery
|
||||||
|
pyyaml
|
||||||
|
]
|
||||||
|
))
|
||||||
|
|
||||||
# DO NOT install build tools for C/C++ and others, set it per project by devShell instead
|
cargo # rust package manager
|
||||||
gnumake # used by this repo, to simplify the deployment
|
go
|
||||||
jdk17 # used to run some java based tools(.jar)
|
jdk17
|
||||||
|
guile # scheme language
|
||||||
# scheme related
|
|
||||||
guile
|
|
||||||
|
|
||||||
# python
|
|
||||||
(python311.withPackages (ps:
|
|
||||||
with ps; [
|
|
||||||
ipython
|
|
||||||
pandas
|
|
||||||
requests
|
|
||||||
pyquery
|
|
||||||
pyyaml
|
|
||||||
]))
|
|
||||||
|
|
||||||
# db related
|
# db related
|
||||||
dbeaver
|
dbeaver
|
||||||
@@ -43,11 +41,29 @@
|
|||||||
# embedded development
|
# embedded development
|
||||||
minicom
|
minicom
|
||||||
|
|
||||||
# other tools
|
# misc
|
||||||
bfg-repo-cleaner # remove large files from git history
|
pkgs-unstable.devbox
|
||||||
|
glow # markdown previewer
|
||||||
|
fzf
|
||||||
|
gdu # disk usage analyzer, required by AstroNvim
|
||||||
|
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
||||||
|
bfg-repo-cleaner # remove large files from git history
|
||||||
k6 # load testing tool
|
k6 # load testing tool
|
||||||
protobuf # protocol buffer compiler
|
protobuf # protocol buffer compiler
|
||||||
];
|
] ++ (if pkgs.stdenv.isLinux then [
|
||||||
|
# Automatically trims your branches whose tracking remote refs are merged or gone
|
||||||
|
# It's really useful when you work on a project for a long time.
|
||||||
|
git-trim
|
||||||
|
|
||||||
|
# need to run `conda-install` before using it
|
||||||
|
# need to run `conda-shell` before using command `conda`
|
||||||
|
# conda is not available for MacOS
|
||||||
|
conda
|
||||||
|
|
||||||
|
mitmproxy # http/https proxy tool
|
||||||
|
insomnia # REST client
|
||||||
|
wireshark # network analyzer
|
||||||
|
] else []);
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
direnv = {
|
direnv = {
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ return {
|
|||||||
opt = {
|
opt = {
|
||||||
relativenumber = true, -- Show relative numberline
|
relativenumber = true, -- Show relative numberline
|
||||||
signcolumn = "auto", -- Show sign column when used only
|
signcolumn = "auto", -- Show sign column when used only
|
||||||
spell = false, -- Spell checking
|
spell = false, -- Spell checking
|
||||||
swapfile = false, -- Swapfile
|
swapfile = false, -- Swapfile
|
||||||
smartindent = false; -- fix https://github.com/ryan4yin/nix-config/issues/4
|
smartindent = false, -- fix https://github.com/ryan4yin/nix-config/issues/4
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -24,7 +24,6 @@ return {
|
|||||||
{ import = "astrocommunity.motion.leap-nvim" },
|
{ import = "astrocommunity.motion.leap-nvim" },
|
||||||
{ import = "astrocommunity.motion.flit-nvim" },
|
{ import = "astrocommunity.motion.flit-nvim" },
|
||||||
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
|
{ import = "astrocommunity.scrolling.nvim-scrollbar" },
|
||||||
{ import = "astrocommunity.editing-support.auto-save-nvim" },
|
|
||||||
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
|
{ import = "astrocommunity.editing-support.todo-comments-nvim" },
|
||||||
-- Language Support
|
-- Language Support
|
||||||
---- Frontend & NodeJS
|
---- Frontend & NodeJS
|
||||||
@@ -57,7 +56,7 @@ return {
|
|||||||
-- https://github.com/echasnovski/mini.ai
|
-- https://github.com/echasnovski/mini.ai
|
||||||
{ import = "astrocommunity.motion.mini-ai" },
|
{ import = "astrocommunity.motion.mini-ai" },
|
||||||
{ import = "astrocommunity.motion.flash-nvim" },
|
{ import = "astrocommunity.motion.flash-nvim" },
|
||||||
{ "folke/flash.nvim", vscode = false },
|
{ "folke/flash.nvim", vscode = false },
|
||||||
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
|
-- Lua implementation of CamelCaseMotion, with extra consideration of punctuation.
|
||||||
{ import = "astrocommunity.motion.nvim-spider" },
|
{ import = "astrocommunity.motion.nvim-spider" },
|
||||||
-- AI Assistant
|
-- AI Assistant
|
||||||
@@ -67,22 +66,31 @@ return {
|
|||||||
"zbirenbaum/copilot.lua",
|
"zbirenbaum/copilot.lua",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
opts.filetypes = {
|
opts.filetypes = {
|
||||||
yaml = true;
|
yaml = true,
|
||||||
markdown = true,
|
markdown = true,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"0x00-ketsu/autosave.nvim",
|
||||||
|
-- lazy-loading on events
|
||||||
|
event = { "InsertLeave", "TextChanged" },
|
||||||
|
opts = function(_, opts)
|
||||||
|
opts.prompt_style = "notify" -- or stdout
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
-- markdown preview
|
-- markdown preview
|
||||||
{
|
{
|
||||||
'0x00-ketsu/markdown-preview.nvim',
|
"0x00-ketsu/markdown-preview.nvim",
|
||||||
ft = {'md', 'markdown', 'mkd', 'mkdn', 'mdwn', 'mdown', 'mdtxt', 'mdtext', 'rmd', 'wiki'},
|
ft = { "md", "markdown", "mkd", "mkdn", "mdwn", "mdown", "mdtxt", "mdtext", "rmd", "wiki" },
|
||||||
config = function()
|
config = function()
|
||||||
require('markdown-preview').setup {
|
require("markdown-preview").setup({
|
||||||
-- your configuration comes here
|
-- your configuration comes here
|
||||||
-- or leave it empty to use the default settings
|
-- or leave it empty to use the default settings
|
||||||
-- refer to the setup section below
|
-- refer to the setup section below
|
||||||
}
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -90,7 +98,7 @@ return {
|
|||||||
{
|
{
|
||||||
"gbprod/yanky.nvim",
|
"gbprod/yanky.nvim",
|
||||||
opts = function()
|
opts = function()
|
||||||
local mapping = require "yanky.telescope.mapping"
|
local mapping = require("yanky.telescope.mapping")
|
||||||
local mappings = mapping.get_defaults()
|
local mappings = mapping.get_defaults()
|
||||||
mappings.i["<c-p>"] = nil
|
mappings.i["<c-p>"] = nil
|
||||||
return {
|
return {
|
||||||
@@ -104,23 +112,48 @@ return {
|
|||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
{ "y", "<Plug>(YankyYank)", mode = { "n", "x" }, desc = "Yank text" },
|
{
|
||||||
{ "p", "<Plug>(YankyPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after cursor" },
|
"y",
|
||||||
{ "P", "<Plug>(YankyPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before cursor" },
|
"<Plug>(YankyYank)",
|
||||||
{ "gp", "<Plug>(YankyGPutAfter)", mode = { "n", "x" }, desc = "Put yanked text after selection" },
|
mode = { "n", "x" },
|
||||||
{ "gP", "<Plug>(YankyGPutBefore)", mode = { "n", "x" }, desc = "Put yanked text before selection" },
|
desc = "Yank text",
|
||||||
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle forward through yank history" },
|
},
|
||||||
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle backward through yank history" },
|
{
|
||||||
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
"p",
|
||||||
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
"<Plug>(YankyPutAfter)",
|
||||||
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
mode = { "n", "x" },
|
||||||
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
desc = "Put yanked text after cursor",
|
||||||
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" },
|
},
|
||||||
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" },
|
{
|
||||||
|
"P",
|
||||||
|
"<Plug>(YankyPutBefore)",
|
||||||
|
mode = { "n", "x" },
|
||||||
|
desc = "Put yanked text before cursor",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gp",
|
||||||
|
"<Plug>(YankyGPutAfter)",
|
||||||
|
mode = { "n", "x" },
|
||||||
|
desc = "Put yanked text after selection",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"gP",
|
||||||
|
"<Plug>(YankyGPutBefore)",
|
||||||
|
mode = { "n", "x" },
|
||||||
|
desc = "Put yanked text before selection",
|
||||||
|
},
|
||||||
|
{ "[y", "<Plug>(YankyCycleForward)", desc = "Cycle forward through yank history" },
|
||||||
|
{ "]y", "<Plug>(YankyCycleBackward)", desc = "Cycle backward through yank history" },
|
||||||
|
{ "]p", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||||
|
{ "[p", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||||
|
{ "]P", "<Plug>(YankyPutIndentAfterLinewise)", desc = "Put indented after cursor (linewise)" },
|
||||||
|
{ "[P", "<Plug>(YankyPutIndentBeforeLinewise)", desc = "Put indented before cursor (linewise)" },
|
||||||
|
{ ">p", "<Plug>(YankyPutIndentAfterShiftRight)", desc = "Put and indent right" },
|
||||||
|
{ "<p", "<Plug>(YankyPutIndentAfterShiftLeft)", desc = "Put and indent left" },
|
||||||
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
|
{ ">P", "<Plug>(YankyPutIndentBeforeShiftRight)", desc = "Put before and indent right" },
|
||||||
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
|
{ "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)", desc = "Put before and indent left" },
|
||||||
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
|
{ "=p", "<Plug>(YankyPutAfterFilter)", desc = "Put after applying a filter" },
|
||||||
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
|
{ "=P", "<Plug>(YankyPutBeforeFilter)", desc = "Put before applying a filter" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -140,11 +173,12 @@ return {
|
|||||||
|
|
||||||
-- joining blocks of code into oneline, or splitting one line into multiple lines.
|
-- joining blocks of code into oneline, or splitting one line into multiple lines.
|
||||||
{
|
{
|
||||||
'Wansmer/treesj',
|
"Wansmer/treesj",
|
||||||
keys = { '<space>m', '<space>j', '<space>s' },
|
keys = { "<space>m", "<space>j", "<space>s" },
|
||||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||||
config = function()
|
config = function()
|
||||||
require('treesj').setup({--[[ your config ]]})
|
require("treesj").setup({ --[[ your config ]]
|
||||||
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -154,31 +188,31 @@ return {
|
|||||||
opts = {
|
opts = {
|
||||||
filesystem = {
|
filesystem = {
|
||||||
filtered_items = {
|
filtered_items = {
|
||||||
visible = true, -- visible by default
|
visible = true, -- visible by default
|
||||||
hide_dotfiles = false,
|
hide_dotfiles = false,
|
||||||
hide_gitignored = false,
|
hide_gitignored = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
-- The plugin offers the alibity to refactor code.
|
-- The plugin offers the alibity to refactor code.
|
||||||
{
|
{
|
||||||
"ThePrimeagen/refactoring.nvim",
|
"ThePrimeagen/refactoring.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{"nvim-lua/plenary.nvim"},
|
{ "nvim-lua/plenary.nvim" },
|
||||||
{"nvim-treesitter/nvim-treesitter"}
|
{ "nvim-treesitter/nvim-treesitter" },
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
-- The plugin offers the abilibty to search and replace.
|
-- The plugin offers the abilibty to search and replace.
|
||||||
{
|
{
|
||||||
"nvim-pack/nvim-spectre",
|
"nvim-pack/nvim-spectre",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{"nvim-lua/plenary.nvim"},
|
{ "nvim-lua/plenary.nvim" },
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- full signature help, docs and completion for the nvim lua API.
|
-- full signature help, docs and completion for the nvim lua API.
|
||||||
{ "folke/neodev.nvim", opts = {} },
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
|
|
||||||
{ "RRethy/vim-illuminate", config = function() end },
|
{ "RRethy/vim-illuminate", config = function() end },
|
||||||
|
|
||||||
@@ -186,14 +220,14 @@ return {
|
|||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local utils = require "astronvim.utils";
|
local utils = require("astronvim.utils")
|
||||||
opts.incremental_selection = {
|
opts.incremental_selection = {
|
||||||
enable = true,
|
enable = true,
|
||||||
keymaps = {
|
keymaps = {
|
||||||
init_selection = "<C-space>", -- Ctrl + Space
|
init_selection = "<C-space>", -- Ctrl + Space
|
||||||
node_incremental = "<C-space>",
|
node_incremental = "<C-space>",
|
||||||
scope_incremental = "<A-space>", -- Alt + Space
|
scope_incremental = "<A-space>", -- Alt + Space
|
||||||
node_decremental = "<bs>", -- Backspace
|
node_decremental = "<bs>", -- Backspace
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, {
|
opts.ensure_installed = utils.list_insert_unique(opts.ensure_installed, {
|
||||||
@@ -213,14 +247,14 @@ return {
|
|||||||
|
|
||||||
-- implementation/definition preview
|
-- implementation/definition preview
|
||||||
{
|
{
|
||||||
'rmagatti/goto-preview',
|
"rmagatti/goto-preview",
|
||||||
config = function()
|
config = function()
|
||||||
require('goto-preview').setup {}
|
require("goto-preview").setup({})
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Undo tree
|
-- Undo tree
|
||||||
{ "debugloop/telescope-undo.nvim", },
|
{ "debugloop/telescope-undo.nvim" },
|
||||||
|
|
||||||
-- Install lsp, formmatter and others via home manager instead of Mason.nvim
|
-- Install lsp, formmatter and others via home manager instead of Mason.nvim
|
||||||
-- LSP installations
|
-- LSP installations
|
||||||
@@ -245,7 +279,7 @@ return {
|
|||||||
{
|
{
|
||||||
"jose-elias-alvarez/null-ls.nvim",
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
opts = function(_, opts)
|
opts = function(_, opts)
|
||||||
local null_ls = require "null-ls"
|
local null_ls = require("null-ls")
|
||||||
local code_actions = null_ls.builtins.code_actions
|
local code_actions = null_ls.builtins.code_actions
|
||||||
local diagnostics = null_ls.builtins.diagnostics
|
local diagnostics = null_ls.builtins.diagnostics
|
||||||
local formatting = null_ls.builtins.formatting
|
local formatting = null_ls.builtins.formatting
|
||||||
@@ -258,34 +292,34 @@ return {
|
|||||||
code_actions.gitsigns,
|
code_actions.gitsigns,
|
||||||
-- common refactoring actions based off the Refactoring book by Martin Fowler
|
-- common refactoring actions based off the Refactoring book by Martin Fowler
|
||||||
code_actions.refactoring,
|
code_actions.refactoring,
|
||||||
code_actions.gomodifytags, -- Go - modify struct field tags
|
code_actions.gomodifytags, -- Go - modify struct field tags
|
||||||
code_actions.impl, -- Go - generate interface method stubs
|
code_actions.impl, -- Go - generate interface method stubs
|
||||||
code_actions.shellcheck,
|
code_actions.shellcheck,
|
||||||
code_actions.proselint, -- English prose linter
|
code_actions.proselint, -- English prose linter
|
||||||
code_actions.statix, -- Lints and suggestions for Nix.
|
code_actions.statix, -- Lints and suggestions for Nix.
|
||||||
|
|
||||||
-- Diagnostic
|
-- Diagnostic
|
||||||
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
|
diagnostics.actionlint, -- GitHub Actions workflow syntax checking
|
||||||
diagnostics.buf, -- check text in current buffer
|
diagnostics.buf, -- check text in current buffer
|
||||||
diagnostics.checkmake, -- check Makefiles
|
diagnostics.checkmake, -- check Makefiles
|
||||||
diagnostics.deadnix, -- Scan Nix files for dead code.
|
diagnostics.deadnix, -- Scan Nix files for dead code.
|
||||||
|
|
||||||
-- Formatting
|
-- Formatting
|
||||||
formatting.prettier, -- js/ts/vue/css/html/json/... formatter
|
formatting.prettier, -- js/ts/vue/css/html/json/... formatter
|
||||||
diagnostics.hadolint, -- Dockerfile linter
|
diagnostics.hadolint, -- Dockerfile linter
|
||||||
formatting.black, -- Python formatter
|
formatting.black, -- Python formatter
|
||||||
formatting.ruff, -- extremely fast Python linter
|
formatting.ruff, -- extremely fast Python linter
|
||||||
formatting.goimports, -- Go formatter
|
formatting.goimports, -- Go formatter
|
||||||
formatting.shfmt, -- Shell formatter
|
formatting.shfmt, -- Shell formatter
|
||||||
formatting.rustfmt, -- Rust formatter
|
formatting.rustfmt, -- Rust formatter
|
||||||
formatting.taplo, -- TOML formatteautoindentr
|
formatting.taplo, -- TOML formatteautoindentr
|
||||||
formatting.terraform_fmt, -- Terraform formatter
|
formatting.terraform_fmt, -- Terraform formatter
|
||||||
formatting.stylua, -- Lua formatter
|
formatting.stylua, -- Lua formatter
|
||||||
formatting.alejandra, -- Nix formatter
|
formatting.alejandra, -- Nix formatter
|
||||||
formatting.sqlfluff.with({ -- SQL formatter
|
formatting.sqlfluff.with({ -- SQL formatter
|
||||||
extra_args = { "--dialect", "postgres" }, -- change to your dialect
|
extra_args = { "--dialect", "postgres" }, -- change to your dialect
|
||||||
}),
|
}),
|
||||||
formatting.nginx_beautifier, -- Nginx formatter
|
formatting.nginx_beautifier, -- Nginx formatter
|
||||||
null_ls.builtins.formatting.verible_verilog_format, -- Verilog formatter
|
null_ls.builtins.formatting.verible_verilog_format, -- Verilog formatter
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -302,8 +336,9 @@ return {
|
|||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
'nvim-telescope/telescope.nvim', branch = '0.1.x',
|
"nvim-telescope/telescope.nvim",
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
branch = "0.1.x",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
init = function()
|
init = function()
|
||||||
-- 1. Disable highlighting for certain filetypes
|
-- 1. Disable highlighting for certain filetypes
|
||||||
-- 2. Ignore files larger than a certain filesize
|
-- 2. Ignore files larger than a certain filesize
|
||||||
@@ -322,7 +357,9 @@ return {
|
|||||||
|
|
||||||
local new_maker = function(filepath, bufnr, opts)
|
local new_maker = function(filepath, bufnr, opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
if opts.use_ft_detect == nil then opts.use_ft_detect = true end
|
if opts.use_ft_detect == nil then
|
||||||
|
opts.use_ft_detect = true
|
||||||
|
end
|
||||||
|
|
||||||
-- 1. Check if the file is in the bad_files array, and if so, don't highlight it
|
-- 1. Check if the file is in the bad_files array, and if so, don't highlight it
|
||||||
opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath)
|
opts.use_ft_detect = opts.use_ft_detect == false and false or bad_files(filepath)
|
||||||
@@ -330,7 +367,9 @@ return {
|
|||||||
-- 2. Check the file size, and ignore it if it's too big(preview nothing).
|
-- 2. Check the file size, and ignore it if it's too big(preview nothing).
|
||||||
filepath = vim.fn.expand(filepath)
|
filepath = vim.fn.expand(filepath)
|
||||||
vim.loop.fs_stat(filepath, function(_, stat)
|
vim.loop.fs_stat(filepath, function(_, stat)
|
||||||
if not stat then return end
|
if not stat then
|
||||||
|
return
|
||||||
|
end
|
||||||
if stat.size > filesize_threshold then
|
if stat.size > filesize_threshold then
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
@@ -339,13 +378,13 @@ return {
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
require("telescope").setup {
|
require("telescope").setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
buffer_previewer_maker = new_maker,
|
buffer_previewer_maker = new_maker,
|
||||||
}
|
},
|
||||||
}
|
})
|
||||||
end,
|
end,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Configure require("lazy").setup() options
|
-- Configure require("lazy").setup() options
|
||||||
@@ -354,7 +393,7 @@ return {
|
|||||||
performance = {
|
performance = {
|
||||||
rtp = {
|
rtp = {
|
||||||
-- customize default disabled vim plugins
|
-- customize default disabled vim plugins
|
||||||
disabled_plugins = { };
|
disabled_plugins = {},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -373,36 +412,36 @@ return {
|
|||||||
-- enable servers that installed by home-manager instead of mason
|
-- enable servers that installed by home-manager instead of mason
|
||||||
servers = {
|
servers = {
|
||||||
---- Frontend & NodeJS
|
---- Frontend & NodeJS
|
||||||
"tsserver", -- typescript/javascript language server
|
"tsserver", -- typescript/javascript language server
|
||||||
"tailwindcss", -- tailwindcss language server
|
"tailwindcss", -- tailwindcss language server
|
||||||
"html", -- html language server
|
"html", -- html language server
|
||||||
"cssls", -- css language server
|
"cssls", -- css language server
|
||||||
"prismals", -- prisma language server
|
"prismals", -- prisma language server
|
||||||
"volar", -- vue language server
|
"volar", -- vue language server
|
||||||
---- Configuration Language
|
---- Configuration Language
|
||||||
"marksman", -- markdown ls
|
"marksman", -- markdown ls
|
||||||
"jsonls", -- json language server
|
"jsonls", -- json language server
|
||||||
"yamlls", -- yaml language server
|
"yamlls", -- yaml language server
|
||||||
"taplo", -- toml language server
|
"taplo", -- toml language server
|
||||||
---- Backend
|
---- Backend
|
||||||
"lua_ls", -- lua
|
"lua_ls", -- lua
|
||||||
"gopls", -- go
|
"gopls", -- go
|
||||||
"rust_analyzer", -- rust
|
"rust_analyzer", -- rust
|
||||||
"pyright", -- python
|
"pyright", -- python
|
||||||
"ruff_lsp", -- extremely fast Python linter and code transformation
|
"ruff_lsp", -- extremely fast Python linter and code transformation
|
||||||
"jdtls", -- java
|
"jdtls", -- java
|
||||||
"nil_ls", -- nix language server
|
"nil_ls", -- nix language server
|
||||||
"bufls", -- protocol buffer language server
|
"bufls", -- protocol buffer language server
|
||||||
"zls", -- zig language server
|
"zls", -- zig language server
|
||||||
---- HDL
|
---- HDL
|
||||||
"verible", -- verilog language server
|
"verible", -- verilog language server
|
||||||
---- Operation & Cloud Nativautoindente
|
---- Operation & Cloud Nativautoindente
|
||||||
"bashls", -- bash
|
"bashls", -- bash
|
||||||
"cmake", -- cmake language server
|
"cmake", -- cmake language server
|
||||||
"clangd", -- c/c++
|
"clangd", -- c/c++
|
||||||
"dockerls", -- dockerfile
|
"dockerls", -- dockerfile
|
||||||
"jsonnet_ls", -- jsonnet language server
|
"jsonnet_ls", -- jsonnet language server
|
||||||
"terraformls", -- terraform hcl
|
"terraformls", -- terraform hcl
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
disabled = {},
|
disabled = {},
|
||||||
|
|||||||
@@ -17,7 +17,12 @@ return {
|
|||||||
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
["<leader>bn"] = { "<cmd>tabnew<cr>", desc = "New tab" },
|
||||||
-- quick save
|
-- quick save
|
||||||
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
|
||||||
["<leader>tp"] = { function() utils.toggle_term_cmd("ipython") end, desc = "ToggleTerm python" },
|
|
||||||
|
-- Terminal
|
||||||
|
-- NOTE: https://neovim.io/doc/user/builtin.html#jobstart()
|
||||||
|
-- 1. If {cmd} is a List it runs directly (no 'shell')
|
||||||
|
-- 2. If {cmd} is a String it runs in the 'shell'
|
||||||
|
["<leader>tp"] = { function() utils.toggle_term_cmd({ cmd = "ipython" }) end, desc = "ToggleTerm python" },
|
||||||
|
|
||||||
-- search and replace globally
|
-- search and replace globally
|
||||||
['<leader>ss'] = {'<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" },
|
['<leader>ss'] = {'<cmd>lua require("spectre").toggle()<CR>', desc = "Toggle Spectre" },
|
||||||
|
|||||||
@@ -27,114 +27,130 @@
|
|||||||
programs = {
|
programs = {
|
||||||
neovim = {
|
neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
defaultEditor = true;
|
defaultEditor = true;
|
||||||
|
viAlias = true;
|
||||||
viAlias = false;
|
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
|
|
||||||
withPython3 = true;
|
|
||||||
withNodeJs = true;
|
|
||||||
extraPackages = with pkgs; [];
|
|
||||||
|
|
||||||
# currently we use lazy.nvim as neovim's package manager, so comment this one.
|
# currently we use lazy.nvim as neovim's package manager, so comment this one.
|
||||||
# plugins = with pkgs.vimPlugins; [
|
# plugins = with pkgs.vimPlugins; [
|
||||||
# # search all the plugins using https://search.nixos.org/packages
|
# # search all the plugins using https://search.nixos.org/packages
|
||||||
# ];
|
# ];
|
||||||
|
|
||||||
|
# Extra packages only available to nvim(won't pollute the global home environment)
|
||||||
|
extraPackages = with pkgs;
|
||||||
|
[
|
||||||
|
#-- c/c++
|
||||||
|
cmake
|
||||||
|
cmake-language-server
|
||||||
|
gnumake
|
||||||
|
checkmake
|
||||||
|
gcc # c/c++ compiler, required by nvim-treesitter!
|
||||||
|
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
|
||||||
|
gdb
|
||||||
|
lldb
|
||||||
|
|
||||||
|
#-- python
|
||||||
|
nodePackages.pyright # python language server
|
||||||
|
python3Packages.black # python formatter
|
||||||
|
python3Packages.ruff-lsp
|
||||||
|
(python3.withPackages (
|
||||||
|
ps:
|
||||||
|
with ps; [
|
||||||
|
pynvim # Python client and plugin host for Nvim
|
||||||
|
|
||||||
|
ipython
|
||||||
|
pandas
|
||||||
|
requests
|
||||||
|
pyquery
|
||||||
|
pyyaml
|
||||||
|
]
|
||||||
|
))
|
||||||
|
|
||||||
|
#-- rust
|
||||||
|
rust-analyzer
|
||||||
|
cargo # rust package manager
|
||||||
|
rustfmt
|
||||||
|
|
||||||
|
#-- zig
|
||||||
|
zls
|
||||||
|
|
||||||
|
#-- nix
|
||||||
|
nil
|
||||||
|
rnix-lsp
|
||||||
|
# nixd
|
||||||
|
statix # Lints and suggestions for the nix programming language
|
||||||
|
deadnix # Find and remove unused code in .nix source files
|
||||||
|
alejandra # Nix Code Formatter
|
||||||
|
|
||||||
|
#-- golang
|
||||||
|
go
|
||||||
|
gomodifytags
|
||||||
|
iferr # generate error handling code for go
|
||||||
|
impl # generate function implementation for go
|
||||||
|
gotools # contains tools like: godoc, goimports, etc.
|
||||||
|
gopls # go language server
|
||||||
|
delve # go debugger
|
||||||
|
|
||||||
|
# -- java
|
||||||
|
jdk17
|
||||||
|
gradle
|
||||||
|
maven
|
||||||
|
spring-boot-cli
|
||||||
|
|
||||||
|
#-- lua
|
||||||
|
stylua
|
||||||
|
lua-language-server
|
||||||
|
|
||||||
|
#-- bash
|
||||||
|
nodePackages.bash-language-server
|
||||||
|
shellcheck
|
||||||
|
shfmt
|
||||||
|
|
||||||
|
#-- javascript/typescript --#
|
||||||
|
nodePackages.nodejs
|
||||||
|
nodePackages.typescript
|
||||||
|
nodePackages.typescript-language-server
|
||||||
|
# HTML/CSS/JSON/ESLint language servers extracted from vscode
|
||||||
|
nodePackages.vscode-langservers-extracted
|
||||||
|
nodePackages."@tailwindcss/language-server"
|
||||||
|
|
||||||
|
#-- CloudNative
|
||||||
|
nodePackages.dockerfile-language-server-nodejs
|
||||||
|
# terraform # install via brew on macOS
|
||||||
|
terraform-ls
|
||||||
|
jsonnet
|
||||||
|
jsonnet-language-server
|
||||||
|
hadolint # Dockerfile linter
|
||||||
|
|
||||||
|
#-- Others
|
||||||
|
taplo # TOML language server / formatter / validator
|
||||||
|
nodePackages.yaml-language-server
|
||||||
|
sqlfluff # SQL linter
|
||||||
|
actionlint # GitHub Actions linter
|
||||||
|
buf # protoc plugin for linting and formatting
|
||||||
|
proselint # English prose linter
|
||||||
|
guile # scheme language
|
||||||
|
|
||||||
|
#-- Misc
|
||||||
|
tree-sitter # common language parser/highlighter
|
||||||
|
nodePackages.prettier # common code formatter
|
||||||
|
marksman # language server for markdown
|
||||||
|
glow # markdown previewer
|
||||||
|
fzf
|
||||||
|
|
||||||
|
#-- Optional Requirements:
|
||||||
|
gdu # disk usage analyzer, required by AstroNvim
|
||||||
|
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
||||||
|
]
|
||||||
|
++ (
|
||||||
|
if pkgs.stdenv.isDarwin
|
||||||
|
then []
|
||||||
|
else [
|
||||||
|
#-- verilog / systemverilog
|
||||||
|
verible
|
||||||
|
]
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
home = {
|
|
||||||
packages = with pkgs;
|
|
||||||
[
|
|
||||||
#-- c/c++
|
|
||||||
cmake
|
|
||||||
cmake-language-server
|
|
||||||
gnumake
|
|
||||||
checkmake
|
|
||||||
gcc # c/c++ compiler, required by nvim-treesitter!
|
|
||||||
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
|
|
||||||
gdb
|
|
||||||
# lldb # TODO - fix python3.11's package conflict - six.py
|
|
||||||
|
|
||||||
#-- python
|
|
||||||
nodePackages.pyright # python language server
|
|
||||||
python311Packages.black # python formatter
|
|
||||||
python311Packages.ruff-lsp
|
|
||||||
|
|
||||||
#-- rust
|
|
||||||
rust-analyzer
|
|
||||||
cargo # rust package manager
|
|
||||||
rustfmt
|
|
||||||
|
|
||||||
#-- zig
|
|
||||||
zls
|
|
||||||
|
|
||||||
#-- nix
|
|
||||||
nil
|
|
||||||
rnix-lsp
|
|
||||||
# nixd
|
|
||||||
statix # Lints and suggestions for the nix programming language
|
|
||||||
deadnix # Find and remove unused code in .nix source files
|
|
||||||
alejandra # Nix Code Formatter
|
|
||||||
|
|
||||||
#-- golang
|
|
||||||
go
|
|
||||||
gomodifytags
|
|
||||||
iferr # generate error handling code for go
|
|
||||||
impl # generate function implementation for go
|
|
||||||
gotools # contains tools like: godoc, goimports, etc.
|
|
||||||
gopls # go language server
|
|
||||||
delve # go debugger
|
|
||||||
|
|
||||||
#-- lua
|
|
||||||
stylua
|
|
||||||
lua-language-server
|
|
||||||
|
|
||||||
#-- bash
|
|
||||||
nodePackages.bash-language-server
|
|
||||||
shellcheck
|
|
||||||
shfmt
|
|
||||||
|
|
||||||
#-- javascript/typescript --#
|
|
||||||
nodePackages.typescript
|
|
||||||
nodePackages.typescript-language-server
|
|
||||||
# HTML/CSS/JSON/ESLint language servers extracted from vscode
|
|
||||||
nodePackages.vscode-langservers-extracted
|
|
||||||
nodePackages."@tailwindcss/language-server"
|
|
||||||
|
|
||||||
#-- CloudNative
|
|
||||||
nodePackages.dockerfile-language-server-nodejs
|
|
||||||
# terraform # install via brew on macOS
|
|
||||||
terraform-ls
|
|
||||||
jsonnet
|
|
||||||
jsonnet-language-server
|
|
||||||
hadolint # Dockerfile linter
|
|
||||||
|
|
||||||
#-- Others
|
|
||||||
taplo # TOML language server / formatter / validator
|
|
||||||
nodePackages.yaml-language-server
|
|
||||||
sqlfluff # SQL linter
|
|
||||||
actionlint # GitHub Actions linter
|
|
||||||
buf # protoc plugin for linting and formatting
|
|
||||||
proselint # English prose linter
|
|
||||||
|
|
||||||
#-- Misc
|
|
||||||
tree-sitter # common language parser/highlighter
|
|
||||||
nodePackages.prettier # common code formatter
|
|
||||||
marksman # language server for markdown
|
|
||||||
glow # markdown previewer
|
|
||||||
fzf
|
|
||||||
|
|
||||||
#-- Optional Requirements:
|
|
||||||
gdu # disk usage analyzer, required by AstroNvim
|
|
||||||
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
|
|
||||||
]
|
|
||||||
++ (
|
|
||||||
if pkgs.stdenv.isDarwin
|
|
||||||
then []
|
|
||||||
else [
|
|
||||||
#-- verilog / systemverilog
|
|
||||||
verible
|
|
||||||
]
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,3 +5,57 @@
|
|||||||
3. alacritty: Standby terminal.
|
3. alacritty: Standby terminal.
|
||||||
|
|
||||||
|
|
||||||
|
## 'xterm-kitty': unknown terminal type when `ssh` into a remote host or `sudo xxx`
|
||||||
|
|
||||||
|
> https://sw.kovidgoyal.net/kitty/faq/#i-get-errors-about-the-terminal-being-unknown-or-opening-the-terminal-failing-or-functional-keys-like-arrow-keys-don-t-work
|
||||||
|
|
||||||
|
> https://wezfurlong.org/wezterm/config/lua/config/term.html
|
||||||
|
|
||||||
|
kitty set `TERM` to `xterm-kitty` by default, and TUI apps like `viu`, `yazi`, `curses` will try to search in the host's [terminfo(terminal capability data base)](https://linux.die.net/man/5/terminfo) for value of `TERM` to determine the capabilities of the terminal.
|
||||||
|
|
||||||
|
But when you `ssh` into a remote host, the remote host is very likely to not have `xterm-kitty` in its terminfo, so you will get this error:
|
||||||
|
|
||||||
|
```
|
||||||
|
'xterm-kitty': unknown terminal type
|
||||||
|
```
|
||||||
|
|
||||||
|
Or when you `sudo xxx`, `sudo` won't preserve the `TERM` variable, it will be reset to root's default `TERM` value, which is `xterm` or `xterm-256color` in most linux distributions, so you will get this error:
|
||||||
|
|
||||||
|
```
|
||||||
|
'xterm-256color': unknown terminal type
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```
|
||||||
|
Error opening terminal: xterm-kitty.
|
||||||
|
```
|
||||||
|
|
||||||
|
NixOS preserve the `TERMINFO` and `TERMINFO_DIRS` environment variables, for `root` and the `wheel` group: [nixpkgs/nixos/modules/config/terminfo.nix](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/modules/config/terminfo.nix#L18)
|
||||||
|
|
||||||
|
For nix-darwin, take a look at <https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues>
|
||||||
|
|
||||||
|
### Solutions
|
||||||
|
|
||||||
|
Simplest solution, it will automatically copy over the terminfo files and also magically enable shell integration on the remote machine:
|
||||||
|
|
||||||
|
```
|
||||||
|
kitten ssh user@host
|
||||||
|
```
|
||||||
|
|
||||||
|
Or if you do not care about kitty's features(such as true color & graphics protocol), you can simply set `TERM` to `xterm-256color`, which is built-in in most linux distributions:
|
||||||
|
|
||||||
|
```
|
||||||
|
export TERM=xterm-256color
|
||||||
|
```
|
||||||
|
|
||||||
|
If you need kitty's features, but do not like the magic of `kitten`, you can manually install kitty's terminfo on the remote host:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# install on ubuntu / debian
|
||||||
|
sudo apt-get install kitty-terminfo
|
||||||
|
|
||||||
|
# or copy from local machine
|
||||||
|
infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -83,14 +83,22 @@
|
|||||||
# If the bold italic family is not specified, it will fall back to the
|
# If the bold italic family is not specified, it will fall back to the
|
||||||
# value specified for the normal font.
|
# value specified for the normal font.
|
||||||
family: JetBrainsMono Nerd Font
|
family: JetBrainsMono Nerd Font
|
||||||
|
shell:
|
||||||
|
# To resolve issues:
|
||||||
|
# 1. https://github.com/ryan4yin/nix-config/issues/26
|
||||||
|
# 2. https://github.com/ryan4yin/nix-config/issues/8
|
||||||
|
# Spawn a nushell in login mode via `bash`
|
||||||
|
program: ${pkgs.bash}/bin/bash
|
||||||
|
args:
|
||||||
|
- --login
|
||||||
|
- -c
|
||||||
|
- 'nu --login --interactive'
|
||||||
''
|
''
|
||||||
+ (
|
+ (
|
||||||
if pkgs.stdenv.isDarwin
|
if pkgs.stdenv.isDarwin
|
||||||
then ''
|
then ''
|
||||||
# Point size
|
# Point size
|
||||||
size: 14
|
size: 14
|
||||||
shell: # force nushell as default shell on macOS
|
|
||||||
program: /run/current-system/sw/bin/nu
|
|
||||||
''
|
''
|
||||||
else ''
|
else ''
|
||||||
# holder identation
|
# holder identation
|
||||||
|
|||||||
@@ -47,22 +47,18 @@
|
|||||||
"ctrl+shift+m" = "toggle_maximized";
|
"ctrl+shift+m" = "toggle_maximized";
|
||||||
};
|
};
|
||||||
|
|
||||||
settings =
|
settings = {
|
||||||
{
|
background_opacity = "0.93";
|
||||||
background_opacity = "0.93";
|
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
||||||
macos_option_as_alt = true; # Option key acts as Alt on macOS
|
scrollback_lines = 10000;
|
||||||
scrollback_lines = 10000;
|
enable_audio_bell = false;
|
||||||
enable_audio_bell = false;
|
tab_bar_edge = "top"; # tab bar on top
|
||||||
tab_bar_edge = "top"; # tab bar on top
|
# To resolve issues:
|
||||||
}
|
# 1. https://github.com/ryan4yin/nix-config/issues/26
|
||||||
// (
|
# 2. https://github.com/ryan4yin/nix-config/issues/8
|
||||||
if pkgs.stdenv.isDarwin
|
# Spawn a nushell in login mode via `bash`
|
||||||
then {
|
shell = "${pkgs.bash}/bin/bash --login -c 'nu --login --interactive'";
|
||||||
# macOS specific settings, force kitty to use nushell as default shell
|
};
|
||||||
shell = "/run/current-system/sw/bin/nu";
|
|
||||||
}
|
|
||||||
else {}
|
|
||||||
);
|
|
||||||
|
|
||||||
# macOS specific settings
|
# macOS specific settings
|
||||||
darwinLaunchOptions = ["--start-as=maximized"];
|
darwinLaunchOptions = ["--start-as=maximized"];
|
||||||
|
|||||||
@@ -10,10 +10,16 @@
|
|||||||
# wezterm has catppuccin theme built-in,
|
# wezterm has catppuccin theme built-in,
|
||||||
# it's not necessary to install it separately.
|
# it's not necessary to install it separately.
|
||||||
|
|
||||||
|
# we can add wezterm as a flake input once this PR is merged:
|
||||||
|
# https://github.com/wez/wezterm/pull/3547
|
||||||
|
|
||||||
programs.wezterm =
|
programs.wezterm =
|
||||||
{
|
{
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
# TODO: Fix: https://github.com/wez/wezterm/issues/4483
|
||||||
|
# package = pkgs.wezterm.override { };
|
||||||
|
|
||||||
extraConfig = let
|
extraConfig = let
|
||||||
fontsize =
|
fontsize =
|
||||||
if pkgs.stdenv.isDarwin
|
if pkgs.stdenv.isDarwin
|
||||||
@@ -75,18 +81,14 @@
|
|||||||
action = wezterm.action.EmitEvent 'toggle-maximize',
|
action = wezterm.action.EmitEvent 'toggle-maximize',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config.font_size = ${fontsize}
|
config.font_size = ${fontsize}
|
||||||
''
|
|
||||||
+ (
|
-- To resolve issues:
|
||||||
if pkgs.stdenv.isDarwin
|
-- 1. https://github.com/ryan4yin/nix-config/issues/26
|
||||||
then ''
|
-- 2. https://github.com/ryan4yin/nix-config/issues/8
|
||||||
-- Spawn a fish shell in login mod
|
-- Spawn a nushell in login mode via `bash`
|
||||||
config.default_prog = { '/run/current-system/sw/bin/nu', '-l' }
|
config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' }
|
||||||
''
|
|
||||||
else ""
|
|
||||||
)
|
|
||||||
+ ''
|
|
||||||
return config
|
return config
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,16 +3,6 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
configFile.source = ./config.nu;
|
configFile.source = ./config.nu;
|
||||||
|
|
||||||
extraConfig = ''
|
|
||||||
$env.PATH = ([
|
|
||||||
"${config.home.homeDirectory}/bin"
|
|
||||||
"${config.home.homeDirectory}/.local/bin"
|
|
||||||
"${config.home.homeDirectory}/go/bin"
|
|
||||||
|
|
||||||
($env.PATH | split row (char esep))
|
|
||||||
] | flatten)
|
|
||||||
'';
|
|
||||||
|
|
||||||
# home-manager will merge the cotent in `environmentVariables` with the `envFile.source`
|
# home-manager will merge the cotent in `environmentVariables` with the `envFile.source`
|
||||||
# but basically, I set all environment variables via the shell-independent way, so I don't need to use those two options
|
# but basically, I set all environment variables via the shell-independent way, so I don't need to use those two options
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
{pkgs, ...}: let
|
|
||||||
buildTmuxPlugin = pkgs.tmuxPlugins.mkTmuxPlugin;
|
|
||||||
in {
|
|
||||||
draculaTheme = buildTmuxPlugin {
|
|
||||||
pluginName = "dracula";
|
|
||||||
version = "v2.2.0";
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
name = "dracula-tmux-v2.2.0";
|
|
||||||
url = "https://github.com/dracula/tmux/archive/refs/tags/v2.2.0.tar.gz";
|
|
||||||
sha256 = "sha256:0v2k994yy4xx2iw8qxg7qphw46gq2qmg496i3a3h9b6jgwxqm7zn";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
{
|
{pkgs, ...}: {
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
plugins = pkgs.tmuxPlugins // pkgs.callPackage ./custom-plugins.nix {};
|
|
||||||
in {
|
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
shell = "${pkgs.nushell}/bin/nu";
|
shell = "${pkgs.nushell}/bin/nu";
|
||||||
@@ -17,26 +11,33 @@ in {
|
|||||||
# tmux-sensible overwrites default tmux shortcuts, makes them more sane.
|
# tmux-sensible overwrites default tmux shortcuts, makes them more sane.
|
||||||
sensibleOnTop = true;
|
sensibleOnTop = true;
|
||||||
|
|
||||||
# extraConfig = builtins.readFile ./tmux.conf;
|
# https://github.com/sxyazi/yazi/wiki/Image-preview-within-tmux
|
||||||
|
extraConfig = ''
|
||||||
|
set -g allow-passthrough on
|
||||||
|
|
||||||
|
set -ga update-environment TERM
|
||||||
|
set -ga update-environment TERM_PROGRAM
|
||||||
|
'';
|
||||||
# keyMode = "vi"; # default is emacs
|
# keyMode = "vi"; # default is emacs
|
||||||
|
|
||||||
baseIndex = 1; # start index from 1
|
baseIndex = 1; # start index from 1
|
||||||
escapeTime = 0; # do not wait for escape key
|
escapeTime = 0; # do not wait for escape key
|
||||||
terminal = "xterm-256color";
|
|
||||||
|
|
||||||
plugins = with plugins; [
|
plugins = with pkgs.tmuxPlugins; [
|
||||||
draculaTheme # theme
|
|
||||||
{
|
{
|
||||||
# https://github.com/tmux-plugins/tmux-continuum
|
# theme
|
||||||
# Continuous saving of tmux environment. Automatic restore when tmux is started.
|
# https://github.com/catppuccin/tmux
|
||||||
plugin = continuum;
|
plugin = catppuccin;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
set -g @continuum-save-interval '15'
|
set -g @catppuccin_flavour 'mocha' # or frappe, macchiato, mocha
|
||||||
|
set -g @catppuccin_window_status_enable "yes"
|
||||||
# Option to display current status of tmux continuum in tmux status line.
|
|
||||||
set -g status-right 'Continuum status: #{continuum_status}'
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# https://github.com/tmux-plugins/tmux-yank
|
||||||
|
# Enables copying to system clipboard.
|
||||||
|
yank
|
||||||
|
|
||||||
{
|
{
|
||||||
# https://github.com/tmux-plugins/tmux-resurrect
|
# https://github.com/tmux-plugins/tmux-resurrect
|
||||||
# Manually persists tmux environment across system restarts.
|
# Manually persists tmux environment across system restarts.
|
||||||
@@ -47,11 +48,7 @@ in {
|
|||||||
# Restore Neovim sessions
|
# Restore Neovim sessions
|
||||||
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
extraConfig = "set -g @resurrect-strategy-nvim 'session'";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
# https://github.com/tmux-plugins/tmux-yank
|
|
||||||
# Enables copying to system clipboard.
|
|
||||||
plugin = yank;
|
|
||||||
}
|
|
||||||
# set -g @plugin 'tmux-plugins/tmux-cpu'
|
# set -g @plugin 'tmux-plugins/tmux-cpu'
|
||||||
{
|
{
|
||||||
plugin = cpu;
|
plugin = cpu;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
./proxychains
|
./proxychains
|
||||||
|
|
||||||
./core.nix
|
./core.nix
|
||||||
./nushell.nix
|
|
||||||
./rime-squirrel.nix
|
./rime-squirrel.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
{config, ...}: {
|
|
||||||
# nix-darwin do not set PATH for nushell! so we need to do it manually
|
|
||||||
# this is a workaround to add nix's PATH to nushell
|
|
||||||
programs.nushell.extraConfig = ''
|
|
||||||
$env.PATH = ([
|
|
||||||
"${config.home.homeDirectory}/bin"
|
|
||||||
"${config.home.homeDirectory}/.local/bin"
|
|
||||||
"${config.home.homeDirectory}/go/bin"
|
|
||||||
"/usr/local/bin"
|
|
||||||
"${config.home.homeDirectory}/.nix-profile/bin"
|
|
||||||
"/etc/profiles/per-user/${config.home.username}/bin"
|
|
||||||
"/run/current-system/sw/bin"
|
|
||||||
"/nix/var/nix/profiles/default/bin"
|
|
||||||
|
|
||||||
($env.PATH | split row (char esep))
|
|
||||||
] | flatten)
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,6 @@ in rec {
|
|||||||
|
|
||||||
# set default applications
|
# set default applications
|
||||||
BROWSER = "firefox";
|
BROWSER = "firefox";
|
||||||
TERM = "xterm-256color";
|
|
||||||
|
|
||||||
# enable scrolling in git diff
|
# enable scrolling in git diff
|
||||||
DELTA_PAGER = "less -R";
|
DELTA_PAGER = "less -R";
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
# Linux Only Packages, not available on Darwin
|
# Linux Only Packages, not available on Darwin
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# Automatically trims your branches whose tracking remote refs are merged or gone
|
|
||||||
# It's really useful when you work on a project for a long time.
|
|
||||||
git-trim
|
|
||||||
|
|
||||||
# cloud tools that nix do not have cache for.
|
|
||||||
terraform
|
|
||||||
terraformer # generate terraform configs from existing cloud resources
|
|
||||||
|
|
||||||
nmon
|
nmon
|
||||||
iotop
|
iotop
|
||||||
iftop
|
iftop
|
||||||
@@ -17,11 +9,6 @@
|
|||||||
libnotify
|
libnotify
|
||||||
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
wireguard-tools # manage wireguard vpn manually, via wg-quick
|
||||||
|
|
||||||
# need to run `conda-install` before using it
|
|
||||||
# need to run `conda-shell` before using command `conda`
|
|
||||||
# conda is not available for MacOS
|
|
||||||
conda
|
|
||||||
|
|
||||||
# system call monitoring
|
# system call monitoring
|
||||||
strace # system call monitoring
|
strace # system call monitoring
|
||||||
ltrace # library call monitoring
|
ltrace # library call monitoring
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
}: {
|
}: {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# creative
|
# creative
|
||||||
# blender # 3d modeling
|
blender # 3d modeling
|
||||||
# gimp # image editing, I prefer using figma in browser instead of this one
|
# gimp # image editing, I prefer using figma in browser instead of this one
|
||||||
inkscape # vector graphics
|
inkscape # vector graphics
|
||||||
krita # digital painting
|
krita # digital painting
|
||||||
|
|||||||
@@ -11,9 +11,6 @@
|
|||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# GUI apps
|
# GUI apps
|
||||||
insomnia # REST client
|
|
||||||
wireshark # network analyzer
|
|
||||||
|
|
||||||
# e-book viewer(.epub/.mobi/...)
|
# e-book viewer(.epub/.mobi/...)
|
||||||
# do not support .pdf
|
# do not support .pdf
|
||||||
foliate
|
foliate
|
||||||
@@ -29,7 +26,7 @@
|
|||||||
|
|
||||||
# misc
|
# misc
|
||||||
flameshot
|
flameshot
|
||||||
mitmproxy # http/https proxy tool
|
ventoy # multi-boot usb creator
|
||||||
];
|
];
|
||||||
|
|
||||||
# GitHub CLI tool
|
# GitHub CLI tool
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
catppuccin-cava,
|
catppuccin-cava,
|
||||||
nur-ryan4yin,
|
pkgs-unstable,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# media - control and enjoy audio/video
|
# media - control and enjoy audio/video
|
||||||
@@ -21,8 +21,6 @@
|
|||||||
vdpauinfo
|
vdpauinfo
|
||||||
vulkan-tools
|
vulkan-tools
|
||||||
glxinfo
|
glxinfo
|
||||||
|
|
||||||
nur-ryan4yin.packages.${pkgs.system}.yazi # terminal file manager
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# https://github.com/catppuccin/cava
|
# https://github.com/catppuccin/cava
|
||||||
@@ -36,6 +34,15 @@
|
|||||||
defaultProfiles = ["gpu-hq"];
|
defaultProfiles = ["gpu-hq"];
|
||||||
scripts = [pkgs.mpvScripts.mpris];
|
scripts = [pkgs.mpvScripts.mpris];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# terminal file manager
|
||||||
|
yazi = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs-unstable.yazi;
|
||||||
|
enableBashIntegration = true;
|
||||||
|
# TODO: nushellIntegration is broken on release-23.11, wait for master's fix to be released
|
||||||
|
enableNushellIntegration = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
|||||||
@@ -29,6 +29,4 @@ in {
|
|||||||
# DO NOT change the system's default shell to nushell! it will break some apps!
|
# DO NOT change the system's default shell to nushell! it will break some apps!
|
||||||
# It's better to change only starship/alacritty/vscode's shell to nushell!
|
# It's better to change only starship/alacritty/vscode's shell to nushell!
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.settings.trusted-users = [username];
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
# There are two ways to clear the root filesystem on every boot:
|
# There are two ways to clear the root filesystem on every boot:
|
||||||
## 1. use tmpfs for /
|
## 1. use tmpfs for /
|
||||||
## 2. (btrfs/zfs only)take a blank snapshot of the root filesystem and revert to it on every boot via:
|
## 2. (btrfs/zfs only)take a blank snapshot of the root filesystem and revert to it on every boot via:
|
||||||
## 3. boot.initrd.postDeviceCommands = ''
|
## boot.initrd.postDeviceCommands = ''
|
||||||
## mkdir -p /run/mymount
|
## mkdir -p /run/mymount
|
||||||
## mount -o subvol=/ /dev/disk/by-uuid/UUID /run/mymount
|
## mount -o subvol=/ /dev/disk/by-uuid/UUID /run/mymount
|
||||||
## btrfs subvolume delete /run/mymount
|
## btrfs subvolume delete /run/mymount
|
||||||
@@ -23,6 +23,11 @@
|
|||||||
## '';
|
## '';
|
||||||
#
|
#
|
||||||
# See also https://grahamc.com/blog/erase-your-darlings/
|
# See also https://grahamc.com/blog/erase-your-darlings/
|
||||||
|
|
||||||
|
|
||||||
|
# NOTE: impermanence only mounts the directory/file list below to /persistent
|
||||||
|
# If the directory/file already exists in the root filesystem, you should
|
||||||
|
# move those files/directories to /persistent first!
|
||||||
environment.persistence."/persistent" = {
|
environment.persistence."/persistent" = {
|
||||||
# sets the mount option x-gvfs-hide on all the bind mounts
|
# sets the mount option x-gvfs-hide on all the bind mounts
|
||||||
# to hide them from the file manager
|
# to hide them from the file manager
|
||||||
@@ -46,6 +51,8 @@
|
|||||||
files = [
|
files = [
|
||||||
"/etc/machine-id"
|
"/etc/machine-id"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# the following directories will be passed to /persistent/home/$USER
|
||||||
users.ryan = {
|
users.ryan = {
|
||||||
directories = [
|
directories = [
|
||||||
"codes"
|
"codes"
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
username,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
|
nix.settings = {
|
||||||
|
# enable flakes globally
|
||||||
|
experimental-features = ["nix-command" "flakes"];
|
||||||
|
|
||||||
|
# given the users in this list the right to specify additional substituters via:
|
||||||
|
# 1. `nixConfig.substituers` in `flake.nix`
|
||||||
|
# 2. command line args `--options substituers http://xxx`
|
||||||
|
trusted-users = [username];
|
||||||
|
|
||||||
|
substituters = [
|
||||||
|
# cache mirror located in China
|
||||||
|
# status: https://mirror.sjtu.edu.cn/
|
||||||
|
"https://mirror.sjtu.edu.cn/nix-channels/store"
|
||||||
|
# status: https://mirrors.ustc.edu.cn/status/
|
||||||
|
# "https://mirrors.ustc.edu.cn/nix-channels/store"
|
||||||
|
|
||||||
|
"https://cache.nixos.org"
|
||||||
|
];
|
||||||
|
|
||||||
|
trusted-public-keys = [
|
||||||
|
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
|
||||||
|
];
|
||||||
|
builders-use-substitutes = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# do garbage collection weekly to keep disk usage low
|
||||||
|
nix.gc = {
|
||||||
|
automatic = lib.mkDefault true;
|
||||||
|
dates = lib.mkDefault "weekly";
|
||||||
|
options = lib.mkDefault "--delete-older-than 7d";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Allow unfree packages
|
||||||
|
nixpkgs.config.allowUnfree = lib.mkDefault false;
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs, config, ...}: {
|
||||||
##########################################################################
|
##########################################################################
|
||||||
#
|
#
|
||||||
# Install all apps and packages here.
|
# Install all apps and packages here.
|
||||||
@@ -23,7 +23,12 @@
|
|||||||
gnugrep # replacee macos's grep
|
gnugrep # replacee macos's grep
|
||||||
gnutar # replacee macos's tar
|
gnutar # replacee macos's tar
|
||||||
];
|
];
|
||||||
environment.variables.EDITOR = "nvim";
|
environment.variables = {
|
||||||
|
# Fix https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues
|
||||||
|
TERMINFO_DIRS = map (path: path + "/share/terminfo") config.environment.profiles ++ [ "/usr/share/terminfo" ];
|
||||||
|
|
||||||
|
EDITOR = "nvim";
|
||||||
|
};
|
||||||
|
|
||||||
# Create /etc/zshrc that loads the nix-darwin environment.
|
# Create /etc/zshrc that loads the nix-darwin environment.
|
||||||
# this is required if you want to use darwin's default shell - zsh
|
# this is required if you want to use darwin's default shell - zsh
|
||||||
@@ -34,6 +39,7 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
# Homebrew Mirror
|
# Homebrew Mirror
|
||||||
|
# NOTE: is only useful when you run `brew install` manually! (not via nix-darwin)
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
HOMEBREW_API_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api";
|
HOMEBREW_API_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api";
|
||||||
HOMEBREW_BOTTLE_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles";
|
HOMEBREW_BOTTLE_DOMAIN = "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles";
|
||||||
@@ -44,7 +50,7 @@
|
|||||||
|
|
||||||
# homebrew need to be installed manually, see https://brew.sh
|
# homebrew need to be installed manually, see https://brew.sh
|
||||||
homebrew = {
|
homebrew = {
|
||||||
enable = true;
|
enable = false;
|
||||||
|
|
||||||
onActivation = {
|
onActivation = {
|
||||||
autoUpdate = false;
|
autoUpdate = false;
|
||||||
@@ -136,7 +142,6 @@
|
|||||||
# Development
|
# Development
|
||||||
"insomnia" # REST client
|
"insomnia" # REST client
|
||||||
"wireshark" # network analyzer
|
"wireshark" # network analyzer
|
||||||
"temurin17" # JDK 17
|
|
||||||
"jdk-mission-control" # Java Mission Control
|
"jdk-mission-control" # Java Mission Control
|
||||||
"google-cloud-sdk" # Google Cloud SDK
|
"google-cloud-sdk" # Google Cloud SDK
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./apps.nix
|
../common.nix
|
||||||
./nix-core.nix
|
./nix-core.nix
|
||||||
|
|
||||||
|
./apps.nix
|
||||||
./system.nix
|
./system.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,6 @@
|
|||||||
#
|
#
|
||||||
###################################################################################
|
###################################################################################
|
||||||
|
|
||||||
# enable flakes globally
|
|
||||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
||||||
|
|
||||||
# Allow unfree packages
|
# Allow unfree packages
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
@@ -28,13 +25,6 @@
|
|||||||
|
|
||||||
programs.nix-index.enable = true;
|
programs.nix-index.enable = true;
|
||||||
|
|
||||||
# boot.loader.grub.configurationLimit = 10;
|
|
||||||
# do garbage collection weekly to keep disk usage low
|
|
||||||
nix.gc = {
|
|
||||||
automatic = lib.mkDefault true;
|
|
||||||
options = lib.mkDefault "--delete-older-than 7d";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Disable auto-optimise-store because of this issue:
|
# Disable auto-optimise-store because of this issue:
|
||||||
# https://github.com/NixOS/nix/issues/7273
|
# https://github.com/NixOS/nix/issues/7273
|
||||||
# "error: cannot link '/nix/store/.tmp-link-xxxxx-xxxxx' to '/nix/store/.links/xxxx': File exists"
|
# "error: cannot link '/nix/store/.tmp-link-xxxxx-xxxxx' to '/nix/store/.links/xxxx': File exists"
|
||||||
|
|||||||
@@ -31,16 +31,8 @@
|
|||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
parted
|
parted
|
||||||
ventoy
|
ventoy
|
||||||
# python, some times I may need to use python with root permission.
|
gnumake
|
||||||
(python310.withPackages (ps:
|
|
||||||
with ps; [
|
|
||||||
ipython
|
|
||||||
pandas
|
|
||||||
requests
|
|
||||||
pyquery
|
|
||||||
pyyaml
|
|
||||||
]
|
|
||||||
))
|
|
||||||
psmisc # killall/pstree/prtstat/fuser/...
|
psmisc # killall/pstree/prtstat/fuser/...
|
||||||
colmena # nixos's remote deployment tool
|
colmena # nixos's remote deployment tool
|
||||||
pulseaudio # provides `pactl`, which is required by some apps(e.g. sonic-pi)
|
pulseaudio # provides `pactl`, which is required by some apps(e.g. sonic-pi)
|
||||||
@@ -125,7 +117,7 @@
|
|||||||
printing.enable = true;
|
printing.enable = true;
|
||||||
|
|
||||||
# https://flatpak.org/setup/NixOS
|
# https://flatpak.org/setup/NixOS
|
||||||
flatpak.enable = true;
|
flatpak.enable = false;
|
||||||
|
|
||||||
dbus.packages = [pkgs.gcr];
|
dbus.packages = [pkgs.gcr];
|
||||||
geoclue2.enable = true;
|
geoclue2.enable = true;
|
||||||
|
|||||||
@@ -9,27 +9,16 @@
|
|||||||
#
|
#
|
||||||
###################################################################################
|
###################################################################################
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
../common.nix
|
||||||
|
];
|
||||||
|
|
||||||
# for nix server, we do not need to keep too much generations
|
# for nix server, we do not need to keep too much generations
|
||||||
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10;
|
boot.loader.systemd-boot.configurationLimit = lib.mkDefault 10;
|
||||||
# boot.loader.grub.configurationLimit = 10;
|
|
||||||
# do garbage collection weekly to keep disk usage low
|
|
||||||
nix.gc = {
|
|
||||||
automatic = lib.mkDefault true;
|
|
||||||
dates = lib.mkDefault "weekly";
|
|
||||||
options = lib.mkDefault "--delete-older-than 7d";
|
|
||||||
};
|
|
||||||
|
|
||||||
nix.settings = {
|
# Manual optimise storage: nix-store --optimise
|
||||||
# Manual optimise storage: nix-store --optimise
|
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store
|
||||||
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-auto-optimise-store
|
nix.settings.auto-optimise-store = true;
|
||||||
auto-optimise-store = true;
|
|
||||||
builders-use-substitutes = true;
|
|
||||||
# enable flakes globally
|
|
||||||
experimental-features = ["nix-command" "flakes"];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Allow unfree packages
|
|
||||||
nixpkgs.config.allowUnfree = lib.mkDefault false;
|
|
||||||
|
|
||||||
# Set your time zone.
|
# Set your time zone.
|
||||||
time.timeZone = "Asia/Shanghai";
|
time.timeZone = "Asia/Shanghai";
|
||||||
|
|||||||
@@ -38,8 +38,13 @@
|
|||||||
qemu_full
|
qemu_full
|
||||||
];
|
];
|
||||||
|
|
||||||
boot.kernelModules = ["kvm-amd" "kvm-intel"];
|
boot.kernelModules = ["kvm-amd" "kvm-intel" "vfio-pci"];
|
||||||
# Enable nested virsualization, required by security containers and nested vm.
|
# Enable nested virsualization, required by security containers and nested vm.
|
||||||
boot.extraModprobeConfig = "options kvm_intel nested=1"; # for intel cpu
|
boot.extraModprobeConfig = "options kvm_intel nested=1"; # for intel cpu
|
||||||
# boot.extraModprobeConfig = "options kvm_amd nested=1"; # for amd cpu
|
# boot.extraModprobeConfig = "options kvm_amd nested=1"; # for amd cpu
|
||||||
|
|
||||||
|
virtualisation = {
|
||||||
|
waydroid.enable = true;
|
||||||
|
lxd.enable = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
{ username, ... }:
|
{ username, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
nix.settings.trusted-users = [username];
|
|
||||||
|
|
||||||
# Don't allow mutation of users outside the config.
|
# Don't allow mutation of users outside the config.
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
|
|
||||||
@@ -10,7 +8,6 @@
|
|||||||
"${username}" = {};
|
"${username}" = {};
|
||||||
docker = {};
|
docker = {};
|
||||||
wireshark = {};
|
wireshark = {};
|
||||||
|
|
||||||
# for android platform tools's udev rules
|
# for android platform tools's udev rules
|
||||||
adbusers ={};
|
adbusers ={};
|
||||||
dialout = {};
|
dialout = {};
|
||||||
@@ -22,7 +19,7 @@
|
|||||||
|
|
||||||
users.users."${username}" = {
|
users.users."${username}" = {
|
||||||
# generated by `mkpasswd -m scrypt`
|
# generated by `mkpasswd -m scrypt`
|
||||||
# we have to use initialHashedPassword here, if your'are using tmpfs for /
|
# we have to use initialHashedPassword here when using tmpfs for /
|
||||||
initialHashedPassword = "$7$CU..../....Sdl/JRH..9eIvZ6mE/52r.$xeR6lyvTcVVKt28Owcoc/vPOOECcYSiq1xjw/QCz2t0";
|
initialHashedPassword = "$7$CU..../....Sdl/JRH..9eIvZ6mE/52r.$xeR6lyvTcVVKt28Owcoc/vPOOECcYSiq1xjw/QCz2t0";
|
||||||
home = "/home/${username}";
|
home = "/home/${username}";
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
@@ -44,6 +41,9 @@
|
|||||||
};
|
};
|
||||||
users.users.root.initialHashedPassword = "$7$CU..../....X6uvZYnFD.i1CqqFFNl4./$4vgqzIPyw5XBr0aCDFbY/UIRRJr7h5SMGoQ/ZvX3FP2";
|
users.users.root.initialHashedPassword = "$7$CU..../....X6uvZYnFD.i1CqqFFNl4./$4vgqzIPyw5XBr0aCDFbY/UIRRJr7h5SMGoQ/ZvX3FP2";
|
||||||
|
|
||||||
|
# fix for `sudo xxx` in kitty/wezterm and other modern terminal emulators
|
||||||
|
security.sudo.keepTerminfo = true;
|
||||||
|
|
||||||
# DO NOT promote the specified user to input password for `nix-store` and `nix-copy-closure`
|
# DO NOT promote the specified user to input password for `nix-store` and `nix-copy-closure`
|
||||||
security.sudo.extraRules = [
|
security.sudo.extraRules = [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user