feat: my custom libAttrs

This commit is contained in:
Ryan Yin
2023-12-23 10:56:33 +08:00
parent 27dd5ebb13
commit 82cfa4c6f7
6 changed files with 65 additions and 22 deletions

View File

@@ -1,7 +1,6 @@
args:
with args;
with allSystemAttrs; let
inherit (nixpkgs) lib;
colmenaSystem = import ../lib/colmenaSystem.nix;
# x86_64 related
x64_base_args = {
@@ -66,36 +65,36 @@ in {
};
# proxmox virtual machines(x86_64)
aquamarine = colmenaSystem (lib.attrsets.mergeAttrsList [
aquamarine = colmenaSystem (libAttrs.mergeAttrsList [
x64_base_args
idol_aquamarine_modules
{host_tags = idol_aquamarine_tags;}
]);
ruby = colmenaSystem (lib.attrsets.mergeAttrsList [
ruby = colmenaSystem (libAttrs.mergeAttrsList [
x64_base_args
idol_ruby_modules
{host_tags = idol_ruby_tags;}
]);
kana = colmenaSystem (lib.attrsets.mergeAttrsList [
kana = colmenaSystem (libAttrs.mergeAttrsList [
x64_base_args
idol_kana_modules
{host_tags = idol_kana_tags;}
]);
# riscv64 SBCs
nozomi = colmenaSystem (lib.attrsets.mergeAttrsList [
nozomi = colmenaSystem (libAttrs.mergeAttrsList [
lpi4a_base_args
rolling_nozomi_modules
{host_tags = rolling_nozomi_tags;}
]);
yukina = colmenaSystem (lib.attrsets.mergeAttrsList [
yukina = colmenaSystem (libAttrs.mergeAttrsList [
lpi4a_base_args
rolling_yukina_modules
{host_tags = rolling_yukina_tags;}
]);
# aarch64 SBCs
suzu = colmenaSystem (lib.attrsets.mergeAttrsList [
suzu = colmenaSystem (libAttrs.mergeAttrsList [
rk3588_base_args
_12kingdoms_suzu_modules
{host_tags = _12kingdoms_suzu_tags;}

View File

@@ -1,7 +1,6 @@
args:
with args;
with allSystemAttrs; let
inherit (nixpkgs) lib;
macosSystem = import ../lib/macosSystem.nix;
base_args = {
inherit nix-darwin home-manager;
@@ -11,7 +10,7 @@ in {
# macOS's configuration
darwinConfigurations = {
harmonica = macosSystem (
lib.attrsets.mergeAttrsList [
libAttrs.mergeAttrsList [
base_args
darwin_harmonica_modules
{
@@ -22,7 +21,7 @@ in {
);
fern = macosSystem (
lib.attrsets.mergeAttrsList [
libAttrs.mergeAttrsList [
base_args
darwin_fern_modules
{

View File

@@ -4,11 +4,13 @@
constants,
}: let
inherit (inputs.nixpkgs) lib;
libAttrs = import ../lib/attrs.nix {inherit lib;};
vars = import ./vars.nix;
specialArgsForSystem = system:
{
inherit (constants) username userfullname useremail;
inherit libAttrs;
# 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
@@ -19,18 +21,18 @@
// inputs;
allSystemSpecialArgs =
lib.attrsets.mapAttrs
(name: specialArgsForSystem)
libAttrs.mapAttrs
(_: specialArgsForSystem)
constants.allSystemAttrs;
args = lib.attrsets.mergeAttrsList [
args = libAttrs.mergeAttrsList [
inputs
constants
vars
{inherit self allSystemSpecialArgs;}
{inherit self lib libAttrs allSystemSpecialArgs;}
];
in
lib.attrsets.mergeAttrsList [
libAttrs.mergeAttrsList [
(import ./nixos.nix args)
(import ./darwin.nix args)
(import ./colmena.nix args)

View File

@@ -1,7 +1,6 @@
args:
with args;
with allSystemAttrs; let
inherit (nixpkgs) lib;
nixosSystem = import ../lib/nixosSystem.nix;
base_args = {
@@ -25,11 +24,9 @@ in {
# take system images for idols
# https://github.com/nix-community/nixos-generators
packages."${x64_system}" = lib.attrsets.mergeAttrsList [
packages."${x64_system}" = libAttrs.mergeAttrsList [
(
# lib.genAttrs [ "foo" "bar" ] (name: "x_" + name)
# => { foo = "x_foo"; bar = "x_bar"; }
nixpkgs.lib.genAttrs
libAttrs.listToAttrs
[
"ai_i3"
"ai_hyprland"
@@ -39,7 +36,7 @@ in {
)
(
nixpkgs.lib.genAttrs
libAttrs.listToAttrs
[
"aquamarine"
"ruby"