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,8 +1,6 @@
{ {pkgs, ...}: {
pkgs, home.packages = with pkgs;
... [
}: {
home.packages = with pkgs; [
# general tools # general tools
pulumi pulumi
pulumictl pulumictl
@@ -17,9 +15,14 @@
# aliyun # aliyun
aliyun-cli aliyun-cli
] ++ (if pkgs.stdenv.isLinux then [ ]
++ (
if pkgs.stdenv.isLinux
then [
# cloud tools that nix do not have cache for. # cloud tools that nix do not have cache for.
terraform terraform
terraformer # generate terraform configs from existing cloud resources terraformer # generate terraform configs from existing cloud resources
] else []); ]
else []
);
} }

View File

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

View File

@@ -12,10 +12,10 @@
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 (builtins.readFile skin_attr = builtins.fromJSON (
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" {} ''

View File

@@ -14,7 +14,8 @@
# #
############################################################# #############################################################
home.packages = with pkgs; [ home.packages = with pkgs;
[
(python3.withPackages ( (python3.withPackages (
ps: ps:
with ps; [ with ps; [
@@ -53,7 +54,10 @@
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 [ ]
++ (
if pkgs.stdenv.isLinux
then [
# Automatically trims your branches whose tracking remote refs are merged or gone # 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. # It's really useful when you work on a project for a long time.
git-trim git-trim
@@ -66,7 +70,9 @@
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

View File

@@ -25,8 +25,7 @@
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'

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";

View File

@@ -19,7 +19,6 @@
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`

View File

@@ -2,7 +2,6 @@
config, config,
lib, lib,
pkgs, pkgs,
userfullname, userfullname,
useremail, useremail,
... ...

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,7 +6,8 @@
enableZshIntegration = true; enableZshIntegration = true;
enableNushellIntegration = true; enableNushellIntegration = true;
settings = { settings =
{
character = { character = {
success_symbol = "[](bold green)"; success_symbol = "[](bold green)";
error_symbol = "[](bold red)"; error_symbol = "[](bold red)";
@@ -22,6 +23,7 @@
}; };
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,4 +1,4 @@
{ username, ... }: { {username, ...}: {
imports = [ imports = [
../base/desktop ../base/desktop

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

@@ -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

@@ -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.

View File

@@ -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 # custom cava config
'' + builtins.readFile "${catppuccin-cava}/mocha.cava"; ''
+ 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,8 +62,7 @@
"image/webp" = ["imv.desktop"]; "image/webp" = ["imv.desktop"];
}; };
associations.removed = associations.removed = {
{
# ...... # ......
}; };
}; };

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

@@ -10,7 +10,11 @@
}: 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;
@@ -25,7 +29,10 @@ in
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 [ ]
++ (
if (home-module != null)
then [
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
@@ -34,5 +41,7 @@ in
home-manager.extraSpecialArgs = specialArgs; home-manager.extraSpecialArgs = specialArgs;
home-manager.users."${username}" = home-module; home-manager.users."${username}" = home-module;
} }
] else []); ]
else []
);
} }

View File

@@ -1,4 +1,8 @@
{pkgs, config, ...}: { {
pkgs,
config,
...
}: {
########################################################################## ##########################################################################
# #
# Install all apps and packages here. # Install all apps and packages here.
@@ -25,7 +29,7 @@
]; ];
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

@@ -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

@@ -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
# ========================================================================= # =========================================================================

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
!= "default.nix" # ignore default.nix
&& f != "README.md" # ignore README.md && 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,
... ...
}: { }: {