nt/nib/sys/default.nix

51 lines
1.5 KiB
Nix
Raw Normal View History

2025-11-05 16:29:40 +10:00
{lib, ...}: let
# XXX: TODO: Move these helper functions into their own modules
listToTrivialAttrs = values:
builtins.listToAttrs (builtins.map (x: {
name = x;
value = x;
})
values);
in rec {
2025-11-05 13:46:44 +10:00
# REF: https://github.com/nix-systems/nix-systems
2025-12-13 11:05:18 +10:00
archs = listToTrivialAttrs [
2025-11-05 16:29:40 +10:00
"x86_64"
"aarch64"
"riscv64"
];
# REF: https://github.com/nix-systems/nix-systems
2025-12-13 11:05:18 +10:00
platforms = listToTrivialAttrs [
2025-11-05 16:29:40 +10:00
"linux"
"darwin"
];
# Nix System Identifier Lists - Default Supported Systems
2025-12-13 11:05:18 +10:00
# systems = systemsDefault;
systems.default = systems.x86_64 // systems.aarch64;
2025-11-05 13:46:44 +10:00
2025-11-05 16:29:40 +10:00
# Nix System Identifier Lists - All Potential Systems
2025-12-13 11:05:18 +10:00
systems.all = listsToSystemNames archs platforms;
2025-11-05 13:46:44 +10:00
2025-11-05 16:29:40 +10:00
# Nix System Identifier Lists - Platform Specific
2025-12-13 11:05:18 +10:00
systems.linux = listsToSystemNames archs [platforms.linux];
systems.darwin = listsToSystemNames archs [platforms.darwin];
2025-11-05 13:46:44 +10:00
2025-11-05 16:29:40 +10:00
# Nix System Identifier Lists - Architecture Specific
2025-12-13 11:05:18 +10:00
systems.x86_64 = listsToSystemNames [archs.x86_64] platforms;
systems.aarch64 = listsToSystemNames [archs.aarch64] platforms;
systems.riscv64 = listsToSystemNames [archs.riscv64] platforms;
2025-11-05 16:41:55 +10:00
# === Internal Helper Functions ===
toSystemName = arch: platform: "${arch}-${platform}";
listsToSystemNames = archs: platforms:
lib.lists.crossLists (arch: platform: toSystemName arch platform)
(with lib.attrsets; [
(attrValues archs)
(attrValues platforms)
]);
2025-11-05 16:41:55 +10:00
# === External Functions ===
# TODO
2025-11-05 13:46:44 +10:00
}