mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-16 09:32:39 +02:00
feat: update git pre-commit checks
This commit is contained in:
@@ -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";
|
||||||
@@ -34,7 +33,7 @@
|
|||||||
x64_darwin = "x86_64-darwin";
|
x64_darwin = "x86_64-darwin";
|
||||||
riscv64_system = "riscv64-linux";
|
riscv64_system = "riscv64-linux";
|
||||||
aarch64_system = "aarch64-linux";
|
aarch64_system = "aarch64-linux";
|
||||||
allSystems = [ x64_system x64_darwin riscv64_system aarch64_system ];
|
allSystems = [x64_system x64_darwin riscv64_system aarch64_system];
|
||||||
|
|
||||||
nixosSystem = import ./lib/nixosSystem.nix;
|
nixosSystem = import ./lib/nixosSystem.nix;
|
||||||
macosSystem = import ./lib/macosSystem.nix;
|
macosSystem = import ./lib/macosSystem.nix;
|
||||||
@@ -63,7 +62,7 @@
|
|||||||
];
|
];
|
||||||
home-module = import ./home/linux/server.nix;
|
home-module = import ./home/linux/server.nix;
|
||||||
};
|
};
|
||||||
idol_aquamarine_tags = [ "dist-build" "aqua" ];
|
idol_aquamarine_tags = ["dist-build" "aqua"];
|
||||||
|
|
||||||
# 星野 瑠美衣, Hoshino Rubii
|
# 星野 瑠美衣, Hoshino Rubii
|
||||||
idol_ruby_modules = {
|
idol_ruby_modules = {
|
||||||
@@ -72,7 +71,7 @@
|
|||||||
];
|
];
|
||||||
home-module = import ./home/linux/server.nix;
|
home-module = import ./home/linux/server.nix;
|
||||||
};
|
};
|
||||||
idol_ruby_tags = [ "dist-build" "ruby" ];
|
idol_ruby_tags = ["dist-build" "ruby"];
|
||||||
|
|
||||||
# 有馬 かな, Arima Kana
|
# 有馬 かな, Arima Kana
|
||||||
idol_kana_modules = {
|
idol_kana_modules = {
|
||||||
@@ -81,7 +80,7 @@
|
|||||||
];
|
];
|
||||||
home-module = import ./home/linux/server.nix;
|
home-module = import ./home/linux/server.nix;
|
||||||
};
|
};
|
||||||
idol_kana_tags = [ "dist-build" "kana" ];
|
idol_kana_tags = ["dist-build" "kana"];
|
||||||
|
|
||||||
# 森友 望未, Moritomo Nozomi
|
# 森友 望未, Moritomo Nozomi
|
||||||
rolling_nozomi_modules = {
|
rolling_nozomi_modules = {
|
||||||
@@ -90,7 +89,7 @@
|
|||||||
];
|
];
|
||||||
# home-module = import ./home/linux/server-riscv64.nix;
|
# home-module = import ./home/linux/server-riscv64.nix;
|
||||||
};
|
};
|
||||||
rolling_nozomi_tags = [ "riscv" "nozomi" ];
|
rolling_nozomi_tags = ["riscv" "nozomi"];
|
||||||
|
|
||||||
# 小坂 結季奈, Kosaka Yukina
|
# 小坂 結季奈, Kosaka Yukina
|
||||||
rolling_yukina_modules = {
|
rolling_yukina_modules = {
|
||||||
@@ -99,7 +98,7 @@
|
|||||||
];
|
];
|
||||||
# home-module = import ./home/linux/server-riscv64.nix;
|
# home-module = import ./home/linux/server-riscv64.nix;
|
||||||
};
|
};
|
||||||
rolling_yukina_tags = [ "riscv" "yukina" ];
|
rolling_yukina_tags = ["riscv" "yukina"];
|
||||||
|
|
||||||
# 大木 鈴, Ōki Suzu
|
# 大木 鈴, Ōki Suzu
|
||||||
_12kingdoms_suzu_modules = {
|
_12kingdoms_suzu_modules = {
|
||||||
@@ -108,7 +107,7 @@
|
|||||||
];
|
];
|
||||||
# home-module = import ./home/linux/server.nix;
|
# home-module = import ./home/linux/server.nix;
|
||||||
};
|
};
|
||||||
_12kingdoms_suzu_tags = [ "aarch" "suzu" ];
|
_12kingdoms_suzu_tags = ["aarch" "suzu"];
|
||||||
|
|
||||||
x64_specialArgs =
|
x64_specialArgs =
|
||||||
{
|
{
|
||||||
@@ -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;
|
||||||
@@ -156,7 +151,7 @@
|
|||||||
|
|
||||||
# riscv64 related
|
# riscv64 related
|
||||||
# using the same nixpkgs as nixos-licheepi4a to utilize the cross-compilation cache.
|
# using the same nixpkgs as nixos-licheepi4a to utilize the cross-compilation cache.
|
||||||
lpi4a_pkgs = import nixos-licheepi4a.inputs.nixpkgs { system = x64_system; };
|
lpi4a_pkgs = import nixos-licheepi4a.inputs.nixpkgs {system = x64_system;};
|
||||||
lpi4a_specialArgs =
|
lpi4a_specialArgs =
|
||||||
{
|
{
|
||||||
inherit username userfullname useremail;
|
inherit username userfullname useremail;
|
||||||
@@ -172,7 +167,7 @@
|
|||||||
|
|
||||||
# aarch64 related
|
# aarch64 related
|
||||||
# using the same nixpkgs as nixos-rk3588 to utilize the cross-compilation cache.
|
# using the same nixpkgs as nixos-rk3588 to utilize the cross-compilation cache.
|
||||||
rk3588_pkgs = import nixos-rk3588.inputs.nixpkgs { system = x64_system; };
|
rk3588_pkgs = import nixos-rk3588.inputs.nixpkgs {system = x64_system;};
|
||||||
rk3588_specialArgs =
|
rk3588_specialArgs =
|
||||||
{
|
{
|
||||||
inherit username userfullname useremail;
|
inherit username userfullname useremail;
|
||||||
@@ -184,10 +179,9 @@
|
|||||||
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;
|
||||||
|
|
||||||
nodeSpecialArgs = {
|
nodeSpecialArgs = {
|
||||||
@@ -208,16 +202,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# proxmox virtual machines(x86_64)
|
# proxmox virtual machines(x86_64)
|
||||||
aquamarine = colmenaSystem (idol_aquamarine_modules // x64_base_args // { host_tags = idol_aquamarine_tags; });
|
aquamarine = colmenaSystem (idol_aquamarine_modules // x64_base_args // {host_tags = idol_aquamarine_tags;});
|
||||||
ruby = colmenaSystem (idol_ruby_modules // x64_base_args // { host_tags = idol_ruby_tags; });
|
ruby = colmenaSystem (idol_ruby_modules // x64_base_args // {host_tags = idol_ruby_tags;});
|
||||||
kana = colmenaSystem (idol_kana_modules // x64_base_args // { host_tags = idol_kana_tags; });
|
kana = colmenaSystem (idol_kana_modules // x64_base_args // {host_tags = idol_kana_tags;});
|
||||||
|
|
||||||
# riscv64 SBCs
|
# riscv64 SBCs
|
||||||
nozomi = colmenaSystem (rolling_nozomi_modules // lpi4a_base_args // { host_tags = rolling_nozomi_tags; });
|
nozomi = colmenaSystem (rolling_nozomi_modules // lpi4a_base_args // {host_tags = rolling_nozomi_tags;});
|
||||||
yukina = colmenaSystem (rolling_yukina_modules // lpi4a_base_args // { host_tags = rolling_yukina_tags; });
|
yukina = colmenaSystem (rolling_yukina_modules // lpi4a_base_args // {host_tags = rolling_yukina_tags;});
|
||||||
|
|
||||||
# aarch64 SBCs
|
# aarch64 SBCs
|
||||||
suzu = colmenaSystem (_12kingdoms_suzu_modules // rk3588_base_args // { host_tags = _12kingdoms_suzu_tags; });
|
suzu = colmenaSystem (_12kingdoms_suzu_modules // rk3588_base_args // {host_tags = _12kingdoms_suzu_tags;});
|
||||||
};
|
};
|
||||||
|
|
||||||
# take system images for idols
|
# take system images for idols
|
||||||
@@ -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,4 +1,4 @@
|
|||||||
{...}: {
|
_: {
|
||||||
programs.bash = {
|
programs.bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
@@ -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;
|
||||||
|
|||||||
@@ -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,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;
|
||||||
|
|||||||
Reference in New Issue
Block a user