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, ...}: {
pkgs, home.packages = with pkgs;
... [
}: { # general tools
home.packages = with pkgs; [ pulumi
# general tools pulumictl
pulumi # istioctl
pulumictl
# istioctl
# aws # aws
awscli2 awscli2
ssm-session-manager-plugin # Amazon SSM Session Manager Plugin ssm-session-manager-plugin # Amazon SSM Session Manager Plugin
aws-iam-authenticator aws-iam-authenticator
eksctl eksctl
istioctl istioctl
# aliyun # aliyun
aliyun-cli aliyun-cli
] ++ (if pkgs.stdenv.isLinux then [ ]
# cloud tools that nix do not have cache for. ++ (
terraform if pkgs.stdenv.isLinux
terraformer # generate terraform configs from existing cloud resources then [
] else []); # 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 skopeo
docker-compose docker-compose
dive # explore docker layers dive # explore docker layers
]; ];
programs = { programs = {
}; };

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,8 @@
{ pkgs, catppuccin-helix, ... }:
{ {
pkgs,
catppuccin-helix,
...
}: {
# https://github.com/catppuccin/helix # https://github.com/catppuccin/helix
xdg.configFile."helix/themes".source = "${catppuccin-helix}/themes/default"; xdg.configFile."helix/themes".source = "${catppuccin-helix}/themes/default";
@@ -25,7 +27,7 @@
space.space = "file_picker"; space.space = "file_picker";
space.w = ":w"; space.w = ":w";
space.q = ":q"; 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 = { programs.bash = {
# load the alias file for work # load the alias file for work
bashrcExtra = '' bashrcExtra = ''

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
{ username, ... }: { {username, ...}: {
imports = [ imports = [
../base/desktop ../base/desktop
./proxychains ./proxychains
./core.nix ./core.nix

View File

@@ -1,4 +1,8 @@
{config, nushell-scripts, ...}: let {
config,
nushell-scripts,
...
}: let
d = config.xdg.dataHome; d = config.xdg.dataHome;
c = config.xdg.configHome; c = config.xdg.configHome;
cache = config.xdg.cacheHome; cache = config.xdg.cacheHome;

View File

@@ -13,7 +13,7 @@
strace # system call monitoring strace # system call monitoring
ltrace # library call monitoring ltrace # library call monitoring
bpftrace # powerful tracing tool bpftrace # powerful tracing tool
tcpdump # network sniffer tcpdump # network sniffer
lsof # list open files lsof # list open files
# system tools # system tools

View File

@@ -1,4 +1,4 @@
{ username, ... }: { {username, ...}: {
imports = [ imports = [
../base/desktop ../base/desktop

View File

@@ -1,4 +1,4 @@
{ username, ... }: { {username, ...}: {
imports = [ imports = [
../base/desktop ../base/desktop

View File

@@ -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
@@ -22,7 +22,7 @@
pkgs-unstable.yosys # fpga synthesis pkgs-unstable.yosys # fpga synthesis
pkgs-unstable.nextpnr # fpga place and route pkgs-unstable.nextpnr # fpga place and route
pkgs-unstable.openfpgaloader # fpga programming pkgs-unstable.openfpgaloader # fpga programming
nur-ryan4yin.packages.${pkgs.system}.gowin-eda-edu-ide # app: `gowin-env` => `gw_ide` / `gw_pack` / ... nur-ryan4yin.packages.${pkgs.system}.gowin-eda-edu-ide # app: `gowin-env` => `gw_ide` / `gw_pack` / ...
]; ];
programs = { programs = {

View File

@@ -27,7 +27,7 @@
# misc # misc
flameshot flameshot
ventoy # multi-boot usb creator ventoy # multi-boot usb creator
]; ];
# GitHub CLI tool # GitHub CLI tool

View File

@@ -1,4 +1,8 @@
{ pkgs, lib, ... }: { {
pkgs,
lib,
...
}: {
# Adjust the color temperature(& brightness) of your screen according to # Adjust the color temperature(& brightness) of your screen according to
# your surroundings. This may help your eyes hurt less if you are # your surroundings. This may help your eyes hurt less if you are
# working in front of the screen at night. # working in front of the screen at night.
@@ -18,7 +22,7 @@
# https://gitlab.com/chinstrap/gammastep/-/blob/master/gammastep.conf.sample?ref_type=heads # https://gitlab.com/chinstrap/gammastep/-/blob/master/gammastep.conf.sample?ref_type=heads
settings = { settings = {
general = { general = {
fade = "1"; # gradually apply the new screen temperature/brightness over a couple of seconds. fade = "1"; # gradually apply the new screen temperature/brightness over a couple of seconds.
# it is a fake brightness adjustment obtained by manipulating the gamma ramps, # it is a fake brightness adjustment obtained by manipulating the gamma ramps,
# which means that it does not reduce the backlight of the screen. # which means that it does not reduce the backlight of the screen.
# Preferably only use it if your normal backlight adjustment is too coarse-grained. # Preferably only use it if your normal backlight adjustment is too coarse-grained.

View File

@@ -4,7 +4,7 @@
... ...
}: { }: {
# If your themes for mouse cursor, icons or windows dont load correctly, # If your themes for mouse cursor, icons or windows dont load correctly,
# try setting them with home.pointerCursor and gtk.theme, # try setting them with home.pointerCursor and gtk.theme,
# which enable a bunch of compatibility options that should make the themes load in all situations. # which enable a bunch of compatibility options that should make the themes load in all situations.
home.pointerCursor = { home.pointerCursor = {
@@ -23,7 +23,7 @@
"*.dpi" = 150; "*.dpi" = 150;
}; };
# gtk's theme settings, generate files: # gtk's theme settings, generate files:
# 1. ~/.gtkrc-2.0 # 1. ~/.gtkrc-2.0
# 2. ~/.config/gtk-3.0/settings.ini # 2. ~/.config/gtk-3.0/settings.ini
# 3. ~/.config/gtk-4.0/settings.ini # 3. ~/.config/gtk-4.0/settings.ini
@@ -48,7 +48,7 @@
name = "Catppuccin-Macchiato-Compact-Pink-dark"; name = "Catppuccin-Macchiato-Compact-Pink-dark";
package = pkgs.catppuccin-gtk.override { package = pkgs.catppuccin-gtk.override {
# https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix # https://github.com/NixOS/nixpkgs/blob/nixos-23.05/pkgs/data/themes/catppuccin-gtk/default.nix
accents = [ "pink" ]; accents = ["pink"];
size = "compact"; size = "compact";
variant = "mocha"; variant = "mocha";
}; };

View File

@@ -24,9 +24,11 @@
]; ];
# https://github.com/catppuccin/cava # https://github.com/catppuccin/cava
home.file.".config/cava/config".text = '' home.file.".config/cava/config".text =
# custom cava config ''
'' + builtins.readFile "${catppuccin-cava}/mocha.cava"; # custom cava config
''
+ builtins.readFile "${catppuccin-cava}/mocha.cava";
programs = { programs = {
mpv = { mpv = {

View File

@@ -1,6 +1,4 @@
{ wallpapers, ... }: {wallpapers, ...}: {
{
# https://github.com/ryan4yin/wallpapers # https://github.com/ryan4yin/wallpapers
home.file.".config/wallpapers".source = wallpapers; home.file.".config/wallpapers".source = wallpapers;
home.file.".local/bin/wallpaper_random" = { home.file.".local/bin/wallpaper_random" = {

View File

@@ -62,10 +62,9 @@
"image/webp" = ["imv.desktop"]; "image/webp" = ["imv.desktop"];
}; };
associations.removed = associations.removed = {
{ # ......
# ...... };
};
}; };
userDirs = { userDirs = {

View File

@@ -1,6 +1,8 @@
{ pkgs, anyrun, ... }:
{ {
pkgs,
anyrun,
...
}: {
imports = [ imports = [
anyrun.homeManagerModules.default anyrun.homeManagerModules.default
]; ];
@@ -83,5 +85,4 @@
} }
''; '';
}; };
} }

View File

@@ -1,4 +1,4 @@
{ pkgs, ...}: { {pkgs, ...}: {
# i3 window manager's config, based on https://github.com/endeavouros-team/endeavouros-i3wm-setup # i3 window manager's config, based on https://github.com/endeavouros-team/endeavouros-i3wm-setup
imports = [ imports = [
@@ -43,5 +43,4 @@
"GBM_BACKEND" = "nvidia-drm"; "GBM_BACKEND" = "nvidia-drm";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; "__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
}; };
} }

View File

@@ -1,4 +1,4 @@
{ username, ... }: { {username, ...}: {
imports = [ imports = [
]; ];

View File

@@ -1,4 +1,4 @@
{ username, ... }: { {username, ...}: {
imports = [ imports = [
../base/server ../base/server

View File

@@ -1,4 +1,4 @@
{ username, ... } @ args: {username, ...} @ args:
############################################################# #############################################################
# #
# Harmonica - my MacBook Pro 2020 13-inch, mainly for business. # Harmonica - my MacBook Pro 2020 13-inch, mainly for business.

View File

@@ -1,7 +1,6 @@
{ {
config, config,
pkgs, pkgs,
username, username,
... ...
}: { }: {

View File

@@ -18,14 +18,13 @@
boot.loader.efi.efiSysMountPoint = "/boot"; boot.loader.efi.efiSysMountPoint = "/boot";
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
# boot.kernelPackages = pkgs.linuxPackages_latest; # boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelPackages = pkgs.linuxPackages_xanmod_latest; boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
boot.initrd.kernelModules = []; boot.initrd.kernelModules = [];
boot.kernelModules = ["kvm-intel"]; boot.kernelModules = ["kvm-intel"];
boot.kernelParams = [ "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ]; boot.kernelParams = ["nvidia.NVreg_PreserveVideoMemoryAllocations=1"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
# Enable binfmt emulation of aarch64-linux, this is required for cross compilation. # Enable binfmt emulation of aarch64-linux, this is required for cross compilation.
@@ -41,7 +40,6 @@
"cifs" # mount windows share "cifs" # mount windows share
]; ];
boot.initrd = { boot.initrd = {
# unlocked luks devices via a keyfile or prompt a passphrase. # unlocked luks devices via a keyfile or prompt a passphrase.
luks.devices."crypted-nixos" = { luks.devices."crypted-nixos" = {

View File

@@ -24,7 +24,6 @@
# #
# 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 # NOTE: impermanence only mounts the directory/file list below to /persistent
# If the directory/file already exists in the root filesystem, you should # If the directory/file already exists in the root filesystem, you should
# move those files/directories to /persistent first! # move those files/directories to /persistent first!

View File

@@ -38,7 +38,7 @@
# secrets are not supported well on riscv64, I nned to create this file manually. # secrets are not supported well on riscv64, I nned to create this file manually.
# Format: "PSK_WEMEET_PRIVATE_WIFI=your_password" # Format: "PSK_WEMEET_PRIVATE_WIFI=your_password"
environmentFile = "/etc/wpa_supplicant.env"; environmentFile = "/etc/wpa_supplicant.env";
# The network definitions to automatically connect to when wpa_supplicant is running. # The network definitions to automatically connect to when wpa_supplicant is running.
networks = { networks = {
# read WPAPSK from environmentFile # read WPAPSK from environmentFile
"shadow_light_ryan".psk = "@PSK_WEMEET_PRIVATE_WIFI@"; "shadow_light_ryan".psk = "@PSK_WEMEET_PRIVATE_WIFI@";

View File

@@ -38,7 +38,7 @@
# secrets are not supported well on riscv64, I nned to create this file manually. # secrets are not supported well on riscv64, I nned to create this file manually.
# Format: "PSK_WEMEET_PRIVATE_WIFI=your_password" # Format: "PSK_WEMEET_PRIVATE_WIFI=your_password"
environmentFile = "/etc/wpa_supplicant.env"; environmentFile = "/etc/wpa_supplicant.env";
# The network definitions to automatically connect to when wpa_supplicant is running. # The network definitions to automatically connect to when wpa_supplicant is running.
networks = { networks = {
# read WPAPSK from environmentFile # read WPAPSK from environmentFile
"shadow_light_ryan".psk = "@PSK_WEMEET_PRIVATE_WIFI@"; "shadow_light_ryan".psk = "@PSK_WEMEET_PRIVATE_WIFI@";

View File

@@ -10,9 +10,13 @@
}: let }: let
username = specialArgs.username; username = specialArgs.username;
in in
{ name, nodes, ... }: { {
name,
nodes,
...
}: {
deployment = { deployment = {
targetHost = name; # hostName or IP address targetHost = name; # hostName or IP address
targetUser = targetUser; targetUser = targetUser;
tags = host_tags; tags = host_tags;
}; };
@@ -23,16 +27,21 @@ in
{ {
# make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake. # make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake.
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
nix.channel.enable = false; # disable nix-channel, we use flakes instead. nix.channel.enable = false; # disable nix-channel, we use flakes instead.
} }
] ++ (if (home-module != null) then [ ]
home-manager.nixosModules.home-manager ++ (
{ if (home-module != null)
home-manager.useGlobalPkgs = true; then [
home-manager.useUserPackages = true; home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = specialArgs; home-manager.extraSpecialArgs = specialArgs;
home-manager.users."${username}" = home-module; home-manager.users."${username}" = home-module;
} }
] else []); ]
else []
);
} }

View File

@@ -28,7 +28,7 @@ in
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = specialArgs; home-manager.extraSpecialArgs = specialArgs;
home-manager.users."${username}" = home-module; home-manager.users."${username}" = home-module;
} }

View File

@@ -17,7 +17,7 @@ in
{ {
# make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake. # make `nix run nixpkgs#nixpkgs` use the same nixpkgs as the one used by this flake.
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
nix.channel.enable = false; # disable nix-channel, we use flakes instead. nix.channel.enable = false; # disable nix-channel, we use flakes instead.
} }
nixos-generators.nixosModules.all-formats nixos-generators.nixosModules.all-formats

View File

@@ -1,4 +1,8 @@
{pkgs, config, ...}: { {
pkgs,
config,
...
}: {
########################################################################## ##########################################################################
# #
# Install all apps and packages here. # Install all apps and packages here.
@@ -20,12 +24,12 @@
neovim neovim
git git
nushell # my custom shell nushell # my custom shell
gnugrep # replacee macos's grep gnugrep # replacee macos's grep
gnutar # replacee macos's tar gnutar # replacee macos's tar
]; ];
environment.variables = { environment.variables = {
# Fix https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues # Fix https://github.com/LnL7/nix-darwin/wiki/Terminfo-issues
TERMINFO_DIRS = map (path: path + "/share/terminfo") config.environment.profiles ++ [ "/usr/share/terminfo" ]; TERMINFO_DIRS = map (path: path + "/share/terminfo") config.environment.profiles ++ ["/usr/share/terminfo"];
EDITOR = "nvim"; EDITOR = "nvim";
}; };

View File

@@ -24,10 +24,10 @@
# customize dock # customize dock
dock = { dock = {
autohide = true; # automatically hide and show the dock autohide = true; # automatically hide and show the dock
show-recents = false; # do not show recent apps in dock show-recents = false; # do not show recent apps in dock
# do not automatically rearrange spaces based on most recent use. # do not automatically rearrange spaces based on most recent use.
mru-spaces = false; mru-spaces = false;
# customize Hot Corners(触发角, 鼠标移动到屏幕角落时触发的动作) # customize Hot Corners(触发角, 鼠标移动到屏幕角落时触发的动作)
wvous-tl-corner = 2; # top-left - Mission Control wvous-tl-corner = 2; # top-left - Mission Control
@@ -158,7 +158,7 @@
# will change to `fonts.packages` after this PR is merged: # will change to `fonts.packages` after this PR is merged:
# https://github.com/LnL7/nix-darwin/pull/754 # https://github.com/LnL7/nix-darwin/pull/754
fonts = with pkgs; [ fonts = with pkgs; [
# packages = with pkgs; [ # packages = with pkgs; [
# icon fonts # icon fonts
material-design-icons material-design-icons
font-awesome font-awesome

View File

@@ -1,5 +1,4 @@
{ username, ... }: {username, ...}: {
{
#################################################################### ####################################################################
# #
# NixOS's Configuration for Remote Building / Distributed Building # NixOS's Configuration for Remote Building / Distributed Building

View File

@@ -1,6 +1,4 @@
{ username, ... }: {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;
@@ -9,7 +7,7 @@
docker = {}; docker = {};
wireshark = {}; wireshark = {};
# for android platform tools's udev rules # for android platform tools's udev rules
adbusers ={}; adbusers = {};
dialout = {}; dialout = {};
# for openocd (embedded system development) # for openocd (embedded system development)
plugdev = {}; plugdev = {};

View File

@@ -34,9 +34,9 @@
enable = true; enable = true;
settings = { settings = {
default_session = { default_session = {
user = "ryan"; # Hyprland is installed only for user ryan via home-manager! user = "ryan"; # Hyprland is installed only for user ryan via home-manager!
command = "Hyprland"; # start Hyprland directly without a login manager command = "Hyprland"; # start Hyprland directly without a login manager
# command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland"; # start Hyprland with a TUI login manager # command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland"; # start Hyprland with a TUI login manager
}; };
}; };
}; };

View File

@@ -18,7 +18,7 @@
# https://github.com/NixOS/nixpkgs/issues/118655 # https://github.com/NixOS/nixpkgs/issues/118655
security.sudo.extraRules = [ security.sudo.extraRules = [
{ {
users = [ username ]; users = [username];
commands = [ commands = [
{ {
command = "ALL"; command = "ALL";

View File

@@ -1,5 +1,4 @@
{pkgs, ...}: { {pkgs, ...}: {
# ========================================================================= # =========================================================================
# Base NixOS Configuration # Base NixOS Configuration
# ========================================================================= # =========================================================================
@@ -27,12 +26,12 @@
neovim neovim
# networking # networking
mtr # A network diagnostic tool mtr # A network diagnostic tool
iperf3 # A tool for measuring TCP and UDP bandwidth performance iperf3 # A tool for measuring TCP and UDP bandwidth performance
nmap # A utility for network discovery and security auditing nmap # A utility for network discovery and security auditing
ldns # replacement of dig, it provide the command `drill` ldns # replacement of dig, it provide the command `drill`
socat # replacement of openbsd-netcat socat # replacement of openbsd-netcat
tcpdump # A powerful command-line packet analyzer tcpdump # A powerful command-line packet analyzer
# archives # archives
zip zip
@@ -66,7 +65,7 @@
enable = true; enable = true;
settings = { settings = {
X11Forwarding = true; X11Forwarding = true;
PermitRootLogin = "prohibit-password"; # disable root login with password PermitRootLogin = "prohibit-password"; # disable root login with password
PasswordAuthentication = false; # disable password login PasswordAuthentication = false; # disable password login
}; };
openFirewall = true; openFirewall = true;

View File

@@ -5,8 +5,10 @@ builtins.map
(builtins.filter # find all overlay files in the current directory (builtins.filter # find all overlay files in the current directory
(f: (
f != "default.nix" # ignore default.nix f:
&& f != "README.md" # ignore README.md f
!= "default.nix" # ignore default.nix
&& f != "README.md" # ignore README.md
) )
(builtins.attrNames (builtins.readDir ./.))) (builtins.attrNames (builtins.readDir ./.)))

View File

@@ -3,7 +3,6 @@
pkgs, pkgs,
agenix, agenix,
mysecrets, mysecrets,
username, username,
... ...
}: { }: {

View File

@@ -3,7 +3,6 @@
pkgs, pkgs,
agenix, agenix,
mysecrets, mysecrets,
username, username,
... ...
}: { }: {