feat: format via 'ls **/*.nix | each { |it| nixfmt $it.name }'

This commit is contained in:
Ryan Yin
2025-07-30 12:17:24 +08:00
parent d10b30b06b
commit 13bb77108c
219 changed files with 2103 additions and 1728 deletions

View File

@@ -2,7 +2,8 @@
lib,
inputs,
...
} @ args: let
}@args:
let
inherit (inputs) haumea;
# Contains all the flake outputs of this system architecture.
@@ -15,16 +16,20 @@
# Merge all the machine's data into a single attribute set.
outputs = {
darwinConfigurations = lib.attrsets.mergeAttrsList (map (it: it.darwinConfigurations or {}) dataWithoutPaths);
darwinConfigurations = lib.attrsets.mergeAttrsList (
map (it: it.darwinConfigurations or { }) dataWithoutPaths
);
};
in
outputs
// {
inherit data; # for debugging purposes
outputs
// {
inherit data; # for debugging purposes
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {inherit outputs;};
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {
inherit outputs;
};
}
};
}

View File

@@ -9,7 +9,8 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "fern";
modules = {
@@ -34,7 +35,8 @@
};
systemArgs = modules // args;
in {
in
{
# macOS's configuration
darwinConfigurations.${name} = mylib.macosSystem systemArgs;
}

View File

@@ -9,7 +9,8 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "frieren";
modules = {
@@ -33,7 +34,8 @@
};
systemArgs = modules // args;
in {
in
{
# macOS's configuration
darwinConfigurations.${name} = mylib.macosSystem systemArgs;
}

View File

@@ -1,11 +1,12 @@
{
myvars,
lib,
}: let
}:
let
username = myvars.username;
hosts = [
"fern"
"frieren"
];
in
lib.genAttrs hosts (_: "/Users/${username}")
lib.genAttrs hosts (_: "/Users/${username}")

View File

@@ -2,15 +2,14 @@
myvars,
lib,
outputs,
}: let
}:
let
username = myvars.username;
hosts = [
"fern"
"frieren"
];
in
lib.genAttrs
hosts
(
name: outputs.darwinConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
)
lib.genAttrs hosts (
name: outputs.darwinConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
)

View File

@@ -1,8 +1,9 @@
{
lib,
outputs,
}: let
}:
let
hostsNames = builtins.attrNames outputs.darwinConfigurations;
expected = lib.genAttrs hostsNames (name: name);
in
expected
expected

View File

@@ -2,8 +2,6 @@
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.darwinConfigurations)
(
lib.genAttrs (builtins.attrNames outputs.darwinConfigurations) (
name: outputs.darwinConfigurations.${name}.config.networking.hostName
)

View File

@@ -2,7 +2,8 @@
lib,
inputs,
...
} @ args: let
}@args:
let
inherit (inputs) haumea;
# Contains all the flake outputs of this system architecture.
@@ -15,23 +16,31 @@
# 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);
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);
nodeNixpkgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeNixpkgs or { }) dataWithoutPaths
);
nodeSpecialArgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeSpecialArgs or { }) dataWithoutPaths
);
};
colmena = lib.attrsets.mergeAttrsList (map (it: it.colmena or {}) dataWithoutPaths);
colmena = lib.attrsets.mergeAttrsList (map (it: it.colmena or { }) dataWithoutPaths);
};
in
outputs
// {
inherit data; # for debugging purposes
outputs
// {
inherit data; # for debugging purposes
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {inherit outputs;};
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {
inherit outputs;
};
}
};
}

View File

