feat: update git pre-commit checks

This commit is contained in:
Ryan Yin
2023-12-18 10:43:35 +08:00
parent 74cec7dd8e
commit 8d83ded0fb
11 changed files with 268 additions and 275 deletions
+22 -28
View File
@@ -13,19 +13,18 @@
# parameters in `outputs` are defined in `inputs` and can be referenced by their names. # parameters in `outputs` are defined in `inputs` and can be referenced by their names.
# However, `self` is an exception, this special parameter points to the `outputs` itself (self-reference) # However, `self` is an exception, this special parameter points to the `outputs` itself (self-reference)
# The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function. # The `@` syntax here is used to alias the attribute set of the inputs's parameter, making it convenient to use inside the function.
outputs = outputs = inputs @ {
inputs @ { self self,
, nixpkgs nixpkgs,
, nixpkgs-unstable nixpkgs-unstable,
, pre-commit-hooks pre-commit-hooks,
, nix-darwin nix-darwin,
, home-manager home-manager,
, nixos-generators nixos-generators,
, nixos-licheepi4a nixos-licheepi4a,
, nixos-rk3588 nixos-rk3588,
, ... ...
}: }: let
let
username = "ryan"; username = "ryan";
userfullname = "Ryan Yin"; userfullname = "Ryan Yin";
useremail = "xiaoyin_c@qq.com"; useremail = "xiaoyin_c@qq.com";
@@ -121,18 +120,15 @@
}; };
} }
// inputs; // inputs;
in in {
{ nixosConfigurations = let
nixosConfigurations =
let
base_args = { base_args = {
inherit home-manager nixos-generators; inherit home-manager nixos-generators;
nixpkgs = nixpkgs; # or nixpkgs-unstable nixpkgs = nixpkgs; # or nixpkgs-unstable
system = x64_system; system = x64_system;
specialArgs = x64_specialArgs; specialArgs = x64_specialArgs;
}; };
in in {
{
# ai with i3 window manager # ai with i3 window manager
ai_i3 = nixosSystem (idol_ai_modules_i3 // base_args); ai_i3 = nixosSystem (idol_ai_modules_i3 // base_args);
# ai with hyprland compositor # ai with hyprland compositor
@@ -145,8 +141,7 @@
}; };
# colmena - remote deployment via SSH # colmena - remote deployment via SSH
colmena = colmena = let
let
# x86_64 related # x86_64 related
x64_base_args = { x64_base_args = {
inherit home-manager; inherit home-manager;
@@ -184,8 +179,7 @@
specialArgs = rk3588_specialArgs; specialArgs = rk3588_specialArgs;
targetUser = "root"; targetUser = "root";
}; };
in in {
{
meta = { meta = {
nixpkgs = import nixpkgs {system = x64_system;}; nixpkgs = import nixpkgs {system = x64_system;};
specialArgs = x64_specialArgs; specialArgs = x64_specialArgs;
@@ -245,8 +239,7 @@
); );
# macOS's configuration, for work. # macOS's configuration, for work.
darwinConfigurations = darwinConfigurations = let
let
system = x64_darwin; system = x64_darwin;
specialArgs = specialArgs =
{ {
@@ -262,8 +255,7 @@
base_args = { base_args = {
inherit nix-darwin home-manager system specialArgs nixpkgs; inherit nix-darwin home-manager system specialArgs nixpkgs;
}; };
in in {
{
harmonica = macosSystem (base_args harmonica = macosSystem (base_args
// { // {
darwin-modules = [ darwin-modules = [
@@ -286,7 +278,9 @@
pre-commit-check = pre-commit-hooks.lib.${system}.run { pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.; src = ./.;
hooks = { hooks = {
alejandra.enable = true; alejandra.enable = true; # formatter
deadnix.enable = true; # detect unused variable bindings in `*.nix`
statix.enable = true; # lints and suggestions for Nix code(auto suggestions)
}; };
}; };
} }
+1 -1
View File
@@ -1,4 +1,4 @@
{...}: { _: {
programs.bash = { programs.bash = {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
+1 -1
View File
@@ -12,7 +12,7 @@
# Home Manager needs a bit of information about you and the # Home Manager needs a bit of information about you and the
# paths it should manage. # paths it should manage.
home = { home = {
username = username; inherit username;
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
# This value determines the Home Manager release that your # This value determines the Home Manager release that your
+1 -1
View File
@@ -12,7 +12,7 @@
# Home Manager needs a bit of information about you and the # Home Manager needs a bit of information about you and the
# paths it should manage. # paths it should manage.
home = { home = {
username = username; inherit username;
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
# This value determines the Home Manager release that your # This value determines the Home Manager release that your
+1 -1
View File
@@ -18,7 +18,7 @@
############################################################################################## ##############################################################################################
with lib; let with lib; let
cfg = config.home.immutable-file; cfg = config.home.immutable-file;
immutableFileOpts = {...}: { immutableFileOpts = _: {
options = { options = {
src = mkOption { src = mkOption {
type = types.path; type = types.path;
+1 -1
View File
@@ -5,7 +5,7 @@
# Home Manager needs a bit of information about you and the # Home Manager needs a bit of information about you and the
# paths it should manage. # paths it should manage.
home = { home = {
username = username; inherit username;
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
# This value determines the Home Manager release that your # This value determines the Home Manager release that your
+1 -1
View File
@@ -8,7 +8,7 @@
# Home Manager needs a bit of information about you and the # Home Manager needs a bit of information about you and the
# paths it should manage. # paths it should manage.
home = { home = {
username = username; inherit username;
homeDirectory = "/home/${username}"; homeDirectory = "/home/${username}";
# This value determines the Home Manager release that your # This value determines the Home Manager release that your
+2 -2
View File
@@ -8,7 +8,7 @@
host_tags, host_tags,
targetUser ? specialArgs.username, targetUser ? specialArgs.username,
}: let }: let
username = specialArgs.username; inherit (specialArgs) username;
in in
{ {
name, name,
@@ -16,8 +16,8 @@ in
... ...
}: { }: {
deployment = { deployment = {
inherit targetUser;
targetHost = name; # hostName or IP address targetHost = name; # hostName or IP address
targetUser = targetUser;
tags = host_tags; tags = host_tags;
}; };
+1 -1
View File
@@ -7,7 +7,7 @@
darwin-modules, darwin-modules,
home-module, home-module,
}: let }: let
username = specialArgs.username; inherit (specialArgs) username;
in in
nix-darwin.lib.darwinSystem { nix-darwin.lib.darwinSystem {
inherit system specialArgs; inherit system specialArgs;
+3 -4
View File
@@ -16,15 +16,14 @@
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
# Auto upgrade nix package and the daemon service. # Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true; # services.nix-daemon.enable = false;
#
# Use this instead of services.nix-daemon.enable if you # Use this instead of services.nix-daemon.enable if you
# don't wan't the daemon service to be managed for you. # don't wan't the daemon service to be managed for you.
# nix.useDaemon = true; nix.useDaemon = true;
nix.package = pkgs.nix; nix.package = pkgs.nix;
programs.nix-index.enable = true;
# Disable auto-optimise-store because of this issue: # Disable auto-optimise-store because of this issue:
# https://github.com/NixOS/nix/issues/7273 # https://github.com/NixOS/nix/issues/7273
# "error: cannot link '/nix/store/.tmp-link-xxxxx-xxxxx' to '/nix/store/.links/xxxx': File exists" # "error: cannot link '/nix/store/.tmp-link-xxxxx-xxxxx' to '/nix/store/.links/xxxx': File exists"
+1 -1
View File
@@ -1,6 +1,6 @@
# 为了不使用默认的 rime-data,改用我自定义的小鹤音形数据,这里需要 override # 为了不使用默认的 rime-data,改用我自定义的小鹤音形数据,这里需要 override
# 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix # 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix
{...}: (self: super: { _: (_: super: {
# 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」 # 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」
# 我仅修改了 default.yaml 文件,将其中的半角括号改为了直角括号「 与 」。 # 我仅修改了 default.yaml 文件,将其中的半角括号改为了直角括号「 与 」。
rime-data = ./rime-data-flypy; rime-data = ./rime-data-flypy;