mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-07-15 00:52:39 +02:00
feat: update git pre-commit checks
This commit is contained in:
@@ -13,293 +13,287 @@
|
|||||||
# 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";
|
|
||||||
|
|
||||||
x64_system = "x86_64-linux";
|
x64_system = "x86_64-linux";
|
||||||
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;
|
||||||
colmenaSystem = import ./lib/colmenaSystem.nix;
|
colmenaSystem = import ./lib/colmenaSystem.nix;
|
||||||
|
|
||||||
# 星野 アイ, Hoshino Ai
|
# 星野 アイ, Hoshino Ai
|
||||||
idol_ai_modules_i3 = {
|
idol_ai_modules_i3 = {
|
||||||
nixos-modules = [
|
nixos-modules = [
|
||||||
./hosts/idols/ai
|
./hosts/idols/ai
|
||||||
./modules/nixos/i3.nix
|
./modules/nixos/i3.nix
|
||||||
];
|
];
|
||||||
home-module = import ./home/linux/desktop-i3.nix;
|
home-module = import ./home/linux/desktop-i3.nix;
|
||||||
|
};
|
||||||
|
idol_ai_modules_hyprland = {
|
||||||
|
nixos-modules = [
|
||||||
|
./hosts/idols/ai
|
||||||
|
./modules/nixos/hyprland.nix
|
||||||
|
];
|
||||||
|
home-module = import ./home/linux/desktop-hyprland.nix;
|
||||||
|
};
|
||||||
|
|
||||||
|
# 星野 愛久愛海, Hoshino Akuamarin
|
||||||
|
idol_aquamarine_modules = {
|
||||||
|
nixos-modules = [
|
||||||
|
./hosts/idols/aquamarine
|
||||||
|
];
|
||||||
|
home-module = import ./home/linux/server.nix;
|
||||||
|
};
|
||||||
|
idol_aquamarine_tags = ["dist-build" "aqua"];
|
||||||
|
|
||||||
|
# 星野 瑠美衣, Hoshino Rubii
|
||||||
|
idol_ruby_modules = {
|
||||||
|
nixos-modules = [
|
||||||
|
./hosts/idols/ruby
|
||||||
|
];
|
||||||
|
home-module = import ./home/linux/server.nix;
|
||||||
|
};
|
||||||
|
idol_ruby_tags = ["dist-build" "ruby"];
|
||||||
|
|
||||||
|
# 有馬 かな, Arima Kana
|
||||||
|
idol_kana_modules = {
|
||||||
|
nixos-modules = [
|
||||||
|
./hosts/idols/kana
|
||||||
|
];
|
||||||
|
home-module = import ./home/linux/server.nix;
|
||||||
|
};
|
||||||
|
idol_kana_tags = ["dist-build" "kana"];
|
||||||
|
|
||||||
|
# 森友 望未, Moritomo Nozomi
|
||||||
|
rolling_nozomi_modules = {
|
||||||
|
nixos-modules = [
|
||||||
|
./hosts/rolling_girls/nozomi
|
||||||
|
];
|
||||||
|
# home-module = import ./home/linux/server-riscv64.nix;
|
||||||
|
};
|
||||||
|
rolling_nozomi_tags = ["riscv" "nozomi"];
|
||||||
|
|
||||||
|
# 小坂 結季奈, Kosaka Yukina
|
||||||
|
rolling_yukina_modules = {
|
||||||
|
nixos-modules = [
|
||||||
|
./hosts/rolling_girls/yukina
|
||||||
|
];
|
||||||
|
# home-module = import ./home/linux/server-riscv64.nix;
|
||||||
|
};
|
||||||
|
rolling_yukina_tags = ["riscv" "yukina"];
|
||||||
|
|
||||||
|
# 大木 鈴, Ōki Suzu
|
||||||
|
_12kingdoms_suzu_modules = {
|
||||||
|
nixos-modules = [
|
||||||
|
./hosts/12kingdoms/suzu
|
||||||
|
];
|
||||||
|
# home-module = import ./home/linux/server.nix;
|
||||||
|
};
|
||||||
|
_12kingdoms_suzu_tags = ["aarch" "suzu"];
|
||||||
|
|
||||||
|
x64_specialArgs =
|
||||||
|
{
|
||||||
|
inherit username userfullname useremail;
|
||||||
|
# use unstable branch for some packages to get the latest updates
|
||||||
|
pkgs-unstable = import nixpkgs-unstable {
|
||||||
|
system = x64_system; # refer the `system` parameter form outer scope recursively
|
||||||
|
# To use chrome, we need to allow the installation of non-free software
|
||||||
|
config.allowUnfree = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// inputs;
|
||||||
|
in {
|
||||||
|
nixosConfigurations = let
|
||||||
|
base_args = {
|
||||||
|
inherit home-manager nixos-generators;
|
||||||
|
nixpkgs = nixpkgs; # or nixpkgs-unstable
|
||||||
|
system = x64_system;
|
||||||
|
specialArgs = x64_specialArgs;
|
||||||
};
|
};
|
||||||
idol_ai_modules_hyprland = {
|
in {
|
||||||
nixos-modules = [
|
# ai with i3 window manager
|
||||||
./hosts/idols/ai
|
ai_i3 = nixosSystem (idol_ai_modules_i3 // base_args);
|
||||||
./modules/nixos/hyprland.nix
|
# ai with hyprland compositor
|
||||||
];
|
ai_hyprland = nixosSystem (idol_ai_modules_hyprland // base_args);
|
||||||
home-module = import ./home/linux/desktop-hyprland.nix;
|
|
||||||
|
# three virtual machines without desktop environment.
|
||||||
|
aquamarine = nixosSystem (idol_aquamarine_modules // base_args);
|
||||||
|
ruby = nixosSystem (idol_ruby_modules // base_args);
|
||||||
|
kana = nixosSystem (idol_kana_modules // base_args);
|
||||||
|
};
|
||||||
|
|
||||||
|
# colmena - remote deployment via SSH
|
||||||
|
colmena = let
|
||||||
|
# x86_64 related
|
||||||
|
x64_base_args = {
|
||||||
|
inherit home-manager;
|
||||||
|
nixpkgs = nixpkgs; # or nixpkgs-unstable
|
||||||
|
specialArgs = x64_specialArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
# 星野 愛久愛海, Hoshino Akuamarin
|
# riscv64 related
|
||||||
idol_aquamarine_modules = {
|
# using the same nixpkgs as nixos-licheepi4a to utilize the cross-compilation cache.
|
||||||
nixos-modules = [
|
lpi4a_pkgs = import nixos-licheepi4a.inputs.nixpkgs {system = x64_system;};
|
||||||
./hosts/idols/aquamarine
|
lpi4a_specialArgs =
|
||||||
];
|
{
|
||||||
home-module = import ./home/linux/server.nix;
|
inherit username userfullname useremail;
|
||||||
|
pkgsKernel = nixos-licheepi4a.packages.${x64_system}.pkgsKernelCross;
|
||||||
|
}
|
||||||
|
// inputs;
|
||||||
|
lpi4a_base_args = {
|
||||||
|
inherit home-manager;
|
||||||
|
nixpkgs = nixos-licheepi4a.inputs.nixpkgs; # or nixpkgs-unstable
|
||||||
|
specialArgs = lpi4a_specialArgs;
|
||||||
|
targetUser = "root";
|
||||||
};
|
};
|
||||||
idol_aquamarine_tags = [ "dist-build" "aqua" ];
|
|
||||||
|
|
||||||
# 星野 瑠美衣, Hoshino Rubii
|
# aarch64 related
|
||||||
idol_ruby_modules = {
|
# using the same nixpkgs as nixos-rk3588 to utilize the cross-compilation cache.
|
||||||
nixos-modules = [
|
rk3588_pkgs = import nixos-rk3588.inputs.nixpkgs {system = x64_system;};
|
||||||
./hosts/idols/ruby
|
rk3588_specialArgs =
|
||||||
];
|
{
|
||||||
home-module = import ./home/linux/server.nix;
|
inherit username userfullname useremail;
|
||||||
|
}
|
||||||
|
// nixos-rk3588.inputs;
|
||||||
|
rk3588_base_args = {
|
||||||
|
inherit home-manager;
|
||||||
|
nixpkgs = nixos-rk3588.inputs.nixpkgs; # or nixpkgs-unstable
|
||||||
|
specialArgs = rk3588_specialArgs;
|
||||||
|
targetUser = "root";
|
||||||
};
|
};
|
||||||
idol_ruby_tags = [ "dist-build" "ruby" ];
|
in {
|
||||||
|
meta = {
|
||||||
|
nixpkgs = import nixpkgs {system = x64_system;};
|
||||||
|
specialArgs = x64_specialArgs;
|
||||||
|
|
||||||
# 有馬 かな, Arima Kana
|
nodeSpecialArgs = {
|
||||||
idol_kana_modules = {
|
# riscv64 SBCs
|
||||||
nixos-modules = [
|
nozomi = lpi4a_specialArgs;
|
||||||
./hosts/idols/kana
|
yukina = lpi4a_specialArgs;
|
||||||
];
|
|
||||||
home-module = import ./home/linux/server.nix;
|
# aarch64 SBCs
|
||||||
|
suzu = rk3588_specialArgs;
|
||||||
|
};
|
||||||
|
nodeNixpkgs = {
|
||||||
|
nozomi = lpi4a_pkgs;
|
||||||
|
yukina = lpi4a_pkgs;
|
||||||
|
|
||||||
|
# aarch64 SBCs
|
||||||
|
suzu = rk3588_pkgs;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
idol_kana_tags = [ "dist-build" "kana" ];
|
|
||||||
|
|
||||||
# 森友 望未, Moritomo Nozomi
|
# proxmox virtual machines(x86_64)
|
||||||
rolling_nozomi_modules = {
|
aquamarine = colmenaSystem (idol_aquamarine_modules // x64_base_args // {host_tags = idol_aquamarine_tags;});
|
||||||
nixos-modules = [
|
ruby = colmenaSystem (idol_ruby_modules // x64_base_args // {host_tags = idol_ruby_tags;});
|
||||||
./hosts/rolling_girls/nozomi
|
kana = colmenaSystem (idol_kana_modules // x64_base_args // {host_tags = idol_kana_tags;});
|
||||||
];
|
|
||||||
# home-module = import ./home/linux/server-riscv64.nix;
|
|
||||||
};
|
|
||||||
rolling_nozomi_tags = [ "riscv" "nozomi" ];
|
|
||||||
|
|
||||||
# 小坂 結季奈, Kosaka Yukina
|
# riscv64 SBCs
|
||||||
rolling_yukina_modules = {
|
nozomi = colmenaSystem (rolling_nozomi_modules // lpi4a_base_args // {host_tags = rolling_nozomi_tags;});
|
||||||
nixos-modules = [
|
yukina = colmenaSystem (rolling_yukina_modules // lpi4a_base_args // {host_tags = rolling_yukina_tags;});
|
||||||
./hosts/rolling_girls/yukina
|
|
||||||
];
|
|
||||||
# home-module = import ./home/linux/server-riscv64.nix;
|
|
||||||
};
|
|
||||||
rolling_yukina_tags = [ "riscv" "yukina" ];
|
|
||||||
|
|
||||||
# 大木 鈴, Ōki Suzu
|
# aarch64 SBCs
|
||||||
_12kingdoms_suzu_modules = {
|
suzu = colmenaSystem (_12kingdoms_suzu_modules // rk3588_base_args // {host_tags = _12kingdoms_suzu_tags;});
|
||||||
nixos-modules = [
|
};
|
||||||
./hosts/12kingdoms/suzu
|
|
||||||
];
|
|
||||||
# home-module = import ./home/linux/server.nix;
|
|
||||||
};
|
|
||||||
_12kingdoms_suzu_tags = [ "aarch" "suzu" ];
|
|
||||||
|
|
||||||
x64_specialArgs =
|
# take system images for idols
|
||||||
|
# https://github.com/nix-community/nixos-generators
|
||||||
|
packages."${x64_system}" =
|
||||||
|
# genAttrs returns an attribute set with the given keys and values(host => image).
|
||||||
|
nixpkgs.lib.genAttrs [
|
||||||
|
"ai_i3"
|
||||||
|
"ai_hyprland"
|
||||||
|
]
|
||||||
|
(
|
||||||
|
# generate iso image for hosts with desktop environment
|
||||||
|
host:
|
||||||
|
self.nixosConfigurations.${host}.config.formats.iso
|
||||||
|
)
|
||||||
|
// nixpkgs.lib.genAttrs [
|
||||||
|
"aquamarine"
|
||||||
|
"ruby"
|
||||||
|
"kana"
|
||||||
|
]
|
||||||
|
(
|
||||||
|
# generate proxmox image for virtual machines without desktop environment
|
||||||
|
host:
|
||||||
|
self.nixosConfigurations.${host}.config.formats.proxmox
|
||||||
|
);
|
||||||
|
|
||||||
|
# macOS's configuration, for work.
|
||||||
|
darwinConfigurations = let
|
||||||
|
system = x64_darwin;
|
||||||
|
specialArgs =
|
||||||
{
|
{
|
||||||
inherit username userfullname useremail;
|
inherit username userfullname useremail;
|
||||||
# use unstable branch for some packages to get the latest updates
|
# use unstable branch for some packages to get the latest updates
|
||||||
pkgs-unstable = import nixpkgs-unstable {
|
pkgs-unstable = import nixpkgs-unstable {
|
||||||
system = x64_system; # refer the `system` parameter form outer scope recursively
|
inherit system; # refer the `system` parameter form outer scope recursively
|
||||||
# To use chrome, we need to allow the installation of non-free software
|
# To use chrome, we need to allow the installation of non-free software
|
||||||
config.allowUnfree = true;
|
config.allowUnfree = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// inputs;
|
// inputs;
|
||||||
in
|
base_args = {
|
||||||
{
|
inherit nix-darwin home-manager system specialArgs nixpkgs;
|
||||||
nixosConfigurations =
|
};
|
||||||
let
|
in {
|
||||||
base_args = {
|
harmonica = macosSystem (base_args
|
||||||
inherit home-manager nixos-generators;
|
// {
|
||||||
nixpkgs = nixpkgs; # or nixpkgs-unstable
|
darwin-modules = [
|
||||||
system = x64_system;
|
./hosts/harmonica
|
||||||
specialArgs = x64_specialArgs;
|
];
|
||||||
};
|
home-module = import ./home/darwin;
|
||||||
in
|
});
|
||||||
{
|
|
||||||
# ai with i3 window manager
|
|
||||||
ai_i3 = nixosSystem (idol_ai_modules_i3 // base_args);
|
|
||||||
# ai with hyprland compositor
|
|
||||||
ai_hyprland = nixosSystem (idol_ai_modules_hyprland // base_args);
|
|
||||||
|
|
||||||
# three virtual machines without desktop environment.
|
|
||||||
aquamarine = nixosSystem (idol_aquamarine_modules // base_args);
|
|
||||||
ruby = nixosSystem (idol_ruby_modules // base_args);
|
|
||||||
kana = nixosSystem (idol_kana_modules // base_args);
|
|
||||||
};
|
|
||||||
|
|
||||||
# colmena - remote deployment via SSH
|
|
||||||
colmena =
|
|
||||||
let
|
|
||||||
# x86_64 related
|
|
||||||
x64_base_args = {
|
|
||||||
inherit home-manager;
|
|
||||||
nixpkgs = nixpkgs; # or nixpkgs-unstable
|
|
||||||
specialArgs = x64_specialArgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
# 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_specialArgs =
|
|
||||||
{
|
|
||||||
inherit username userfullname useremail;
|
|
||||||
pkgsKernel = nixos-licheepi4a.packages.${x64_system}.pkgsKernelCross;
|
|
||||||
}
|
|
||||||
// inputs;
|
|
||||||
lpi4a_base_args = {
|
|
||||||
inherit home-manager;
|
|
||||||
nixpkgs = nixos-licheepi4a.inputs.nixpkgs; # or nixpkgs-unstable
|
|
||||||
specialArgs = lpi4a_specialArgs;
|
|
||||||
targetUser = "root";
|
|
||||||
};
|
|
||||||
|
|
||||||
# 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_specialArgs =
|
|
||||||
{
|
|
||||||
inherit username userfullname useremail;
|
|
||||||
}
|
|
||||||
// nixos-rk3588.inputs;
|
|
||||||
rk3588_base_args = {
|
|
||||||
inherit home-manager;
|
|
||||||
nixpkgs = nixos-rk3588.inputs.nixpkgs; # or nixpkgs-unstable
|
|
||||||
specialArgs = rk3588_specialArgs;
|
|
||||||
targetUser = "root";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
meta = {
|
|
||||||
nixpkgs = import nixpkgs { system = x64_system; };
|
|
||||||
specialArgs = x64_specialArgs;
|
|
||||||
|
|
||||||
nodeSpecialArgs = {
|
|
||||||
# riscv64 SBCs
|
|
||||||
nozomi = lpi4a_specialArgs;
|
|
||||||
yukina = lpi4a_specialArgs;
|
|
||||||
|
|
||||||
# aarch64 SBCs
|
|
||||||
suzu = rk3588_specialArgs;
|
|
||||||
};
|
|
||||||
nodeNixpkgs = {
|
|
||||||
nozomi = lpi4a_pkgs;
|
|
||||||
yukina = lpi4a_pkgs;
|
|
||||||
|
|
||||||
# aarch64 SBCs
|
|
||||||
suzu = rk3588_pkgs;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# 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; });
|
|
||||||
|
|
||||||
# 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; });
|
|
||||||
|
|
||||||
# aarch64 SBCs
|
|
||||||
suzu = colmenaSystem (_12kingdoms_suzu_modules // rk3588_base_args // { host_tags = _12kingdoms_suzu_tags; });
|
|
||||||
};
|
|
||||||
|
|
||||||
# take system images for idols
|
|
||||||
# https://github.com/nix-community/nixos-generators
|
|
||||||
packages."${x64_system}" =
|
|
||||||
# genAttrs returns an attribute set with the given keys and values(host => image).
|
|
||||||
nixpkgs.lib.genAttrs [
|
|
||||||
"ai_i3"
|
|
||||||
"ai_hyprland"
|
|
||||||
]
|
|
||||||
(
|
|
||||||
# generate iso image for hosts with desktop environment
|
|
||||||
host:
|
|
||||||
self.nixosConfigurations.${host}.config.formats.iso
|
|
||||||
)
|
|
||||||
// nixpkgs.lib.genAttrs [
|
|
||||||
"aquamarine"
|
|
||||||
"ruby"
|
|
||||||
"kana"
|
|
||||||
]
|
|
||||||
(
|
|
||||||
# generate proxmox image for virtual machines without desktop environment
|
|
||||||
host:
|
|
||||||
self.nixosConfigurations.${host}.config.formats.proxmox
|
|
||||||
);
|
|
||||||
|
|
||||||
# macOS's configuration, for work.
|
|
||||||
darwinConfigurations =
|
|
||||||
let
|
|
||||||
system = x64_darwin;
|
|
||||||
specialArgs =
|
|
||||||
{
|
|
||||||
inherit username userfullname useremail;
|
|
||||||
# use unstable branch for some packages to get the latest updates
|
|
||||||
pkgs-unstable = import nixpkgs-unstable {
|
|
||||||
inherit system; # refer the `system` parameter form outer scope recursively
|
|
||||||
# To use chrome, we need to allow the installation of non-free software
|
|
||||||
config.allowUnfree = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// inputs;
|
|
||||||
base_args = {
|
|
||||||
inherit nix-darwin home-manager system specialArgs nixpkgs;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
harmonica = macosSystem (base_args
|
|
||||||
// {
|
|
||||||
darwin-modules = [
|
|
||||||
./hosts/harmonica
|
|
||||||
];
|
|
||||||
home-module = import ./home/darwin;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
# format the nix code in this flake
|
|
||||||
# alejandra is a nix formatter with a beautiful output
|
|
||||||
formatter = nixpkgs.lib.genAttrs allSystems (
|
|
||||||
system:
|
|
||||||
nixpkgs.legacyPackages.${system}.alejandra
|
|
||||||
);
|
|
||||||
|
|
||||||
# pre-commit hooks for nix code
|
|
||||||
checks = nixpkgs.lib.genAttrs allSystems (
|
|
||||||
system: {
|
|
||||||
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
|
||||||
src = ./.;
|
|
||||||
hooks = {
|
|
||||||
alejandra.enable = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
devShells = nixpkgs.lib.genAttrs allSystems (
|
|
||||||
system: {
|
|
||||||
default = nixpkgs.legacyPackages.${system}.mkShell {
|
|
||||||
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# format the nix code in this flake
|
||||||
|
# alejandra is a nix formatter with a beautiful output
|
||||||
|
formatter = nixpkgs.lib.genAttrs allSystems (
|
||||||
|
system:
|
||||||
|
nixpkgs.legacyPackages.${system}.alejandra
|
||||||
|
);
|
||||||
|
|
||||||
|
# pre-commit hooks for nix code
|
||||||
|
checks = nixpkgs.lib.genAttrs allSystems (
|
||||||
|
system: {
|
||||||
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
||||||
|
src = ./.;
|
||||||
|
hooks = {
|
||||||
|
alejandra.enable = true; # formatter
|
||||||
|
deadnix.enable = true; # detect unused variable bindings in `*.nix`
|
||||||
|
statix.enable = true; # lints and suggestions for Nix code(auto suggestions)
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
devShells = nixpkgs.lib.genAttrs allSystems (
|
||||||
|
system: {
|
||||||
|
default = nixpkgs.legacyPackages.${system}.mkShell {
|
||||||
|
inherit (self.checks.${system}.pre-commit-check) shellHook;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
# This is the standard format for flake.nix. `inputs` are the dependencies of the flake,
|
# This is the standard format for flake.nix. `inputs` are the dependencies of the flake,
|
||||||
# Each item in `inputs` will be passed as a parameter to the `outputs` function after being pulled and built.
|
# Each item in `inputs` will be passed as a parameter to the `outputs` function after being pulled and built.
|
||||||
inputs = {
|
inputs = {
|
||||||
|
|||||||
@@ -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