@@ -9,7 +9,8 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
# Shoukei (祥瓊, Shōkei)
name = "shoukei";
base-modules = {
@@ -33,25 +34,24 @@
};
modules-hyprland = {
nixos-modules =
[
{
modules.desktop.wayland.enable = true;
modules.secrets.desktop.enable = true;
modules.secrets.preservation.enable = true;
nixos-modules = [
{
modules.desktop.wayland.enable = true;
modules.secrets.desktop.enable = true;
modules.secrets.preservation.enable = true;
# TODO: remove this option
nixpkgs.config.allowUnsupportedSstem = true;
}
]
++ base-modules.nixos-modules;
home-modules =
[
{modules.desktop.hyprland.enable = true;}
]
++ base-modules.home-modules;
# TODO: remove this option
nixpkgs.config.allowUnsupportedSstem = true;
}
]
++ base-modules.nixos-modules;
home-modules = [
{ modules.desktop.hyprland.enable = true; }
]
++ base-modules.home-modules;
};
in {
in
{
nixosConfigurations = {
# host with hyprland compositor
"${name}-hyprland" = mylib.nixosSystem (modules-hyprland // args);

View File

@@ -1,10 +1,11 @@
{
myvars,
lib,
}: let
}:
let
username = myvars.username;
hosts = [
"shoukei-hyprland"
];
in
lib.genAttrs hosts (_: "/home/${username}")
lib.genAttrs hosts (_: "/home/${username}")

View File

@@ -2,14 +2,13 @@
myvars,
lib,
outputs,
}: let
}:
let
username = myvars.username;
hosts = [
"shoukei-hyprland"
];
in
lib.genAttrs
hosts
(
name: outputs.nixosConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
)
lib.genAttrs hosts (
name: outputs.nixosConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
)

View File

@@ -1,7 +1,8 @@
{
lib,
outputs,
}: let
}:
let
specialExpected = {
"shoukei-hyprland" = "shoukei";
};
@@ -11,4 +12,5 @@
otherHostsNames = builtins.attrNames otherHosts;
# other hosts's hostName is the same as the nixosConfigurations name
otherExpected = lib.genAttrs otherHostsNames (name: name);
in (specialExpected // otherExpected)
in
(specialExpected // otherExpected)

View File

@@ -2,8 +2,6 @@
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.nixosConfigurations)
(
lib.genAttrs (builtins.attrNames outputs.nixosConfigurations) (
name: outputs.nixosConfigurations.${name}.config.networking.hostName
)

View File

@@ -1,8 +1,9 @@
{
lib,
outputs,
}: let
}:
let
hostsNames = builtins.attrNames outputs.nixosConfigurations;
expected = lib.genAttrs hostsNames (_: "aarch64-linux");
in
expected
expected

View File

@@ -2,8 +2,6 @@
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.nixosConfigurations)
(
lib.genAttrs (builtins.attrNames outputs.nixosConfigurations) (
name: outputs.nixosConfigurations.${name}.config.boot.kernelPackages.kernel.system
)

View File

@@ -3,14 +3,16 @@
nixpkgs,
pre-commit-hooks,
...
} @ inputs: let
}@inputs:
let
inherit (inputs.nixpkgs) lib;
mylib = import ../lib {inherit lib;};
myvars = import ../vars {inherit lib;};
mylib = import ../lib { inherit lib; };
myvars = import ../vars { inherit lib; };
# Add my custom lib, vars, nixpkgs instance, and all the inputs to specialArgs,
# so that I can use them in all my nixos/home-manager/darwin modules.
genSpecialArgs = system:
genSpecialArgs =
system:
inputs
// {
inherit mylib myvars;
@@ -36,16 +38,24 @@
};
# This is the args for all the haumea modules in this folder.
args = {inherit inputs lib mylib myvars genSpecialArgs;};
args = {
inherit
inputs
lib
mylib
myvars
genSpecialArgs
;
};
# 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";});
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";});
};
darwinSystems = {
aarch64-darwin = import ./aarch64-darwin (args // {system = "aarch64-darwin";});
aarch64-darwin = import ./aarch64-darwin (args // { system = "aarch64-darwin"; });
};
allSystems = nixosSystems // darwinSystems;
allSystemNames = builtins.attrNames allSystems;
@@ -55,86 +65,98 @@
# Helper function to generate a set of attributes for each system
forAllSystems = func: (nixpkgs.lib.genAttrs allSystemNames func);
in {
in
{
# Add attribute sets into outputs, for debugging
debugAttrs = {inherit nixosSystems darwinSystems allSystems allSystemNames;};
debugAttrs = {
inherit
nixosSystems
darwinSystems
allSystems
allSystemNames
;
};
# NixOS Hosts
nixosConfigurations =
lib.attrsets.mergeAttrsList (map (it: it.nixosConfigurations or {}) nixosSystemValues);
nixosConfigurations = lib.attrsets.mergeAttrsList (
map (it: it.nixosConfigurations or { }) nixosSystemValues
);
# Colmena - remote deployment via SSH
colmena =
{
meta =
(
let
system = "x86_64-linux";
in {
# colmena's default nixpkgs & specialArgs
nixpkgs = import nixpkgs {inherit system;};
specialArgs = genSpecialArgs system;
}
)
// {
# per-node nixpkgs & specialArgs
nodeNixpkgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeNixpkgs or {}) nixosSystemValues);
nodeSpecialArgs = lib.attrsets.mergeAttrsList (map (it: it.colmenaMeta.nodeSpecialArgs or {}) nixosSystemValues);
};
}
// lib.attrsets.mergeAttrsList (map (it: it.colmena or {}) nixosSystemValues);
colmena = {
meta =
(
let
system = "x86_64-linux";
in
{
# colmena's default nixpkgs & specialArgs
nixpkgs = import nixpkgs { inherit system; };
specialArgs = genSpecialArgs system;
}
)
// {
# per-node nixpkgs & specialArgs
nodeNixpkgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeNixpkgs or { }) nixosSystemValues
);
nodeSpecialArgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeSpecialArgs or { }) nixosSystemValues
);
};
}
// lib.attrsets.mergeAttrsList (map (it: it.colmena or { }) nixosSystemValues);
# macOS Hosts
darwinConfigurations =
lib.attrsets.mergeAttrsList (map (it: it.darwinConfigurations or {}) darwinSystemValues);
darwinConfigurations = lib.attrsets.mergeAttrsList (
map (it: it.darwinConfigurations or { }) darwinSystemValues
);
# Packages
packages = forAllSystems (
system: allSystems.${system}.packages or {}
);
packages = forAllSystems (system: allSystems.${system}.packages or { });
# Eval Tests for all NixOS & darwin systems.
evalTests = lib.lists.all (it: it.evalTests == {}) allSystemValues;
evalTests = lib.lists.all (it: it.evalTests == { }) allSystemValues;
checks = forAllSystems (
system: {
# eval-tests per system
eval-tests = allSystems.${system}.evalTests == {};
checks = forAllSystems (system: {
# eval-tests per system
eval-tests = allSystems.${system}.evalTests == { };
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = mylib.relativeToRoot ".";
hooks = {
nixfmt-rfc-style = {
enable = true;
settings.width = 100;
};
# Source code spell checker
typos = {
enable = true;
settings = {
write = true; # Automatically fix typos
configPath = "./.typos.toml"; # relative to the flake root
};
};
prettier = {
enable = true;
settings = {
write = true; # Automatically format files
configPath = "./.prettierrc.yaml"; # relative to the flake root
};
};
# deadnix.enable = true; # detect unused variable bindings in `*.nix`
# statix.enable = true; # lints and suggestions for Nix code(auto suggestions)
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = mylib.relativeToRoot ".";
hooks = {
nixfmt-rfc-style = {
enable = true;
settings.width = 100;
};
# Source code spell checker
typos = {
enable = true;
settings = {
write = true; # Automatically fix typos
configPath = "./.typos.toml"; # relative to the flake root
};
};
prettier = {
enable = true;
settings = {
write = true; # Automatically format files
configPath = "./.prettierrc.yaml"; # relative to the flake root
};
};
# deadnix.enable = true; # detect unused variable bindings in `*.nix`
# statix.enable = true; # lints and suggestions for Nix code(auto suggestions)
};
}
);
};
});
# Development Shells
devShells = forAllSystems (
system: let
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
in
{
default = pkgs.mkShell {
packages = with pkgs; [
# fix https://discourse.nixos.org/t/non-interactive-bash-errors-from-flake-nix-mkshell/33310
@@ -159,7 +181,5 @@ in {
);
# Format the nix code in this flake
formatter = forAllSystems (
system: nixpkgs.legacyPackages.${system}.nixfmt
);
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt);
}

View File

@@ -2,7 +2,8 @@
lib,
inputs,
...
} @ args: let
}@args:
let
inherit (inputs) haumea;
# Contains all the flake outputs of this system architecture.
@@ -15,23 +16,31 @@
# 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);
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);
nodeNixpkgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeNixpkgs or { }) dataWithoutPaths
);
nodeSpecialArgs = lib.attrsets.mergeAttrsList (
map (it: it.colmenaMeta.nodeSpecialArgs or { }) dataWithoutPaths
);
};
colmena = lib.attrsets.mergeAttrsList (map (it: it.colmena or {}) dataWithoutPaths);
colmena = lib.attrsets.mergeAttrsList (map (it: it.colmena or { }) dataWithoutPaths);
};
in
outputs
// {
inherit data; # for debugging purposes
outputs
// {
inherit data; # for debugging purposes
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {inherit outputs;};
# NixOS's unit tests.
evalTests = haumea.lib.loadEvalTests {
src = ./tests;
inputs = args // {
inherit outputs;
};
}
};
}

