feat: add comments, format all nix files

This commit is contained in:
Ryan Yin
2023-06-13 01:05:13 +08:00
parent 86114a4db1
commit dc0fc97cb9
47 changed files with 438 additions and 420 deletions

View File

@@ -1,4 +1,4 @@
{...}: {
{ ... }: {
programs.bash = {
enable = true;
enableCompletion = true;
@@ -15,4 +15,4 @@
httpproxy = "export https_proxy=http://127.0.0.1:7890; export http_proxy=http://127.0.0.1:7890;";
};
};
}
}

View File

@@ -1,9 +1,9 @@
{config, pkgs, ...}:
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
neofetch
nnn # terminal file manager
nnn # terminal file manager
# archives
zip
@@ -12,19 +12,19 @@
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
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
mtr # A network diagnostic tool
iperf3
ldns # replacement of dig, it provide the command `drill`
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
nmap # A utility for network discovery and security auditing
# misc
cowsay
@@ -45,8 +45,8 @@
nix-output-monitor
# productivity
hugo # static site generator
glow # markdown previewer in terminal
hugo # static site generator
glow # markdown previewer in terminal
];
programs = {
@@ -77,4 +77,4 @@
enableBashIntegration = true;
};
};
}
}

View File

@@ -1,4 +1,4 @@
{config, pkgs, ...}:
{ config, pkgs, ... }:
{
imports = [
./nushell
@@ -11,4 +11,4 @@
./starship.nix
];
}
}

View File

@@ -1,8 +1,8 @@
{config, pkgs, nil, ...}:
{ config, pkgs, nil, ... }:
{
home.packages = with pkgs; [
nil.packages."${pkgs.system}".default # nix language server
nil.packages."${pkgs.system}".default # nix language server
# IDE
jetbrains.pycharm-community
@@ -11,7 +11,7 @@
# cloud native
skopeo
docker-compose
dive # explore docker layers
dive # explore docker layers
kubectl
kubernetes-helm
terraform
@@ -27,7 +27,7 @@
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
gnumake # used by this repo, to simplify the deployment
clang-tools
clang-analyzer
# lldb
@@ -62,7 +62,7 @@
rustup
# python
(python310.withPackages(ps: with ps; [
(python310.withPackages (ps: with ps; [
ipython
pandas
requests
@@ -89,9 +89,9 @@
# adoptopenjdk-openj9-bin-17
# other tools
k6 # load testing tool
mitmproxy # http/https proxy tool
protobuf # protocol buffer compiler
k6 # load testing tool
mitmproxy # http/https proxy tool
protobuf # protocol buffer compiler
];
programs = {
@@ -104,9 +104,9 @@
};
direnv = {
enable = true;
nix-direnv.enable = true;
enableZshIntegration = true;
enable = true;
nix-direnv.enable = true;
enableZshIntegration = true;
};
};
@@ -114,4 +114,4 @@
programs.gh = {
enable = true;
};
}
}

View File

@@ -1,14 +1,13 @@
{
config,
lib,
pkgs,
...
{ 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"] ''
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
rm -f ~/.gitconfig
'';
@@ -58,4 +57,4 @@
};
};
};
}
}

View File

@@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}:
# processing audio/video
{
@@ -9,8 +8,8 @@
ffmpeg-full
# images
viu # terminal image viewer
viu # terminal image viewer
imagemagick
graphviz
];
}
}

View File

@@ -1,4 +1,4 @@
{...}: {
{ ... }: {
programs.nushell = {
enable = true;
configFile.source = ./config.nu;
@@ -18,4 +18,4 @@
httpproxy = "let-env https_proxy = http://127.0.0.1:7890; let-env http_proxy = http://127.0.0.1:7890;";
};
};
}
}

View File

@@ -1,10 +1,10 @@
{config, ...}: {
{ config, ... }: {
programs.starship = {
enable = true;
enableBashIntegration = true;
enableNushellIntegration = true;
settings = {
character = {
success_symbol = "[](bold green)";
@@ -12,4 +12,4 @@
};
};
};
}
}

View File

@@ -7,4 +7,4 @@
xdg.configFile."alacritty/alacritty.yml".source = ./alacritty.yml;
xdg.configFile."alacritty/theme_github_dark.yml".source = ./theme_github_dark.yml;
}
}

View File

