mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 09:28:27 +02:00
feat: remove x86_64-darwin, add new nixos host on macbook pro m2
This commit is contained in:
37
outputs/aarch64-linux/default.nix
Normal file
37
outputs/aarch64-linux/default.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
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 = 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;};
|
||||
};
|
||||
}
|
||||
57
outputs/aarch64-linux/src/12kingdoms-shoukei.nix
Normal file
57
outputs/aarch64-linux/src/12kingdoms-shoukei.nix
Normal file
@@ -0,0 +1,57 @@
|
||||
{
|
||||
# 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,
|
||||
myvars,
|
||||
mylib,
|
||||
system,
|
||||
genSpecialArgs,
|
||||
...
|
||||
} @ args: let
|
||||
# Shoukei (祥瓊, Shōkei)
|
||||
name = "shoukei";
|
||||
base-modules = {
|
||||
nixos-modules = map mylib.relativeToRoot [
|
||||
# common
|
||||
"secrets/nixos.nix"
|
||||
"modules/nixos/desktop.nix"
|
||||
# host specific
|
||||
"hosts/12kingdoms-${name}"
|
||||
];
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
# common
|
||||
"home/linux/gui.nix"
|
||||
# host specific
|
||||
"hosts/12kingdoms-${name}/home.nix"
|
||||
];
|
||||
};
|
||||
|
||||
modules-hyprland = {
|
||||
nixos-modules =
|
||||
[
|
||||
{
|
||||
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 {
|
||||
nixosConfigurations = {
|
||||
# host with hyprland compositor
|
||||
"${name}-hyprland" = mylib.nixosSystem (modules-hyprland // args);
|
||||
};
|
||||
|
||||
# generate iso image for hosts with desktop environment
|
||||
packages = {
|
||||
"${name}-hyprland" = inputs.self.nixosConfigurations."${name}-hyprland".config.formats.iso;
|
||||
};
|
||||
}
|
||||
10
outputs/aarch64-linux/tests/home-manager/expected.nix
Normal file
10
outputs/aarch64-linux/tests/home-manager/expected.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
myvars,
|
||||
lib,
|
||||
}: let
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"shoukei-hyprland"
|
||||
];
|
||||
in
|
||||
lib.genAttrs hosts (_: "/home/${username}")
|
||||
15
outputs/aarch64-linux/tests/home-manager/expr.nix
Normal file
15
outputs/aarch64-linux/tests/home-manager/expr.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
myvars,
|
||||
lib,
|
||||
outputs,
|
||||
}: let
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"shoukei-hyprland"
|
||||
];
|
||||
in
|
||||
lib.genAttrs
|
||||
hosts
|
||||
(
|
||||
name: outputs.nixosConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
|
||||
)
|
||||
14
outputs/aarch64-linux/tests/hostname/expected.nix
Normal file
14
outputs/aarch64-linux/tests/hostname/expected.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}: let
|
||||
specialExpected = {
|
||||
"shoukei-hyprland" = "shoukei";
|
||||
};
|
||||
specialHostNames = builtins.attrNames specialExpected;
|
||||
|
||||
otherHosts = builtins.removeAttrs outputs.nixosConfigurations specialHostNames;
|
||||
otherHostsNames = builtins.attrNames otherHosts;
|
||||
# other hosts's hostName is the same as the nixosConfigurations name
|
||||
otherExpected = lib.genAttrs otherHostsNames (name: name);
|
||||
in (specialExpected // otherExpected)
|
||||
9
outputs/aarch64-linux/tests/hostname/expr.nix
Normal file
9
outputs/aarch64-linux/tests/hostname/expr.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}:
|
||||
lib.genAttrs
|
||||
(builtins.attrNames outputs.nixosConfigurations)
|
||||
(
|
||||
name: outputs.nixosConfigurations.${name}.config.networking.hostName
|
||||
)
|
||||
8
outputs/aarch64-linux/tests/kernel/expected.nix
Normal file
8
outputs/aarch64-linux/tests/kernel/expected.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}: let
|
||||
hostsNames = builtins.attrNames outputs.nixosConfigurations;
|
||||
expected = lib.genAttrs hostsNames (_: "aarch64-linux");
|
||||
in
|
||||
expected
|
||||
9
outputs/aarch64-linux/tests/kernel/expr.nix
Normal file
9
outputs/aarch64-linux/tests/kernel/expr.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}:
|
||||
lib.genAttrs
|
||||
(builtins.attrNames outputs.nixosConfigurations)
|
||||
(
|
||||
name: outputs.nixosConfigurations.${name}.config.boot.kernelPackages.kernel.system
|
||||
)
|
||||
Reference in New Issue
Block a user