This commit is contained in:
Ryan Yin
2024-08-16 14:45:46 +08:00
parent 07178984b1
commit 35eb6ed5c9
41 changed files with 34 additions and 3023 deletions
-38
View File
@@ -1,38 +0,0 @@
{
lib,
inputs,
...
} @ args: let
inherit (inputs) haumea;
# Contains all the flake outputs of this system architecture.
data = haumea.lib.load {
src = ./src;
inputs = args;
};
# nix file names is redundant, so we remove it.
dataWithoutPaths = builtins.attrValues data;
# Merge all the machine's data into a single attribute set.
outputs = {
nixosConfigurations = lib.attrsets.mergeAttrsList (map (it: it.nixosConfigurations or {}) dataWithoutPaths);
packages = lib.attrsets.mergeAttrsList (map (it: it.packages or {}) dataWithoutPaths);
# colmena contains some meta info, which need to be merged carefully.
colmenaMeta = {
nodeNixpkgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeNixpkgs or {}) dataWithoutPaths);
nodeSpecialArgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeSpecialArgs or {}) dataWithoutPaths);
};
# colmena's per-machine data.
colmena = lib.attrsets.mergeAttrsList (map (it: it.colmena or {}) dataWithoutPaths);
};
in
outputs
// {
inherit data; # for debugging purposes
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {inherit outputs;};
};
}
@@ -1,67 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
} @ args: let
# 楽俊, Rakushun
name = "rakushun";
tags = [name "aarch"];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
"secrets/nixos.nix"
"modules/nixos/server/server-aarch64.nix"
# host specific modules
"hosts/12kingdoms-${name}"
])
++ [
];
home-modules =
map mylib.relativeToRoot [
];
};
inherit (inputs) nixos-rk3588;
baseSpecialArgs = genSpecialArgs system;
rk3588Pkgs = import nixos-rk3588.inputs.nixpkgs {inherit system;};
rk3588SpecialArgs = let
# using the same nixpkgs as nixos-rk3588
inherit (nixos-rk3588.inputs) nixpkgs;
# use aarch64-linux's native toolchain
pkgsKernel = import nixpkgs {inherit system;};
in
baseSpecialArgs
// {
inherit nixpkgs;
# Provide rk3588 inputs as special argument
rk3588 = {inherit nixpkgs pkgsKernel;};
};
rk3588SystemArgs =
modules
// args
// {
inherit (nixos-rk3588.inputs) nixpkgs; # or nixpkgs-unstable
specialArgs = rk3588SpecialArgs;
};
in {
nixosConfigurations.${name} = mylib.nixosSystem rk3588SystemArgs;
colmenaMeta = {
nodeSpecialArgs.${name} = rk3588SpecialArgs;
nodeNixpkgs.${name} = rk3588Pkgs;
};
colmena.${name} =
mylib.colmenaSystem
(rk3588SystemArgs // {inherit tags ssh-user;});
}
@@ -1,65 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
} @ args: let
# 大木 鈴, Ōki Suzu
name = "suzu";
tags = [name "aarch"];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
"secrets/nixos.nix"
"modules/nixos/server/server-aarch64.nix"
# host specific modules
"hosts/12kingdoms-${name}"
])
++ [
{modules.secrets.server.network.enable = true;}
];
};
inherit (inputs) nixos-rk3588;
baseSpecialArgs = genSpecialArgs system;
rk3588Pkgs = import nixos-rk3588.inputs.nixpkgs {inherit system;};
rk3588SpecialArgs = let
# using the same nixpkgs as nixos-rk3588
inherit (nixos-rk3588.inputs) nixpkgs;
# use aarch64-linux's native toolchain
pkgsKernel = import nixpkgs {inherit system;};
in
baseSpecialArgs
// {
inherit nixpkgs;
# Provide rk3588 inputs as special argument
rk3588 = {inherit nixpkgs pkgsKernel;};
};
rk3588SystemArgs =
modules
// args
// {
inherit (nixos-rk3588.inputs) nixpkgs; # or nixpkgs-unstable
specialArgs = rk3588SpecialArgs;
};
in {
nixosConfigurations.${name} = mylib.nixosSystem rk3588SystemArgs;
colmenaMeta = {
nodeSpecialArgs.${name} = rk3588SpecialArgs;
nodeNixpkgs.${name} = rk3588Pkgs;
};
colmena.${name} =
mylib.colmenaSystem
(rk3588SystemArgs // {inherit tags ssh-user;});
}
@@ -1,8 +0,0 @@
{
lib,
outputs,
}: let
hostsNames = builtins.attrNames outputs.nixosConfigurations;
expected = lib.genAttrs hostsNames (name: name);
in
expected
@@ -1,9 +0,0 @@
{
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.nixosConfigurations)
(
name: outputs.nixosConfigurations.${name}.config.networking.hostName
)
@@ -1,8 +0,0 @@
{
lib,
outputs,
}: let
hostsNames = builtins.attrNames outputs.nixosConfigurations;
expected = lib.genAttrs hostsNames (_: true);
in
expected
@@ -1,11 +0,0 @@
{
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.nixosConfigurations)
(
# test only if kernelPackages is set, to avoid build the kernel.
# name: outputs.nixosConfigurations.${name}.config.boot.kernelPackages.kernel.system
name: outputs.nixosConfigurations.${name}.config.boot.kernelPackages != null
)
+2 -2
View File
@@ -34,8 +34,8 @@
# modules for each supported system
nixosSystems = {
x86_64-linux = import ./x86_64-linux (args // {system = "x86_64-linux";});
aarch64-linux = import ./aarch64-linux (args // {system = "aarch64-linux";});
riscv64-linux = import ./riscv64-linux (args // {system = "riscv64-linux";});
# aarch64-linux = import ./aarch64-linux (args // {system = "aarch64-linux";});
# riscv64-linux = import ./riscv64-linux (args // {system = "riscv64-linux";});
};
darwinSystems = {
aarch64-darwin = import ./aarch64-darwin (args // {system = "aarch64-darwin";});
-38
View File
@@ -1,38 +0,0 @@
{
lib,
inputs,
...
} @ args: let
inherit (inputs) haumea;
# Contains all the flake outputs of this system architecture.
data = haumea.lib.load {
src = ./src;
inputs = args;
};
# nix file names is redundant, so we remove it.
dataWithoutPaths = builtins.attrValues data;
# Merge all the machine's data into a single attribute set.
outputs = {
nixosConfigurations = lib.attrsets.mergeAttrsList (map (it: it.nixosConfigurations or {}) dataWithoutPaths);
packages = lib.attrsets.mergeAttrsList (map (it: it.packages or {}) dataWithoutPaths);
# colmena contains some meta info, which need to be merged carefully.
colmenaMeta = {
nodeNixpkgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeNixpkgs or {}) dataWithoutPaths);
nodeSpecialArgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeSpecialArgs or {}) dataWithoutPaths);
};
# colmena's per-machine data.
colmena = lib.attrsets.mergeAttrsList (map (it: it.colmena or {}) dataWithoutPaths);
};
in
outputs
// {
inherit data; # for debugging purposes
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {inherit outputs;};
};
}
@@ -1,60 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
} @ args: let
# 森友 望未, Moritomo Nozomi
name = "nozomi";
tags = [name "riscv"];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
"modules/nixos/server/server-riscv64.nix"
# host specific modules
"hosts/rolling-girls-${name}"
])
++ [
# cross-compilation this flake.
{nixpkgs.crossSystem.system = "riscv64-linux";}
];
};
inherit (inputs) nixos-licheepi4a;
baseSpecialArgs = genSpecialArgs system;
# using the same nixpkgs as nixos-licheepi4a to utilize the cross-compilation cache.
lpi4aPkgs = import nixos-licheepi4a.inputs.nixpkgs {inherit system;};
lpi4aSpecialArgs =
baseSpecialArgs
// {
inherit (nixos-licheepi4a.inputs) nixpkgs;
pkgsKernel = nixos-licheepi4a.packages.${system}.pkgsKernelCross;
}
// args;
lpi4aSystemArgs =
modules
// args
// {
inherit (nixos-licheepi4a.inputs) nixpkgs;
specialArgs = lpi4aSpecialArgs;
};
in {
nixosConfigurations.${name} = mylib.nixosSystem lpi4aSystemArgs;
colmenaMeta = {
nodeSpecialArgs.${name} = lpi4aSpecialArgs;
nodeNixpkgs.${name} = lpi4aPkgs;
};
colmena.${name} =
mylib.colmenaSystem
(lpi4aSystemArgs // {inherit tags ssh-user;});
}
@@ -1,60 +0,0 @@
{
# NOTE: the args not used in this file CAN NOT be removed!
# because haumea pass argument lazily,
# and these arguments are used in the functions like `mylib.nixosSystem`, `mylib.colmenaSystem`, etc.
inputs,
lib,
mylib,
myvars,
system,
genSpecialArgs,
...
} @ args: let
# 小坂 結季奈, Kosaka Yukina
name = "yukina";
tags = [name "riscv"];
ssh-user = "root";
modules = {
nixos-modules =
(map mylib.relativeToRoot [
"modules/nixos/server/server-riscv64.nix"
# host specific modules
"hosts/rolling-girls-${name}"
])
++ [
# cross-compilation this flake.
{nixpkgs.crossSystem.system = "riscv64-linux";}
];
};
inherit (inputs) nixos-licheepi4a;
baseSpecialArgs = genSpecialArgs system;
# using the same nixpkgs as nixos-licheepi4a to utilize the cross-compilation cache.
lpi4aPkgs = import nixos-licheepi4a.inputs.nixpkgs {inherit system;};
lpi4aSpecialArgs =
baseSpecialArgs
// {
inherit (nixos-licheepi4a.inputs) nixpkgs;
pkgsKernel = nixos-licheepi4a.packages.${system}.pkgsKernelCross;
}
// args;
lpi4aSystemArgs =
modules
// args
// {
inherit (nixos-licheepi4a.inputs) nixpkgs;
specialArgs = lpi4aSpecialArgs;
};
in {
nixosConfigurations.${name} = mylib.nixosSystem lpi4aSystemArgs;
colmenaMeta = {
nodeSpecialArgs.${name} = lpi4aSpecialArgs;
nodeNixpkgs.${name} = lpi4aPkgs;
};
colmena.${name} =
mylib.colmenaSystem
(lpi4aSystemArgs // {inherit tags ssh-user;});
}
@@ -1,8 +0,0 @@
{
lib,
outputs,
}: let
hostsNames = builtins.attrNames outputs.nixosConfigurations;
expected = lib.genAttrs hostsNames (name: name);
in
expected
@@ -1,9 +0,0 @@
{
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.nixosConfigurations)
(
name: outputs.nixosConfigurations.${name}.config.networking.hostName
)