@@ -8,7 +8,7 @@
# google-cloud-sdk telegram wireshark
{pkgs, ...}:
{ pkgs, ... }:
{
# MacOS specific configuration
home.packages = with pkgs; [

View File

@@ -3,13 +3,13 @@
{
imports = [
../base/nushell
../base/core.nix
../base/git.nix
../base/development.nix
../base/media.nix
../base/starship.nix
./alacritty
./core.nix
];
@@ -34,4 +34,4 @@
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}
}

View File

@@ -7,4 +7,4 @@
xdg.configFile."alacritty/alacritty.yml".source = ./alacritty.yml;
xdg.configFile."alacritty/theme_github_dark.yml".source = ./theme_github_dark.yml;
}
}

View File

@@ -1,11 +1,11 @@
{config, pkgs, nil, ...}:
{ config, pkgs, nil, ... }:
{
home.packages = with pkgs; [
nil.packages."${pkgs.system}".default # nix language server
nil.packages."${pkgs.system}".default # nix language server
# GUI IDE
insomnia # REST client
insomnia # REST client
# need to run `conda-install` before using it
# need to run `conda-shell` before using command `conda`
@@ -33,4 +33,4 @@
programs.gh = {
enable = true;
};
}
}

View File

@@ -1,10 +1,11 @@
{config, ...}:
{ config, ... }:
let
d = config.xdg.dataHome;
c = config.xdg.configHome;
cache = config.xdg.cacheHome;
in rec {
in
rec {
# add environment variables
systemd.user.sessionVariables = {
# clean up ~
@@ -29,4 +30,4 @@ in rec {
};
home.sessionVariables = systemd.user.sessionVariables;
}
}

View File

@@ -1,6 +1,5 @@
{
pkgs,
...
{ pkgs
, ...
}: {
programs.ssh = {
enable = true;
@@ -36,4 +35,4 @@
# check imported keys by `ssh-add -l`
# TODO `ssh-add` can only add keys temporary, use gnome-keyring to unlock all keys after login.
};
}
}

View File

@@ -1,31 +1,31 @@
{pkgs, config, ...}:
{ pkgs, config, ... }:
{
# Linux Only Packages, not available on Darwin
home.packages = with pkgs; [
btop # replacement of htop/nmon
btop # replacement of htop/nmon
htop
iotop
nmon
## networking tools
wireguard-tools # manage wireguard vpn manually, via wg-quick
wireguard-tools # manage wireguard vpn manually, via wg-quick
iftop
# misc
libnotify
# system call monitoring
strace # system call monitoring
ltrace # library call monitoring
lsof # list open files
strace # system call monitoring
ltrace # library call monitoring
lsof # list open files
# system tools
ethtool
sysstat
lm_sensors # for `sensors` command
cifs-utils # for mounting windows shares
lm_sensors # for `sensors` command
cifs-utils # for mounting windows shares
];
# auto mount usb drives

View File

@@ -2,10 +2,10 @@
# It's a bunch of specifications from freedesktop.org intended to standardize desktops and
# other GUI applications on various systems (primarily Unix-like) to be interoperable:
# https://www.freedesktop.org/wiki/Specifications/
{config, pkgs, ...}:
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
xdg-utils # provides cli tools such as `xdg-mime` `xdg-open`
xdg-user-dirs
];
@@ -22,13 +22,13 @@
# ls /etc/profiles/per-user/ryan/share/applications/
mimeApps = {
enable = true;
defaultApplications =
defaultApplications =
let
browser = ["firefox.desktop"];
browser = [ "firefox.desktop" ];
in
{
"application/json" = browser;
"application/pdf" = browser; # TODO: pdf viewer
"application/pdf" = browser; # TODO: pdf viewer
"text/html" = browser;
"text/xml" = browser;
@@ -48,18 +48,18 @@
"x-scheme-handler/http" = browser;
"x-scheme-handler/https" = browser;
"x-scheme-handler/unknown" = browser;
"x-scheme-handler/discord" = ["discord.desktop"];
"x-scheme-handler/tg" = ["telegramdesktop.desktop"];
"audio/*" = ["mpv.desktop"];
"video/*" = ["mpv.dekstop"];
"image/*" = ["imv.desktop"];
"x-scheme-handler/discord" = [ "discord.desktop" ];
"x-scheme-handler/tg" = [ "telegramdesktop.desktop" ];
"audio/*" = [ "mpv.desktop" ];
"video/*" = [ "mpv.dekstop" ];
"image/*" = [ "imv.desktop" ];
};
associations.removed =
let
browser = ["google-chrome.desktop"];
browser = [ "google-chrome.desktop" ];
in
{
"text/html" = browser;

View File

@@ -1,17 +1,16 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}:
{
home.packages = with pkgs; [
# creative
# blender # 3d modeling
# gimp # image editing, I prefer using figma in browser instead of this one
inkscape # vector graphics
krita # digital painting
inkscape # vector graphics
krita # digital painting
musescore # music notation
reaper # audio production
reaper # audio production
# this app consumes a lot of storage, so do not install it currently
# kicad # 3d printing, eletrical engineering
@@ -21,4 +20,4 @@
# live streaming
obs-studio.enable = true;
};
}
}

View File

@@ -16,13 +16,13 @@
# instant messaging
telegram-desktop
discord
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
qq # https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/networking/instant-messengers/qq
# remote desktop(rdp connect)
remmina
freerdp # required by remmina
freerdp # required by remmina
# misc
flameshot
];
}
}

