mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-23 17:28:33 +02:00
feat: refactoring configuration with options to make it more modular
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
args:
|
||||
with args;
|
||||
with mylib;
|
||||
with allSystemAttrs; let
|
||||
colmenaSystem = import ../lib/colmenaSystem.nix;
|
||||
# x86_64 related
|
||||
x64_base_args = {
|
||||
inherit home-manager;
|
||||
@@ -65,36 +65,36 @@ in {
|
||||
};
|
||||
|
||||
# proxmox virtual machines(x86_64)
|
||||
aquamarine = colmenaSystem (libAttrs.mergeAttrsList [
|
||||
aquamarine = colmenaSystem (attrs.mergeAttrsList [
|
||||
x64_base_args
|
||||
idol_aquamarine_modules
|
||||
{host_tags = idol_aquamarine_tags;}
|
||||
]);
|
||||
ruby = colmenaSystem (libAttrs.mergeAttrsList [
|
||||
ruby = colmenaSystem (attrs.mergeAttrsList [
|
||||
x64_base_args
|
||||
idol_ruby_modules
|
||||
{host_tags = idol_ruby_tags;}
|
||||
]);
|
||||
kana = colmenaSystem (libAttrs.mergeAttrsList [
|
||||
kana = colmenaSystem (attrs.mergeAttrsList [
|
||||
x64_base_args
|
||||
idol_kana_modules
|
||||
{host_tags = idol_kana_tags;}
|
||||
]);
|
||||
|
||||
# riscv64 SBCs
|
||||
nozomi = colmenaSystem (libAttrs.mergeAttrsList [
|
||||
nozomi = colmenaSystem (attrs.mergeAttrsList [
|
||||
lpi4a_base_args
|
||||
rolling_nozomi_modules
|
||||
{host_tags = rolling_nozomi_tags;}
|
||||
]);
|
||||
yukina = colmenaSystem (libAttrs.mergeAttrsList [
|
||||
yukina = colmenaSystem (attrs.mergeAttrsList [
|
||||
lpi4a_base_args
|
||||
rolling_yukina_modules
|
||||
{host_tags = rolling_yukina_tags;}
|
||||
]);
|
||||
|
||||
# aarch64 SBCs
|
||||
suzu = colmenaSystem (libAttrs.mergeAttrsList [
|
||||
suzu = colmenaSystem (attrs.mergeAttrsList [
|
||||
rk3588_base_args
|
||||
_12kingdoms_suzu_modules
|
||||
{host_tags = _12kingdoms_suzu_tags;}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
args:
|
||||
with args;
|
||||
with mylib;
|
||||
with allSystemAttrs; let
|
||||
macosSystem = import ../lib/macosSystem.nix;
|
||||
base_args = {
|
||||
inherit nix-darwin home-manager;
|
||||
nixpkgs = nixpkgs-darwin;
|
||||
@@ -10,7 +10,7 @@ in {
|
||||
# macOS's configuration
|
||||
darwinConfigurations = {
|
||||
harmonica = macosSystem (
|
||||
libAttrs.mergeAttrsList [
|
||||
attrs.mergeAttrsList [
|
||||
base_args
|
||||
darwin_harmonica_modules
|
||||
{
|
||||
@@ -21,7 +21,7 @@ in {
|
||||
);
|
||||
|
||||
fern = macosSystem (
|
||||
libAttrs.mergeAttrsList [
|
||||
attrs.mergeAttrsList [
|
||||
base_args
|
||||
darwin_fern_modules
|
||||
{
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
constants,
|
||||
}: let
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
libAttrs = import ../lib/attrs.nix {inherit lib;};
|
||||
mylib = import ../lib { inherit lib; };
|
||||
vars = import ./vars.nix;
|
||||
|
||||
specialArgsForSystem = system:
|
||||
{
|
||||
inherit (constants) username userfullname useremail;
|
||||
inherit libAttrs;
|
||||
inherit mylib;
|
||||
# use unstable branch for some packages to get the latest updates
|
||||
pkgs-unstable = import inputs.nixpkgs-unstable {
|
||||
inherit system; # refer the `system` parameter form outer scope recursively
|
||||
@@ -21,18 +21,18 @@
|
||||
// inputs;
|
||||
|
||||
allSystemSpecialArgs =
|
||||
libAttrs.mapAttrs
|
||||
mylib.attrs.mapAttrs
|
||||
(_: specialArgsForSystem)
|
||||
constants.allSystemAttrs;
|
||||
|
||||
args = libAttrs.mergeAttrsList [
|
||||
args = mylib.attrs.mergeAttrsList [
|
||||
inputs
|
||||
constants
|
||||
vars
|
||||
{inherit self lib libAttrs allSystemSpecialArgs;}
|
||||
{inherit self lib mylib allSystemSpecialArgs;}
|
||||
];
|
||||
in
|
||||
libAttrs.mergeAttrsList [
|
||||
mylib.attrs.mergeAttrsList [
|
||||
(import ./nixos.nix args)
|
||||
(import ./darwin.nix args)
|
||||
(import ./colmena.nix args)
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
args:
|
||||
with args;
|
||||
with mylib;
|
||||
with allSystemAttrs; let
|
||||
nixosSystem = import ../lib/nixosSystem.nix;
|
||||
|
||||
base_args = {
|
||||
inherit home-manager nixos-generators;
|
||||
inherit nixpkgs; # or nixpkgs-unstable
|
||||
@@ -24,9 +23,9 @@ in {
|
||||
|
||||
# take system images for idols
|
||||
# https://github.com/nix-community/nixos-generators
|
||||
packages."${x64_system}" = libAttrs.mergeAttrsList [
|
||||
packages."${x64_system}" = attrs.mergeAttrsList [
|
||||
(
|
||||
libAttrs.listToAttrs
|
||||
attrs.listToAttrs
|
||||
[
|
||||
"ai_i3"
|
||||
"ai_hyprland"
|
||||
@@ -36,7 +35,7 @@ in {
|
||||
)
|
||||
|
||||
(
|
||||
libAttrs.listToAttrs
|
||||
attrs.listToAttrs
|
||||
[
|
||||
"aquamarine"
|
||||
"ruby"
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
{
|
||||
rec {
|
||||
# 星野 アイ, Hoshino Ai
|
||||
__idol_ai_base_nixos_modules = [
|
||||
../hosts/idols/ai
|
||||
../secrets/nixos.nix
|
||||
../modules/nixos/desktop.nix
|
||||
];
|
||||
__idol_ai_base_home_modules = [
|
||||
../home/linux/desktop.nix
|
||||
];
|
||||
|
||||
idol_ai_modules_i3 = {
|
||||
nixos-modules = [
|
||||
../hosts/idols/ai
|
||||
../secrets/nixos.nix
|
||||
../modules/nixos/xorg.nix
|
||||
];
|
||||
home-module = {
|
||||
imports = [
|
||||
../home/linux/desktop.nix
|
||||
../home/linux/i3
|
||||
];
|
||||
};
|
||||
nixos-modules =
|
||||
[{modules.desktop.xorg.enable = true;}]
|
||||
++ __idol_ai_base_nixos_modules;
|
||||
home-module.imports =
|
||||
[{modules.desktop.i3.enable = true;}]
|
||||
++ __idol_ai_base_home_modules;
|
||||
};
|
||||
|
||||
idol_ai_modules_hyprland = {
|
||||
nixos-modules = [
|
||||
../hosts/idols/ai
|
||||
../secrets/nixos.nix
|
||||
../modules/nixos/wayland.nix
|
||||
];
|
||||
home-module = {
|
||||
imports = [
|
||||
../home/linux/desktop.nix
|
||||
../home/linux/hyprland
|
||||
];
|
||||
};
|
||||
nixos-modules =
|
||||
[{modules.desktop.wayland.enable = true;}]
|
||||
++ __idol_ai_base_nixos_modules;
|
||||
home-module.imports =
|
||||
[{modules.desktop.hyprland.enable = true;}]
|
||||
++ __idol_ai_base_home_modules;
|
||||
};
|
||||
|
||||
# 星野 愛久愛海, Hoshino Akuamarin
|
||||
|
||||
Reference in New Issue
Block a user