mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-28 12:21:54 +01:00
refactor: systems
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
rec {
|
||||
let
|
||||
systemAttrs = {
|
||||
# linux systems
|
||||
x64_system = "x86_64-linux";
|
||||
riscv64_system = "riscv64-linux";
|
||||
aarch64_system = "aarch64-linux";
|
||||
# darwin systems
|
||||
x64_darwin = "x86_64-darwin";
|
||||
aarch64_darwin = "aarch64-darwin";
|
||||
};
|
||||
in systemAttrs // {
|
||||
# user information
|
||||
username = "ryan";
|
||||
userfullname = "Ryan Yin";
|
||||
useremail = "xiaoyin_c@qq.com";
|
||||
|
||||
# linux systems
|
||||
x64_system = "x86_64-linux";
|
||||
riscv64_system = "riscv64-linux";
|
||||
aarch64_system = "aarch64-linux";
|
||||
# darwin systems
|
||||
x64_darwin = "x86_64-darwin";
|
||||
aarch64_darwin = "aarch64-darwin";
|
||||
allSystems = [x64_system riscv64_system aarch64_system x64_darwin aarch64_darwin];
|
||||
allSystems = builtins.attrValues systemAttrs;
|
||||
}
|
||||
|
||||
@@ -18,14 +18,20 @@
|
||||
}
|
||||
// inputs;
|
||||
|
||||
allSystemSpecialArgs = with constants; {
|
||||
x64_system_specialArgs = specialArgsForSystem x64_system;
|
||||
aarch64_system_specialArgs = specialArgsForSystem aarch64_system;
|
||||
riscv64_system_specialArgs = specialArgsForSystem riscv64_system;
|
||||
|
||||
x64_darwin_specialArgs = specialArgsForSystem x64_darwin;
|
||||
aarch64_darwin_specialArgs = specialArgsForSystem aarch64_darwin;
|
||||
};
|
||||
allSystemSpecialArgs = builtins.listToAttrs (
|
||||
map
|
||||
(attr: {
|
||||
name = attr + "_specialArgs";
|
||||
value = specialArgsForSystem constants.${attr};
|
||||
})
|
||||
[
|
||||
"x64_system"
|
||||
"aarch64_system"
|
||||
"riscv64_system"
|
||||
"x64_darwin"
|
||||
"aarch64_darwin"
|
||||
]
|
||||
);
|
||||
|
||||
args = lib.attrsets.mergeAttrsList [
|
||||
inputs
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
args:
|
||||
with args; let
|
||||
lib = nixpkgs.lib;
|
||||
nixosSystem = import ../lib/nixosSystem.nix;
|
||||
|
||||
base_args = {
|
||||
@@ -23,25 +24,28 @@ in {
|
||||
|
||||
# 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"
|
||||
]
|
||||
packages."${x64_system}" = lib.attrsets.mergeAttrsList [
|
||||
(
|
||||
# lib.genAttrs [ "foo" "bar" ] (name: "x_" + name)
|
||||
# => { foo = "x_foo"; bar = "x_bar"; }
|
||||
nixpkgs.lib.genAttrs
|
||||
[
|
||||
"ai_i3"
|
||||
"ai_hyprland"
|
||||
]
|
||||
# generate iso image for hosts with desktop environment
|
||||
host:
|
||||
self.nixosConfigurations.${host}.config.formats.iso
|
||||
(host: self.nixosConfigurations.${host}.config.formats.iso)
|
||||
)
|
||||
// nixpkgs.lib.genAttrs [
|
||||
"aquamarine"
|
||||
"ruby"
|
||||
"kana"
|
||||
]
|
||||
|
||||
(
|
||||
nixpkgs.lib.genAttrs
|
||||
[
|
||||
"aquamarine"
|
||||
"ruby"
|
||||
"kana"
|
||||
]
|
||||
# generate proxmox image for virtual machines without desktop environment
|
||||
host:
|
||||
self.nixosConfigurations.${host}.config.formats.proxmox
|
||||
);
|
||||
(host: self.nixosConfigurations.${host}.config.formats.proxmox)
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user