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
+23 -14
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;
};
}
};
}
@@ -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);
@@ -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}")
@@ -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
)
@@ -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)
@@ -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
)
@@ -1,8 +1,9 @@
{
lib,
outputs,
}: let
}:
let
hostsNames = builtins.attrNames outputs.nixosConfigurations;
expected = lib.genAttrs hostsNames (_: "aarch64-linux");
in
expected
expected
+1 -3
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
)