feat: nix fmt

This commit is contained in:
Ryan Yin
2023-12-18 00:36:59 +08:00
parent a04a058077
commit b2f75a37dc
50 changed files with 293 additions and 269 deletions

View File

@@ -1,25 +1,28 @@
{
pkgs,
...
}: {
home.packages = with pkgs; [
# general tools
pulumi
pulumictl
# istioctl
{pkgs, ...}: {
home.packages = with pkgs;
[
# general tools
pulumi
pulumictl
# istioctl
# aws
awscli2
ssm-session-manager-plugin # Amazon SSM Session Manager Plugin
aws-iam-authenticator
eksctl
istioctl
# aws
awscli2
ssm-session-manager-plugin # Amazon SSM Session Manager Plugin
aws-iam-authenticator
eksctl
istioctl
# aliyun
aliyun-cli
] ++ (if pkgs.stdenv.isLinux then [
# cloud tools that nix do not have cache for.
terraform
terraformer # generate terraform configs from existing cloud resources
] else []);
# aliyun
aliyun-cli
]
++ (
if pkgs.stdenv.isLinux
then [
# cloud tools that nix do not have cache for.
terraform
terraformer # generate terraform configs from existing cloud resources
]
else []
);
}

View File

@@ -7,7 +7,7 @@
skopeo
docker-compose
dive # explore docker layers
];
];
programs = {
};

View File

