feat: format via 'ls **/*.nix | each { |it| nixfmt $it.name }'

This commit is contained in:
Ryan Yin
2025-07-30 12:17:24 +08:00
parent d10b30b06b
commit 13bb77108c
219 changed files with 2103 additions and 1728 deletions

View File

@@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
home.packages = with pkgs; [
# Misc
cowsay
@@ -12,7 +13,7 @@
# search for files by name, faster than find
fd
# search for files by its content, replacement of grep
(ripgrep.override {withPCRE2 = true;})
(ripgrep.override { withPCRE2 = true; })
# 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/...)

View File

@@ -1,3 +1,4 @@
{mylib, ...}: {
{ mylib, ... }:
{
imports = mylib.scanPaths ./.;
}

View File

@@ -1,3 +1,4 @@
{mylib, ...}: {
{ mylib, ... }:
{
imports = mylib.scanPaths ./.;
}

View File

@@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
programs.helix = {
enable = true;
};

View File

@@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
programs = {
neovim = {
enable = true;

View File

@@ -4,12 +4,13 @@
pkgs,
myvars,
...
}: {
}:
{
# `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"] ''
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
rm -f ${config.home.homeDirectory}/.gitconfig
'';

View File

@@ -1,4 +1,5 @@
{config, ...}: {
{ config, ... }:
{
# make `npm install -g <pkg>` happey
#
# mainly used to install npm packages that updates frequently

View File

@@ -1,4 +1,5 @@
{config, ...}: let
{ config, ... }:
let
shellAliases = {
k = "kubectl";
@@ -10,7 +11,8 @@
goBin = "${config.home.homeDirectory}/go/bin";
rustBin = "${config.home.homeDirectory}/.cargo/bin";
npmBin = "${config.home.homeDirectory}/.npm/bin";
in {
in
{
programs.bash = {
enable = true;
enableCompletion = true;

View File

@@ -1,4 +1,5 @@
{catppuccin, ...}: {
{ catppuccin, ... }:
{
# https://github.com/catppuccin/nix
imports = [
catppuccin.homeModules.catppuccin

View File

@@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
# terminal file manager
programs.yazi = {
enable = true;

View File

@@ -2,7 +2,8 @@ let
shellAliases = {
"zj" = "zellij";
};
in {
in
{
programs.zellij = {
enable = true;
};

View File

@@ -1,3 +1,4 @@
{mylib, ...}: {
{ mylib, ... }:
{
imports = mylib.scanPaths ./.;
}

View File

@@ -1,5 +1,7 @@
{pkgs, ...}: {
home.packages = with pkgs;
{ pkgs, ... }:
{
home.packages =
with pkgs;
[
mitmproxy # http/https proxy tool
wireshark # network analyzer

View File

@@ -52,10 +52,7 @@
bold_italic = {
family = "Maple Mono NF CN";
};
size =
if pkgs.stdenv.isDarwin
then 14
else 13;
size = if pkgs.stdenv.isDarwin then 14 else 13;
};
terminal = {
# Spawn a nushell in login mode via `bash`

View File

@@ -1,3 +1,4 @@
{mylib, ...}: {
{ mylib, ... }:
{
imports = mylib.scanPaths ./.;
}

View File

@@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
programs.foot = {
# foot is designed only for Linux
enable = pkgs.stdenv.isLinux;

View File

@@ -12,9 +12,10 @@
programs.ghostty = {
enable = true;
package =
if pkgs.stdenv.isDarwin
then pkgs.hello # pkgs.ghostty is currently broken on darwin
else pkgs.ghostty; # the stable version
if pkgs.stdenv.isDarwin then
pkgs.hello # pkgs.ghostty is currently broken on darwin
else
pkgs.ghostty; # the stable version
# package = ghostty.packages.${pkgs.system}.default; # the latest version
enableBashIntegration = false;
installBatSyntax = false;

View File

@@ -19,10 +19,7 @@
font = {
name = "Maple Mono NF CN";
# use different font size on macOS
size =
if pkgs.stdenv.isDarwin
then 14
else 13;
size = if pkgs.stdenv.isDarwin then 14 else 13;
};
# consistent with other terminal emulators
@@ -48,6 +45,6 @@
};
# macOS specific settings
darwinLaunchOptions = ["--start-as=maximized"];
darwinLaunchOptions = [ "--start-as=maximized" ];
};
}

View File

@@ -1,4 +1,5 @@
{myvars, ...}: {
{ myvars, ... }:
{
# Home Manager needs a bit of information about you and the
# paths it should manage.
home = {

View File

@@ -2,7 +2,8 @@
lib,
pkgs,
...
}: {
}:
{
# https://developer.hashicorp.com/terraform/cli/config/config-file
home.file.".terraformrc".source = ./terraformrc;
@@ -30,9 +31,12 @@
# digitalocean
doctl
# google cloud
(google-cloud-sdk.withExtraComponents (with google-cloud-sdk.components; [
gke-gcloud-auth-plugin
]))
(google-cloud-sdk.withExtraComponents (
with google-cloud-sdk.components;
[
gke-gcloud-auth-plugin
]
))
# cloud tools that nix do not have cache for.
terraform

View File

@@ -3,7 +3,8 @@
pkgs-unstable,
nur-ryan4yin,
...
}: {
}:
{
home.packages = with pkgs; [
podman-compose
dive # explore docker layers

View File

@@ -1,3 +1,4 @@
{mylib, ...}: {
{ mylib, ... }:
{
imports = mylib.scanPaths ./.;
}

View File

@@ -2,7 +2,8 @@
pkgs,
pkgs-unstable,
...
}: {
}:
{
#############################################################
#
# Basic settings for development environment

View File

@@ -1,3 +1,4 @@
{mylib, ...}: {
{ mylib, ... }:
{
imports = mylib.scanPaths ./.;
}

View File

@@ -1,4 +1,5 @@
{pkgs, ...}: {
{ pkgs, ... }:
{
programs.helix = {
enable = true;
package = pkgs.helix;

View File

@@ -18,7 +18,8 @@ let
# the path to nvim directory
# to make this symlink work, we need to git clone this repo to your home directory.
configPath = "${config.home.homeDirectory}/nix-config/home/base/tui/editors/neovim/nvim";
in {
in
{
xdg.configFile."nvim".source = config.lib.file.mkOutOfStoreSymlink configPath;
# Disable catppuccin to avoid conflict with my non-nix config.
catppuccin.nvim.enable = false;

View File

@@ -2,153 +2,155 @@
pkgs,
pkgs-unstable,
...
}: {
home.packages = with pkgs; (
# -*- Data & Configuration Languages -*-#
[
#-- nix
nil
nixd
statix # Lints and suggestions for the nix programming language
deadnix # Find and remove unused code in .nix source files
nixfmt # Nix Code Formatter
}:
{
home.packages =
with pkgs;
(
# -*- Data & Configuration Languages -*-#
[
#-- nix
nil
nixd
statix # Lints and suggestions for the nix programming language
deadnix # Find and remove unused code in .nix source files
nixfmt # Nix Code Formatter
#-- nickel lang
nickel
#-- nickel lang
nickel
#-- json like
# terraform # install via brew on macOS
terraform-ls
jsonnet
jsonnet-language-server
taplo # TOML language server / formatter / validator
nodePackages.yaml-language-server
actionlint # GitHub Actions linter
#-- json like
# terraform # install via brew on macOS
terraform-ls
jsonnet
jsonnet-language-server
taplo # TOML language server / formatter / validator
nodePackages.yaml-language-server
actionlint # GitHub Actions linter
#-- dockerfile
hadolint # Dockerfile linter
nodePackages.dockerfile-language-server-nodejs
#-- dockerfile
hadolint # Dockerfile linter
nodePackages.dockerfile-language-server-nodejs
#-- markdown
marksman # language server for markdown
glow # markdown previewer
pandoc # document converter
pkgs-unstable.hugo # static site generator
#-- markdown
marksman # language server for markdown
glow # markdown previewer
pandoc # document converter
pkgs-unstable.hugo # static site generator
#-- sql
sqlfluff
#-- sql
sqlfluff
#-- protocol buffer
buf # linting and formatting
]
++
#-*- General Purpose Languages -*-#
[
#-- c/c++
cmake
cmake-language-server
gnumake
checkmake
# c/c++ compiler, required by nvim-treesitter!
gcc
gdb
# c/c++ tools with clang-tools, the unwrapped version won't
# add alias like `cc` and `c++`, so that it won't conflict with gcc
# llvmPackages.clang-unwrapped
clang-tools
lldb
vscode-extensions.vadimcn.vscode-lldb.adapter # codelldb - debugger
#-- protocol buffer
buf # linting and formatting
]
++
#-*- General Purpose Languages -*-#
[
#-- c/c++
cmake
cmake-language-server
gnumake
checkmake
# c/c++ compiler, required by nvim-treesitter!
gcc
gdb
# c/c++ tools with clang-tools, the unwrapped version won't
# add alias like `cc` and `c++`, so that it won't conflict with gcc
# llvmPackages.clang-unwrapped
clang-tools
lldb
vscode-extensions.vadimcn.vscode-lldb.adapter # codelldb - debugger
#-- python
pipx # Install and Run Python Applications in Isolated Environments
uv # python project package manager
pyright # python language server
(python313.withPackages (
ps:
with ps; [
ruff
black # python formatter
# debugpy
#-- python
pipx # Install and Run Python Applications in Isolated Environments
uv # python project package manager
pyright # python language server
(python313.withPackages (
ps: with ps; [
ruff
black # python formatter
# debugpy
# my commonly used python packages
jupyter
ipython
pandas
requests
pyquery
pyyaml
boto3
]
))
# my commonly used python packages
jupyter
ipython
pandas
requests
pyquery
pyyaml
boto3
]
))
#-- rust
# we'd better use the rust-overlays for rust development
pkgs-unstable.rustc
pkgs-unstable.rust-analyzer
pkgs-unstable.cargo # rust package manager
pkgs-unstable.rustfmt
pkgs-unstable.clippy # rust linter
#-- rust
# we'd better use the rust-overlays for rust development
pkgs-unstable.rustc
pkgs-unstable.rust-analyzer
pkgs-unstable.cargo # rust package manager
pkgs-unstable.rustfmt
pkgs-unstable.clippy # rust linter
#-- 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
#-- 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
jdt-language-server
# -- java
jdk17
gradle
maven
spring-boot-cli
jdt-language-server
#-- zig
zls
#-- zig
zls
#-- lua
stylua
lua-language-server
#-- lua
stylua
lua-language-server
#-- bash
nodePackages.bash-language-server
shellcheck
shfmt
]
#-*- Web Development -*-#
++ [
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"
emmet-ls
]
# -*- Lisp like Languages -*-#
# ++ [
# guile
# racket-minimal
# fnlfmt # fennel
# (
# if pkgs.stdenv.isLinux && pkgs.stdenv.isx86
# then pkgs-unstable.akkuPackages.scheme-langserver
# else pkgs.emptyDirectory
# )
# ]
++ [
proselint # English prose linter
#-- bash
nodePackages.bash-language-server
shellcheck
shfmt
]
#-*- Web Development -*-#
++ [
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"
emmet-ls
]
# -*- Lisp like Languages -*-#
# ++ [
# guile
# racket-minimal
# fnlfmt # fennel
# (
# if pkgs.stdenv.isLinux && pkgs.stdenv.isx86
# then pkgs-unstable.akkuPackages.scheme-langserver
# else pkgs.emptyDirectory
# )
# ]
++ [
proselint # English prose linter
#-- verilog / systemverilog
verible
#-- verilog / systemverilog
verible
#-- Optional Requirements:
nodePackages.prettier # common code formatter
fzf
gdu # disk usage analyzer, required by AstroNvim
(ripgrep.override {withPCRE2 = true;}) # recursively searches directories for a regex pattern
]
);
#-- Optional Requirements:
nodePackages.prettier # common code formatter
fzf
gdu # disk usage analyzer, required by AstroNvim
(ripgrep.override { withPCRE2 = true; }) # recursively searches directories for a regex pattern
]
);
}

View File

@@ -2,7 +2,8 @@
pkgs,
pkgs-unstable,
...
}: {
}:
{
home.packages = with pkgs; [
age
sops

View File

@@ -2,7 +2,8 @@
config,
mysecrets,
...
}: {
}:
{
programs.gpg = {
enable = true;
homedir = "${config.home.homeDirectory}/.gnupg";

View File

@@ -3,9 +3,11 @@
config,
lib,
...
}: let
}:
let
passwordStoreDir = "${config.xdg.dataHome}/password-store";
in {
in
{
programs.password-store = {
enable = true;
package = pkgs.pass.withExtensions (exts: [

View File

@@ -2,9 +2,11 @@
config,
pkgs-unstable,
...
}: let
}:
let
inherit (pkgs-unstable) nu_scripts;
in {
in
{
programs.nushell = {
# load the alias file for work
# the file must exist, otherwise nushell will complain about it!

View File

@@ -2,7 +2,8 @@
config,
mysecrets,
...
}: {
}:
{
home.file.".ssh/romantic.pub".source = "${mysecrets}/public/romantic.pub";
programs.ssh = {

View File

@@ -1,8 +1,10 @@
{pkgs, ...}: let
{ pkgs, ... }:
let
shellAliases = {
"zj" = "zellij";
};
in {
in
{
programs.zellij = {
enable = true;
package = pkgs.zellij;