View File

@@ -1,7 +1,6 @@
{
pkgs,
config,
...
{ pkgs
, config
, ...
}:
# media - control and enjoy audio/video
{
@@ -10,7 +9,7 @@
pavucontrol
playerctl
pulsemixer
imv # simple image viewer
imv # simple image viewer
nvtop
@@ -24,12 +23,12 @@
programs = {
mpv = {
enable = true;
defaultProfiles = ["gpu-hq"];
scripts = [pkgs.mpvScripts.mpris];
defaultProfiles = [ "gpu-hq" ];
scripts = [ pkgs.mpvScripts.mpris ];
};
};
services = {
playerctld.enable = true;
};
}
}

View File

@@ -1,24 +1,24 @@
{pkgs, config, lib, ... }: {
{ pkgs, config, lib, ... }: {
home.file.".config/fcitx5/profile".source = ./profile;
home.file.".config/fcitx5/profile-bak".source = ./profile; # used for backup
home.file.".config/fcitx5/profile-bak".source = ./profile; # used for backup
# fcitx5 每次切换输入法,就会修改 ~/.config/fcitx5/profile 文件,导致我用 hm 管理的配置被覆盖
# 解决方法是通过如下内置,每次 rebuild 前都先删除下 profile 文件
home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
home.activation.removeExistingFcitx5Profile = lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
rm -f "${config.xdg.configHome}/fcitx5/profile"
'';
i18n.inputMethod = {
enabled = "fcitx5";
fcitx5.addons = with pkgs; [
# for flypy chinese input method
fcitx5-rime
# needed enable rime using configtool after installed
fcitx5-configtool
fcitx5-chinese-addons
# fcitx5-mozc # japanese input method
fcitx5-gtk # gtk im module
];
# for flypy chinese input method
fcitx5-rime
# needed enable rime using configtool after installed
fcitx5-configtool
fcitx5-chinese-addons
# fcitx5-mozc # japanese input method
fcitx5-gtk # gtk im module
];
};
systemd.user.sessionVariables = {
@@ -28,6 +28,6 @@
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
INPUT_METHOD = "fcitx";
IMSETTINGS_MODULE = "fcitx";
IMSETTINGS_MODULE = "fcitx";
};
}
}

View File

@@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
imports = [
./wayland-apps.nix
@@ -25,8 +24,8 @@
fonts.fontconfig.enable = true;
systemd.user.sessionVariables = {
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland
"MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
"MOZ_WEBRENDER" = "1";
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/

View File

@@ -1,8 +1,7 @@
{
pkgs,
pkgs-stable,
...
}:
{ pkgs
, pkgs-stable
, ...
}:
{
# TODO vscode & chrome both have wayland support, but they don't work with fcitx5, need to fix it.
@@ -31,7 +30,7 @@
firefox = {
enable = true;
enableGnomeExtensions = false;
package = pkgs-stable.firefox-wayland; # firefox with wayland support
package = pkgs-stable.firefox-wayland; # firefox with wayland support
};
vscode = {

View File

@@ -1,8 +1,7 @@
{
pkgs,
config,
lib,
...
{ pkgs
, config
, lib
, ...
}: {
# i3 配置,基于 https://github.com/endeavouros-team/endeavouros-i3wm-setup
# 直接从当前文件夹中读取配置文件作为配置内容
@@ -20,7 +19,7 @@
source = ./scripts;
# copy the scripts directory recursively
recursive = true;
executable = true; # make all scripts executable
executable = true; # make all scripts executable
};
# rofi is a application launcher and dmenu replacement
@@ -56,4 +55,4 @@
package = pkgs.qogir-theme;
size = 64;
};
}
}

View File

@@ -1,6 +1,5 @@
{
pkgs,
...
{ pkgs
, ...
}: {
home.packages = with pkgs; [
firefox