@@ -1,4 +1,4 @@
{ ... }: {
{...}: {
imports = [
./container.nix
./kubernetes.nix

View File

@@ -12,20 +12,20 @@
programs = {
k9s = {
enable = true;
skin =
let
skin_file = "${cattppuccin-k9s}/dist/mocha.yml"; # theme - cattppuccin mocha
skin_attr = builtins.fromJSON (builtins.readFile
# replace 'base: &base "#1e1e2e"' with 'base: &base "default"'
# to make fg/bg color transparent. "default" means transparent in k9s skin.
(pkgs.runCommandNoCC "get-skin-json" {} ''
cat ${skin_file} \
| sed -E 's@(base: &base ).+@\1 "default"@g' \
| ${pkgs.yj}/bin/yj > $out
'')
);
in
skin_attr;
skin = let
skin_file = "${cattppuccin-k9s}/dist/mocha.yml"; # theme - cattppuccin mocha
skin_attr = builtins.fromJSON (
builtins.readFile
# replace 'base: &base "#1e1e2e"' with 'base: &base "default"'
# to make fg/bg color transparent. "default" means transparent in k9s skin.
(pkgs.runCommandNoCC "get-skin-json" {} ''
cat ${skin_file} \
| sed -E 's@(base: &base ).+@\1 "default"@g' \
| ${pkgs.yj}/bin/yj > $out
'')
);
in
skin_attr;
};
};
}

View File

@@ -14,59 +14,65 @@
#
#############################################################
home.packages = with pkgs; [
(python3.withPackages (
ps:
with ps; [
ipython
pandas
requests
pyquery
pyyaml
]
))
home.packages = with pkgs;
[
(python3.withPackages (
ps:
with ps; [
ipython
pandas
requests
pyquery
pyyaml
]
))
cargo # rust package manager
go
jdk17
guile # scheme language
cargo # rust package manager
go
jdk17
guile # scheme language
# db related
dbeaver
mycli
pgcli
mongosh
sqlite
# db related
dbeaver
mycli
pgcli
mongosh
sqlite
# embedded development
minicom
# embedded development
minicom
# ai related
python311Packages.huggingface-hub # huggingface-cli
# ai related
python311Packages.huggingface-hub # huggingface-cli
# misc
pkgs-unstable.devbox
glow # markdown previewer
fzf
gdu # disk usage analyzer, required by AstroNvim
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
bfg-repo-cleaner # remove large files from git history
k6 # load testing tool
protobuf # protocol buffer compiler
] ++ (if pkgs.stdenv.isLinux then [
# Automatically trims your branches whose tracking remote refs are merged or gone
# It's really useful when you work on a project for a long time.
git-trim
# misc
pkgs-unstable.devbox
glow # markdown previewer
fzf
gdu # disk usage analyzer, required by AstroNvim
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
bfg-repo-cleaner # remove large files from git history
k6 # load testing tool
protobuf # protocol buffer compiler
]
++ (
if pkgs.stdenv.isLinux
then [
# Automatically trims your branches whose tracking remote refs are merged or gone
# It's really useful when you work on a project for a long time.
git-trim
# need to run `conda-install` before using it
# need to run `conda-shell` before using command `conda`
# conda is not available for MacOS
conda
# 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 []);
mitmproxy # http/https proxy tool
insomnia # REST client
wireshark # network analyzer
]
else []
);
programs = {
direnv = {

View File

@@ -1,6 +1,8 @@
{ pkgs, catppuccin-helix, ... }:
{
pkgs,
catppuccin-helix,
...
}: {
# https://github.com/catppuccin/helix
xdg.configFile."helix/themes".source = "${catppuccin-helix}/themes/default";
@@ -25,7 +27,7 @@
space.space = "file_picker";
space.w = ":w";
space.q = ":q";
esc = [ "collapse_selection" "keep_primary_selection" ];
esc = ["collapse_selection" "keep_primary_selection"];
};
};
};

View File

@@ -1,4 +1,4 @@
{ nushell-scripts, ...}: {
{nushell-scripts, ...}: {
programs.bash = {
# load the alias file for work
bashrcExtra = ''

View File

@@ -1,4 +1,8 @@
{pkgs, catppuccin-alacritty, ...}:
{
pkgs,
catppuccin-alacritty,
...
}:
###########################################################
#
# Alacritty Configuration
@@ -97,8 +101,8 @@
+ (
if pkgs.stdenv.isDarwin
then ''
# Point size
size: 14
# Point size
size: 14
''
else ''
# holder identation

View File

@@ -25,72 +25,71 @@
if pkgs.stdenv.isDarwin
then "14.0"
else "13.0";
in
''
-- Pull in the wezterm API
local wezterm = require 'wezterm'
in ''
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This table will hold the configuration.
local config = {}
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
end
wezterm.on('toggle-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
if not overrides.window_background_opacity then
overrides.window_background_opacity = 0.93
else
overrides.window_background_opacity = nil
end
window:set_config_overrides(overrides)
end)
wezterm.on('toggle-opacity', function(window, pane)
local overrides = window:get_config_overrides() or {}
if not overrides.window_background_opacity then
overrides.window_background_opacity = 0.93
else
overrides.window_background_opacity = nil
end
window:set_config_overrides(overrides)
end)
wezterm.on('toggle-maximize', function(window, pane)
window:maximize()
end)
wezterm.on('toggle-maximize', function(window, pane)
window:maximize()
end)
-- This is where you actually apply your config choices
config.color_scheme = "Catppuccin Mocha"
config.font = wezterm.font_with_fallback {
"JetBrainsMono Nerd Font",
"FiraCode Nerd Font",
-- This is where you actually apply your config choices
config.color_scheme = "Catppuccin Mocha"
config.font = wezterm.font_with_fallback {
"JetBrainsMono Nerd Font",
"FiraCode Nerd Font",
-- To avoid 'Chinese characters displayed as variant (Japanese) glyphs'
"Source Han Sans SC",
"Source Han Sans TC"
}
-- To avoid 'Chinese characters displayed as variant (Japanese) glyphs'
"Source Han Sans SC",
"Source Han Sans TC"
}
config.hide_tab_bar_if_only_one_tab = true
config.scrollback_lines = 10000
config.enable_scroll_bar = true
config.hide_tab_bar_if_only_one_tab = true
config.scrollback_lines = 10000
config.enable_scroll_bar = true
config.keys = {
-- toggle opacity(CTRL + SHIFT + B)
{
key = 'B',
mods = 'CTRL',
action = wezterm.action.EmitEvent 'toggle-opacity',
},
{
key = 'M',
mods = 'CTRL',
action = wezterm.action.EmitEvent 'toggle-maximize',
},
}
config.font_size = ${fontsize}
config.keys = {
-- toggle opacity(CTRL + SHIFT + B)
{
key = 'B',
mods = 'CTRL',
action = wezterm.action.EmitEvent 'toggle-opacity',
},
{
key = 'M',
mods = 'CTRL',
action = wezterm.action.EmitEvent 'toggle-maximize',
},
}
config.font_size = ${fontsize}
-- To resolve issues:
-- 1. https://github.com/ryan4yin/nix-config/issues/26
-- 2. https://github.com/ryan4yin/nix-config/issues/8
-- Spawn a nushell in login mode via `bash`
config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' }
-- To resolve issues:
-- 1. https://github.com/ryan4yin/nix-config/issues/26
-- 2. https://github.com/ryan4yin/nix-config/issues/8
-- Spawn a nushell in login mode via `bash`
config.default_prog = { '${pkgs.bash}/bin/bash', '--login', '-c', 'nu --login --interactive' }
return config
'';
return config
'';
}
// (
if pkgs.stdenv.isDarwin

View File

@@ -1,4 +1,4 @@
{ catppuccin-bat, ...}: {
{catppuccin-bat, ...}: {
# a cat(1) clone with syntax highlighting and Git integration.
programs.bat = {
enable = true;

View File

@@ -1,6 +1,4 @@
{ catppuccin-btop, ... }:
{
{catppuccin-btop, ...}: {
# https://github.com/catppuccin/btop/blob/main/themes/catppuccin_mocha.theme
home.file.".config/btop/themes".source = "${catppuccin-btop}/themes";
@@ -8,8 +6,8 @@
programs.btop = {
enable = true;
settings = {
color_theme = "catppuccin_mocha";
theme_background = false; # make btop transparent
color_theme = "catppuccin_mocha";
theme_background = false; # make btop transparent
};
};
}

View File

@@ -19,15 +19,14 @@
nmap # A utility for network discovery and security auditing
ipcalc # it is a calculator for the IPv4/v6 addresses
# Text Processing
# Docs: https://github.com/learnbyexample/Command-line-text-processing
gnugrep # GNU grep, provides `grep`/`egrep`/`fgrep`
gnused # GNU sed, very powerful(mainly for replacing text in files)
gawk # GNU awk, a pattern scanning and processing language
gnugrep # GNU grep, provides `grep`/`egrep`/`fgrep`
gnused # GNU sed, very powerful(mainly for replacing text in files)
gawk # GNU awk, a pattern scanning and processing language
ripgrep # recursively searches directories for a regex pattern
sad # CLI search and replace, with diff preview, really useful!!!
delta # A viewer for git and diff output
sad # CLI search and replace, with diff preview, really useful!!!
delta # A viewer for git and diff output
# A fast and polyglot tool for code searching, linting, rewriting at large scale
# supported languages: only some mainstream languages currently(do not support nix/nginx/yaml/toml/...)
ast-grep
@@ -80,7 +79,7 @@
# https://github.com/catppuccin/fzf
# catppuccin-mocha
colors = {
"bg+" = "#313244";
"bg+" = "#313244";
"bg" = "#1e1e2e";
"spinner" = "#f5e0dc";
"hl" = "#f38ba8";

View File

@@ -2,7 +2,6 @@
config,
lib,
pkgs,
userfullname,
useremail,
...
@@ -76,15 +75,15 @@
st = "status";
ls = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate";
ll = "log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --numstat";
cm = "commit -m"; # commit via `git cm <message>`
ca = "commit -am"; # commit all changes via `git ca <message>`
cm = "commit -m"; # commit via `git cm <message>`
ca = "commit -am"; # commit all changes via `git ca <message>`
dc = "diff --cached";
amend = "commit --amend -m"; # amend commit message via `git amend <message>`
unstage = "reset HEAD --"; # unstage file via `git unstage <file>`
merged = "branch --merged"; # list merged(into HEAD) branches via `git merged`
unmerged = "branch --no-merged"; # list unmerged(into HEAD) branches via `git unmerged`
nonexist = "remote prune origin --dry-run"; # list non-exist(remote) branches via `git nonexist`
amend = "commit --amend -m"; # amend commit message via `git amend <message>`
unstage = "reset HEAD --"; # unstage file via `git unstage <file>`
merged = "branch --merged"; # list merged(into HEAD) branches via `git merged`
unmerged = "branch --no-merged"; # list unmerged(into HEAD) branches via `git unmerged`
nonexist = "remote prune origin --dry-run"; # list non-exist(remote) branches via `git nonexist`
# delete merged branches except master & dev & staging
# `!` indicates it's a shell script, not a git subcommand

View File

@@ -1,4 +1,4 @@
{ config, ...}: {
{config, ...}: {
programs.nushell = {
enable = true;
configFile.source = ./config.nu;

View File

@@ -1,4 +1,4 @@
{ catppuccin-starship, ...}: {
{catppuccin-starship, ...}: {
programs.starship = {
enable = true;
@@ -6,22 +6,24 @@
enableZshIntegration = true;
enableNushellIntegration = true;
settings = {
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
aws = {
symbol = "🅰 ";
};
gcloud = {
# do not show the account/project's info
# to avoid the leak of sensitive information when sharing the terminal
format = "on [$symbol$active(\($region\))]($style) ";
symbol = "🅶 ";
};
settings =
{
character = {
success_symbol = "[](bold green)";
error_symbol = "[](bold red)";
};
aws = {
symbol = "🅰 ";
};
gcloud = {
# do not show the account/project's info
# to avoid the leak of sensitive information when sharing the terminal
format = "on [$symbol$active(\($region\))]($style) ";
symbol = "🅶 ";
};
palette = "catppuccin_mocha";
} // builtins.fromTOML (builtins.readFile "${catppuccin-starship}/palettes/mocha.toml");
palette = "catppuccin_mocha";
}
// builtins.fromTOML (builtins.readFile "${catppuccin-starship}/palettes/mocha.toml");
};
}