View File

@@ -5,33 +5,34 @@
genSpecialArgs,
nixos-modules,
# TODO: test home-manager too.
home-modules ? [],
home-modules ? [ ],
myvars,
...
}: let
}:
let
pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
};
in
pkgs.testers.runNixOSTest {
name = "NixOS Tests for Idols Ruby";
pkgs.testers.runNixOSTest {
name = "NixOS Tests for Idols Ruby";
node = {
inherit pkgs;
specialArgs = genSpecialArgs system;
pkgsReadOnly = false;
};
node = {
inherit pkgs;
specialArgs = genSpecialArgs system;
pkgsReadOnly = false;
};
nodes = {
ruby.imports = nixos-modules;
};
nodes = {
ruby.imports = nixos-modules;
};
# Note that machine1 and machine2 are now available as
# Python objects and also as hostnames in the virtual network
testScript = ''
ruby.wait_for_unit("network-online.target")
# Note that machine1 and machine2 are now available as
# Python objects and also as hostnames in the virtual network
testScript = ''
ruby.wait_for_unit("network-online.target")
ruby.succeed("curl https://baidu.com")
'';
}
ruby.succeed("curl https://baidu.com")
'';
}

View File

@@ -9,7 +9,8 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
# 星野 アイ, Hoshino Ai
name = "ai";
base-modules = {
@@ -33,23 +34,22 @@
};
modules-hyprland = {
nixos-modules =
[
{
modules.desktop.fonts.enable = true;
modules.desktop.wayland.enable = true;
modules.secrets.desktop.enable = true;
modules.secrets.preservation.enable = true;
}
]
++ base-modules.nixos-modules;
home-modules =
[
{modules.desktop.hyprland.enable = true;}
]
++ base-modules.home-modules;
nixos-modules = [
{
modules.desktop.fonts.enable = true;
modules.desktop.wayland.enable = true;
modules.secrets.desktop.enable = true;
modules.secrets.preservation.enable = true;
}
]
++ base-modules.nixos-modules;
home-modules = [
{ modules.desktop.hyprland.enable = true; }
]
++ base-modules.home-modules;
};
in {
in
{
nixosConfigurations = {
# host with hyprland compositor
"${name}-hyprland" = mylib.nixosSystem (modules-hyprland // args);

View File

@@ -9,10 +9,14 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
# 星野 愛久愛海, Hoshino Akuamarin
name = "aquamarine";
tags = ["aqua" "homelab-network"];
tags = [
"aqua"
"homelab-network"
];
ssh-user = "root";
modules = {
@@ -26,10 +30,10 @@
"hosts/idols-${name}"
])
++ [
{modules.secrets.server.application.enable = true;}
{modules.secrets.server.operation.enable = true;}
{modules.secrets.server.webserver.enable = true;}
{modules.secrets.server.storage.enable = true;}
{ modules.secrets.server.application.enable = true; }
{ modules.secrets.server.operation.enable = true; }
{ modules.secrets.server.webserver.enable = true; }
{ modules.secrets.server.storage.enable = true; }
];
home-modules = map mylib.relativeToRoot [
"home/linux/tui.nix"
@@ -37,11 +41,11 @@
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,10 +9,14 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
# 有馬 かな, Arima Kana
name = "kana";
tags = [name "homelab-app"];
tags = [
name
"homelab-app"
];
ssh-user = "root";
modules = {
@@ -30,11 +34,11 @@
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,10 +9,14 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
# 星野 瑠美衣, Hoshino Rubii
name = "ruby";
tags = [name "homelab-operation"];
tags = [
name
"homelab-operation"
];
ssh-user = "root";
modules = {
@@ -33,11 +37,11 @@
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;

View File

@@ -9,9 +9,10 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "k3s-prod-1-master-1";
tags = [name];
tags = [ name ];
ssh-user = "root";
modules = {
@@ -25,7 +26,7 @@
"hosts/k8s/${name}"
])
++ [
{modules.secrets.server.kubernetes.enable = true;}
{ modules.secrets.server.kubernetes.enable = true; }
];
home-modules = map mylib.relativeToRoot [
"home/linux/core.nix"
@@ -33,11 +34,11 @@
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,9 +9,10 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "k3s-prod-1-master-2";
tags = [name];
tags = [ name ];
ssh-user = "root";
modules = {
@@ -25,16 +26,16 @@
"hosts/k8s/${name}"
])
++ [
{modules.secrets.server.kubernetes.enable = true;}
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,9 +9,10 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "k3s-prod-1-master-3";
tags = [name];
tags = [ name ];
ssh-user = "root";
modules = {
@@ -25,16 +26,16 @@
"hosts/k8s/${name}"
])
++ [
{modules.secrets.server.kubernetes.enable = true;}
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,9 +9,10 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "k3s-prod-1-worker-1";
tags = [name];
tags = [ name ];
ssh-user = "root";
modules = {
@@ -25,16 +26,16 @@
"hosts/k8s/${name}"
])
++ [
{modules.secrets.server.kubernetes.enable = true;}
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,9 +9,10 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "k3s-prod-1-worker-2";
tags = [name];
tags = [ name ];
ssh-user = "root";
modules = {
@@ -25,16 +26,16 @@
"hosts/k8s/${name}"
])
++ [
{modules.secrets.server.kubernetes.enable = true;}
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,9 +9,10 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "k3s-prod-1-worker-3";
tags = [name];
tags = [ name ];
ssh-user = "root";
modules = {
@@ -25,16 +26,16 @@
"hosts/k8s/${name}"
])
++ [
{modules.secrets.server.kubernetes.enable = true;}
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,9 +9,10 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "k3s-test-1-master-1";
tags = [name];
tags = [ name ];
ssh-user = "root";
modules = {
@@ -25,7 +26,7 @@
"hosts/k8s/${name}"
])
++ [
{modules.secrets.server.kubernetes.enable = true;}
{ modules.secrets.server.kubernetes.enable = true; }
];
home-modules = map mylib.relativeToRoot [
"home/linux/core.nix"
@@ -33,11 +34,11 @@
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,9 +9,10 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "k3s-test-1-master-2";
tags = [name];
tags = [ name ];
ssh-user = "root";
modules = {
@@ -25,16 +26,16 @@
"hosts/k8s/${name}"
])
++ [
{modules.secrets.server.kubernetes.enable = true;}
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,9 +9,10 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "k3s-test-1-master-3";
tags = [name];
tags = [ name ];
ssh-user = "root";
modules = {
@@ -25,16 +26,16 @@
"hosts/k8s/${name}"
])
++ [
{modules.secrets.server.kubernetes.enable = true;}
{ modules.secrets.server.kubernetes.enable = true; }
];
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.kubevirt;
}

View File

@@ -9,9 +9,13 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "kubevirt-shoryu";
tags = [name "virt-shoryu"];
tags = [
name
"virt-shoryu"
];
ssh-user = "root";
modules = {
@@ -35,11 +39,11 @@
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.iso;
}

View File

@@ -9,9 +9,13 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "kubevirt-shushou";
tags = [name "virt-shushou"];
tags = [
name
"virt-shushou"
];
ssh-user = "root";
modules = {
@@ -32,11 +36,11 @@
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.iso;
}

View File

@@ -9,9 +9,13 @@
system,
genSpecialArgs,
...
} @ args: let
}@args:
let
name = "kubevirt-youko";
tags = [name "virt-youko"];
tags = [
name
"virt-youko"
];
ssh-user = "root";
modules = {
@@ -32,11 +36,11 @@
};
systemArgs = modules // args;
in {
in
{
nixosConfigurations.${name} = mylib.nixosSystem systemArgs;
colmena.${name} =
mylib.colmenaSystem (systemArgs // {inherit tags ssh-user;});
colmena.${name} = mylib.colmenaSystem (systemArgs // { inherit tags ssh-user; });
packages.${name} = inputs.self.nixosConfigurations.${name}.config.formats.iso;
}

View File

@@ -1,7 +1,8 @@
{
myvars,
lib,
}: let
}:
let
username = myvars.username;
hosts = [
"ai-hyprland"
@@ -9,4 +10,4 @@
"k3s-prod-1-master-1"
];
in
lib.genAttrs hosts (_: "/home/${username}")
lib.genAttrs hosts (_: "/home/${username}")

View File

@@ -2,7 +2,8 @@
myvars,
lib,
outputs,
}: let
}:
let
username = myvars.username;
hosts = [
"ai-hyprland"
@@ -10,8 +11,6 @@
"k3s-prod-1-master-1"
];
in
lib.genAttrs
hosts
(
name: outputs.nixosConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
)
lib.genAttrs hosts (
name: outputs.nixosConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
)

View File

@@ -1,7 +1,8 @@
{
lib,
outputs,
}: let
}:
let
specialExpected = {
"ai-hyprland" = "ai";
};
@@ -11,4 +12,5 @@
otherHostsNames = builtins.attrNames otherHosts;
# other hosts's hostName is the same as the nixosConfigurations name
otherExpected = lib.genAttrs otherHostsNames (name: name);
in (specialExpected // otherExpected)
in
(specialExpected // otherExpected)

View File

@@ -2,8 +2,6 @@
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.nixosConfigurations)
(
lib.genAttrs (builtins.attrNames outputs.nixosConfigurations) (
name: outputs.nixosConfigurations.${name}.config.networking.hostName
)

View File

@@ -1,8 +1,9 @@
{
lib,
outputs,
}: let
}:
let
hostsNames = builtins.attrNames outputs.nixosConfigurations;
expected = lib.genAttrs hostsNames (_: "x86_64-linux");
in
expected
expected

View File

@@ -2,8 +2,6 @@
lib,
outputs,
}:
lib.genAttrs
(builtins.attrNames outputs.nixosConfigurations)
(
lib.genAttrs (builtins.attrNames outputs.nixosConfigurations) (
name: outputs.nixosConfigurations.${name}.config.boot.kernelPackages.kernel.system
)