mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-23 09:18:35 +02:00
feat: rename 'common' to 'base'
This commit is contained in:
18
home/base/bash.nix
Normal file
18
home/base/bash.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{...}: {
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
bashrcExtra = ''
|
||||
export PATH="$PATH:$HOME/bin:$HOME/.local/bin:$HOME/go/bin"
|
||||
'';
|
||||
|
||||
shellAliases = {
|
||||
k = "kubectl";
|
||||
vim = "nvim";
|
||||
|
||||
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
||||
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
||||
httpproxy = "export https_proxy=http://127.0.0.1:7890; export http_proxy=http://127.0.0.1:7890;";
|
||||
};
|
||||
};
|
||||
}
|
||||
80
home/base/core.nix
Normal file
80
home/base/core.nix
Normal file
@@ -0,0 +1,80 @@
|
||||
{config, pkgs, ...}:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
neofetch
|
||||
nnn # terminal file manager
|
||||
|
||||
# archives
|
||||
zip
|
||||
xz
|
||||
unzip
|
||||
p7zip
|
||||
|
||||
# utils
|
||||
ripgrep # recursively searches directories for a regex pattern
|
||||
jq # A lightweight and flexible command-line JSON processor
|
||||
yq-go # yaml processer https://github.com/mikefarah/yq
|
||||
exa # A modern replacement for ‘ls’
|
||||
fzf # A command-line fuzzy finder
|
||||
|
||||
# networking tools
|
||||
mtr # A network diagnostic tool
|
||||
iperf3
|
||||
ldns # replacement of dig, it provide the command `drill`
|
||||
aria2 # A lightweight multi-protocol & multi-source command-line download utility
|
||||
socat # replacement of openbsd-netcat
|
||||
nmap # A utility for network discovery and security auditing
|
||||
|
||||
# misc
|
||||
cowsay
|
||||
file
|
||||
which
|
||||
tree
|
||||
gnused
|
||||
gnutar
|
||||
gawk
|
||||
zstd
|
||||
caddy
|
||||
gnupg
|
||||
|
||||
# nix related
|
||||
#
|
||||
# it provides the command `nom` works just like `nix
|
||||
# with more details log output
|
||||
nix-output-monitor
|
||||
|
||||
# productivity
|
||||
hugo # static site generator
|
||||
glow # markdown previewer in terminal
|
||||
];
|
||||
|
||||
programs = {
|
||||
# A terminal multiplexer
|
||||
tmux = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# a cat(1) clone with syntax highlighting and Git integration.
|
||||
bat = {
|
||||
enable = true;
|
||||
config = {
|
||||
pager = "less -FR";
|
||||
theme = "Catppuccin-mocha";
|
||||
};
|
||||
themes = {
|
||||
Catppuccin-mocha = builtins.readFile (pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/catppuccin/bat/main/Catppuccin-mocha.tmTheme";
|
||||
hash = "sha256-qMQNJGZImmjrqzy7IiEkY5IhvPAMZpq0W6skLLsng/w=";
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
# skim provides a single executable: sk.
|
||||
# Basically anywhere you would want to use grep, try sk instead.
|
||||
skim = {
|
||||
enable = true;
|
||||
enableBashIntegration = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
14
home/base/default.nix
Normal file
14
home/base/default.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{config, pkgs, ...}:
|
||||
{
|
||||
imports = [
|
||||
./nushell
|
||||
./bash.nix
|
||||
|
||||
./core.nix
|
||||
./development.nix
|
||||
./git.nix
|
||||
./media.nix
|
||||
./starship.nix
|
||||
];
|
||||
|
||||
}
|
||||
117
home/base/development.nix
Normal file
117
home/base/development.nix
Normal file
@@ -0,0 +1,117 @@
|
||||
{config, pkgs, nil, ...}:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
nil.packages."${pkgs.system}".default # nix language server
|
||||
|
||||
# IDE
|
||||
jetbrains.pycharm-community
|
||||
jetbrains.idea-community
|
||||
|
||||
# cloud native
|
||||
skopeo
|
||||
docker-compose
|
||||
dive # explore docker layers
|
||||
kubectl
|
||||
kubernetes-helm
|
||||
terraform
|
||||
# terraformer # generate terraform configs from existing cloud resources
|
||||
pulumi
|
||||
pulumictl
|
||||
k9s
|
||||
# istioctl
|
||||
|
||||
# cloud provider
|
||||
awscli
|
||||
aws-iam-authenticator
|
||||
eksctl
|
||||
|
||||
# DO NOT install build tools for C/C++, set it per project by devShell instead
|
||||
gnumake # used by this repo, to simplify the deployment
|
||||
clang-tools
|
||||
clang-analyzer
|
||||
# lldb
|
||||
# cmake
|
||||
# autoconf
|
||||
# automake
|
||||
# bison
|
||||
# cppcheck
|
||||
# fakeroot
|
||||
# flex
|
||||
# gettext
|
||||
# groff
|
||||
# libtool
|
||||
# m4
|
||||
# patch
|
||||
# pkgconf
|
||||
# texinfo
|
||||
# binutils
|
||||
|
||||
# Golang
|
||||
delve
|
||||
go
|
||||
go-outline
|
||||
go-tools
|
||||
go2nix
|
||||
gomodifytags
|
||||
gopls
|
||||
gotests
|
||||
impl
|
||||
|
||||
# Rust
|
||||
rustup
|
||||
|
||||
# python
|
||||
(python310.withPackages(ps: with ps; [
|
||||
ipython
|
||||
pandas
|
||||
requests
|
||||
pyquery
|
||||
]))
|
||||
|
||||
# db related
|
||||
dbeaver
|
||||
mycli
|
||||
pgcli
|
||||
mongosh
|
||||
sqlite
|
||||
|
||||
# embedded development
|
||||
minicom
|
||||
|
||||
# other languages
|
||||
# julia
|
||||
zig
|
||||
# elixir
|
||||
# solidity
|
||||
|
||||
# java
|
||||
# adoptopenjdk-openj9-bin-17
|
||||
|
||||
# other tools
|
||||
k6 # load testing tool
|
||||
mitmproxy # http/https proxy tool
|
||||
protobuf # protocol buffer compiler
|
||||
];
|
||||
|
||||
programs = {
|
||||
# modern vim
|
||||
neovim = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
set number relativenumber
|
||||
'';
|
||||
};
|
||||
|
||||
direnv = {
|
||||
enable = true;
|
||||
nix-direnv.enable = true;
|
||||
enableZshIntegration = true;
|
||||
};
|
||||
};
|
||||
|
||||
# GitHub CLI tool
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
61
home/base/git.nix
Normal file
61
home/base/git.nix
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: {
|
||||
# `programs.git` will generate the config file: ~/.config/git/config
|
||||
# to make git use this config file, `~/.gitconfig` should not exist!
|
||||
#
|
||||
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
|
||||
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
|
||||
rm -f ~/.gitconfig
|
||||
'';
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
lfs.enable = true;
|
||||
|
||||
userName = "Ryan Yin";
|
||||
userEmail = "xiaoyin_c@qq.com";
|
||||
|
||||
includes = [
|
||||
{
|
||||
# use diffrent email & name for work
|
||||
path = "~/work/.gitconfig";
|
||||
condition = "gitdir:~/work/";
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = {
|
||||
pull = {
|
||||
rebase = true;
|
||||
};
|
||||
|
||||
# replace https with ssh
|
||||
url = {
|
||||
"ssh://git@github.com/" = {
|
||||
insteadOf = "https://github.com/";
|
||||
};
|
||||
"ssh://git@gitlab.com/" = {
|
||||
insteadOf = "https://gitlab.com/";
|
||||
};
|
||||
"ssh://git@bitbucket.com/" = {
|
||||
insteadOf = "https://bitbucket.com/";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# signing = {
|
||||
# key = "xxx";
|
||||
# signByDefault = true;
|
||||
# };
|
||||
|
||||
delta = {
|
||||
enable = true;
|
||||
options = {
|
||||
features = "side-by-side";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
16
home/base/media.nix
Normal file
16
home/base/media.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
# processing audio/video
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
ffmpeg-full
|
||||
|
||||
# images
|
||||
viu # terminal image viewer
|
||||
imagemagick
|
||||
graphviz
|
||||
];
|
||||
}
|
||||
50
home/base/nushell/config.nu
Normal file
50
home/base/nushell/config.nu
Normal file
@@ -0,0 +1,50 @@
|
||||
# Nushell Config File
|
||||
#
|
||||
# version = 0.81.1
|
||||
|
||||
# The default config record. This is where much of your global configuration is setup.
|
||||
let-env config = {
|
||||
# true or false to enable or disable the welcome banner at startup
|
||||
show_banner: false
|
||||
|
||||
table: {
|
||||
mode: rounded # basic, compact, compact_double, light, thin, with_love, rounded, reinforced, heavy, none, other
|
||||
index_mode: always # "always" show indexes, "never" show indexes, "auto" = show indexes when a table has "index" column
|
||||
show_empty: true # show 'empty list' and 'empty record' placeholders for command output
|
||||
trim: {
|
||||
methodology: wrapping # wrapping or truncating
|
||||
wrapping_try_keep_words: true # A strategy used by the 'wrapping' methodology
|
||||
truncating_suffix: "..." # A suffix used by the 'truncating' methodology
|
||||
}
|
||||
}
|
||||
|
||||
completions: {
|
||||
case_sensitive: false # set to true to enable case-sensitive completions
|
||||
quick: true # set this to false to prevent auto-selecting completions when only one remains
|
||||
partial: true # set this to false to prevent partial filling of the prompt
|
||||
algorithm: "prefix" # prefix or fuzzy
|
||||
external: {
|
||||
enable: true # set to false to prevent nushell looking into $env.PATH to find more suggestions, `false` recommended for WSL users as this look up may be very slow
|
||||
max_results: 100 # setting it lower can improve completion performance at the cost of omitting some options
|
||||
completer: null # check 'carapace_completer' above as an example
|
||||
}
|
||||
}
|
||||
filesize: {
|
||||
metric: true # true => KB, MB, GB (ISO standard), false => KiB, MiB, GiB (Windows standard)
|
||||
format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
|
||||
}
|
||||
cursor_shape: {
|
||||
emacs: line # block, underscore, line, blink_block, blink_underscore, blink_line (line is the default)
|
||||
vi_insert: block # block, underscore, line , blink_block, blink_underscore, blink_line (block is the default)
|
||||
vi_normal: underscore # block, underscore, line, blink_block, blink_underscore, blink_line (underscore is the default)
|
||||
}
|
||||
use_grid_icons: true
|
||||
footer_mode: "25" # always, never, number_of_rows, auto
|
||||
float_precision: 2 # the precision for displaying floats in tables
|
||||
# buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
|
||||
use_ansi_coloring: true
|
||||
bracketed_paste: true # enable bracketed paste, currently useless on windows
|
||||
edit_mode: emacs # emacs, vi
|
||||
shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue
|
||||
render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt.
|
||||
}
|
||||
21
home/base/nushell/default.nix
Normal file
21
home/base/nushell/default.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{...}: {
|
||||
programs.nushell = {
|
||||
enable = true;
|
||||
configFile.source = ./config.nu;
|
||||
|
||||
# home-manager will merge the cotent in `environmentVariables` with the `envFile.source`
|
||||
# but basically, I set all environment variables via the shell-independent way, so I don't need to use those two options
|
||||
#
|
||||
# envFile.source = ./env.nu;
|
||||
# environmentVariables = { FOO="bar"; };
|
||||
|
||||
shellAliases = {
|
||||
k = "kubectl";
|
||||
vim = "nvim";
|
||||
|
||||
urldecode = "python3 -c 'import sys, urllib.parse as ul; print(ul.unquote_plus(sys.stdin.read()))'";
|
||||
urlencode = "python3 -c 'import sys, urllib.parse as ul; print(ul.quote_plus(sys.stdin.read()))'";
|
||||
httpproxy = "let-env https_proxy = http://127.0.0.1:7890; let-env http_proxy = http://127.0.0.1:7890;";
|
||||
};
|
||||
};
|
||||
}
|
||||
15
home/base/starship.nix
Normal file
15
home/base/starship.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{config, ...}: {
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
|
||||
enableBashIntegration = true;
|
||||
enableNushellIntegration = true;
|
||||
|
||||
settings = {
|
||||
character = {
|
||||
success_symbol = "[›](bold green)";
|
||||
error_symbol = "[›](bold red)";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user