mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-17 01:51:10 +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.
|
||||
# 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.
|
||||
outputs =
|
||||
inputs @ { self
|
||||
, nixpkgs
|
||||
, nixpkgs-unstable
|
||||
, pre-commit-hooks
|
||||
, nix-darwin
|
||||
, home-manager
|
||||
, nixos-generators
|
||||
, nixos-licheepi4a
|
||||
, nixos-rk3588
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
outputs = inputs @ {
|
||||
self,
|
||||
nixpkgs,
|
||||
nixpkgs-unstable,
|
||||
pre-commit-hooks,
|
||||
nix-darwin,
|
||||
home-manager,
|
||||
nixos-generators,
|
||||
nixos-licheepi4a,
|
||||
nixos-rk3588,
|
||||
...
|
||||
}: let
|
||||
username = "ryan";
|
||||
userfullname = "Ryan Yin";
|
||||
useremail = "xiaoyin_c@qq.com";
|
||||
@@ -34,7 +33,7 @@
|
||||
x64_darwin = "x86_64-darwin";
|
||||
riscv64_system = "riscv64-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;
|
||||
macosSystem = import ./lib/macosSystem.nix;
|
||||
@@ -63,7 +62,7 @@
|
||||
];
|
||||
home-module = import ./home/linux/server.nix;
|
||||
};
|
||||
idol_aquamarine_tags = [ "dist-build" "aqua" ];
|
||||
idol_aquamarine_tags = ["dist-build" "aqua"];
|
||||
|
||||
# 星野 瑠美衣, Hoshino Rubii
|
||||
idol_ruby_modules = {
|
||||
@@ -72,7 +71,7 @@
|
||||
];
|
||||
home-module = import ./home/linux/server.nix;
|
||||
};
|
||||
idol_ruby_tags = [ "dist-build" "ruby" ];
|
||||
idol_ruby_tags = ["dist-build" "ruby"];
|
||||
|
||||
# 有馬 かな, Arima Kana
|
||||
idol_kana_modules = {
|
||||
@@ -81,7 +80,7 @@
|
||||
];
|
||||
home-module = import ./home/linux/server.nix;
|
||||
};
|
||||
idol_kana_tags = [ "dist-build" "kana" ];
|
||||
idol_kana_tags = ["dist-build" "kana"];
|
||||
|
||||
# 森友 望未, Moritomo Nozomi
|
||||
rolling_nozomi_modules = {
|
||||
@@ -90,7 +89,7 @@
|
||||
];
|
||||
# home-module = import ./home/linux/server-riscv64.nix;
|
||||
};
|
||||
rolling_nozomi_tags = [ "riscv" "nozomi" ];
|
||||
rolling_nozomi_tags = ["riscv" "nozomi"];
|
||||
|
||||
# 小坂 結季奈, Kosaka Yukina
|
||||
rolling_yukina_modules = {
|
||||
@@ -99,7 +98,7 @@
|
||||
];
|
||||
# home-module = import ./home/linux/server-riscv64.nix;
|
||||
};
|
||||
rolling_yukina_tags = [ "riscv" "yukina" ];
|
||||
rolling_yukina_tags = ["riscv" "yukina"];
|
||||
|
||||
# 大木 鈴, Ōki Suzu
|
||||
_12kingdoms_suzu_modules = {
|
||||
@@ -108,7 +107,7 @@
|
||||
];
|
||||
# home-module = import ./home/linux/server.nix;
|
||||
};
|
||||
_12kingdoms_suzu_tags = [ "aarch" "suzu" ];
|
||||
_12kingdoms_suzu_tags = ["aarch" "suzu"];
|
||||
|
||||
x64_specialArgs =
|
||||
{
|
||||
@@ -121,18 +120,15 @@
|
||||
};
|
||||
}
|
||||
// inputs;
|
||||
in
|
||||
{
|
||||
nixosConfigurations =
|
||||
let
|
||||
in {
|
||||
nixosConfigurations = let
|
||||
base_args = {
|
||||
inherit home-manager nixos-generators;
|
||||
nixpkgs = nixpkgs; # or nixpkgs-unstable
|
||||
system = x64_system;
|
||||
specialArgs = x64_specialArgs;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
# ai with i3 window manager
|
||||
ai_i3 = nixosSystem (idol_ai_modules_i3 // base_args);
|
||||
# ai with hyprland compositor
|
||||
@@ -145,8 +141,7 @@
|
||||
};
|
||||
|
||||
# colmena - remote deployment via SSH
|
||||
colmena =
|
||||
let
|
||||
colmena = let
|
||||
# x86_64 related
|
||||
x64_base_args = {
|
||||
inherit home-manager;
|
||||
@@ -156,7 +151,7 @@
|
||||
|
||||
# riscv64 related
|
||||
# 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 =
|
||||
{
|
||||
inherit username userfullname useremail;
|
||||
@@ -172,7 +167,7 @@
|
||||
|
||||
# aarch64 related
|
||||
# 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 =
|
||||
{
|
||||
inherit username userfullname useremail;
|
||||
@@ -184,10 +179,9 @@
|
||||
specialArgs = rk3588_specialArgs;
|
||||
targetUser = "root";
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
meta = {
|
||||
nixpkgs = import nixpkgs { system = x64_system; };
|
||||
nixpkgs = import nixpkgs {system = x64_system;};
|
||||
specialArgs = x64_specialArgs;
|
||||
|
||||
nodeSpecialArgs = {
|
||||
@@ -208,16 +202,16 @@
|
||||
};
|
||||
|
||||
# proxmox virtual machines(x86_64)
|
||||
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; });
|
||||
kana = colmenaSystem (idol_kana_modules // x64_base_args // { host_tags = idol_kana_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;});
|
||||
kana = colmenaSystem (idol_kana_modules // x64_base_args // {host_tags = idol_kana_tags;});
|
||||
|
||||
# riscv64 SBCs
|
||||
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; });
|
||||
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;});
|
||||
|
||||
# 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
|
||||
@@ -245,8 +239,7 @@
|
||||
);
|
||||
|
||||
# macOS's configuration, for work.
|
||||
darwinConfigurations =
|
||||
let
|
||||
darwinConfigurations = let
|
||||
system = x64_darwin;
|
||||
specialArgs =
|
||||
{
|
||||
@@ -262,8 +255,7 @@
|
||||
base_args = {
|
||||
inherit nix-darwin home-manager system specialArgs nixpkgs;
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
harmonica = macosSystem (base_args
|
||||
// {
|
||||
darwin-modules = [
|
||||
@@ -286,7 +278,9 @@
|
||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
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 = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home = {
|
||||
username = username;
|
||||
inherit username;
|
||||
homeDirectory = "/home/${username}";
|
||||
|
||||
# This value determines the Home Manager release that your
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home = {
|
||||
username = username;
|
||||
inherit username;
|
||||
homeDirectory = "/home/${username}";
|
||||
|
||||
# This value determines the Home Manager release that your
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
##############################################################################################
|
||||
with lib; let
|
||||
cfg = config.home.immutable-file;
|
||||
immutableFileOpts = {...}: {
|
||||
immutableFileOpts = _: {
|
||||
options = {
|
||||
src = mkOption {
|
||||
type = types.path;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home = {
|
||||
username = username;
|
||||
inherit username;
|
||||
homeDirectory = "/home/${username}";
|
||||
|
||||
# This value determines the Home Manager release that your
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Home Manager needs a bit of information about you and the
|
||||
# paths it should manage.
|
||||
home = {
|
||||
username = username;
|
||||
inherit username;
|
||||
homeDirectory = "/home/${username}";
|
||||
|
||||
# This value determines the Home Manager release that your
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
host_tags,
|
||||
targetUser ? specialArgs.username,
|
||||
}: let
|
||||
username = specialArgs.username;
|
||||
inherit (specialArgs) username;
|
||||
in
|
||||
{
|
||||
name,
|
||||
@@ -16,8 +16,8 @@ in
|
||||
...
|
||||
}: {
|
||||
deployment = {
|
||||
inherit targetUser;
|
||||
targetHost = name; # hostName or IP address
|
||||
targetUser = targetUser;
|
||||
tags = host_tags;
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
darwin-modules,
|
||||
home-module,
|
||||
}: let
|
||||
username = specialArgs.username;
|
||||
inherit (specialArgs) username;
|
||||
in
|
||||
nix-darwin.lib.darwinSystem {
|
||||
inherit system specialArgs;
|
||||
|
||||
@@ -16,15 +16,14 @@
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# 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
|
||||
# don't wan't the daemon service to be managed for you.
|
||||
# nix.useDaemon = true;
|
||||
nix.useDaemon = true;
|
||||
|
||||
nix.package = pkgs.nix;
|
||||
|
||||
programs.nix-index.enable = true;
|
||||
|
||||
# Disable auto-optimise-store because of this issue:
|
||||
# https://github.com/NixOS/nix/issues/7273
|
||||
# "error: cannot link '/nix/store/.tmp-link-xxxxx-xxxxx' to '/nix/store/.links/xxxx': File exists"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 为了不使用默认的 rime-data,改用我自定义的小鹤音形数据,这里需要 override
|
||||
# 参考 https://github.com/NixOS/nixpkgs/blob/e4246ae1e7f78b7087dce9c9da10d28d3725025f/pkgs/tools/inputmethods/fcitx5/fcitx5-rime.nix
|
||||
{...}: (self: super: {
|
||||
_: (_: super: {
|
||||
# 小鹤音形配置,配置来自 flypy.com 官方网盘的鼠须管配置压缩包「小鹤音形“鼠须管”for macOS.zip」
|
||||
# 我仅修改了 default.yaml 文件,将其中的半角括号改为了直角括号「 与 」。
|
||||
rime-data = ./rime-data-flypy;
|
||||
|
||||
Reference in New Issue
Block a user