mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-24 17:58:30 +02:00
feat: remove x86_64-darwin, add new nixos host on macbook pro m2
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"fern"
|
||||
"frieren"
|
||||
];
|
||||
in
|
||||
lib.genAttrs hosts (_: "/Users/${username}")
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"fern"
|
||||
"frieren"
|
||||
];
|
||||
in
|
||||
lib.genAttrs
|
||||
|
||||
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;};
|
||||
};
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
}: let
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"harmonica"
|
||||
"shoukei-hyprland"
|
||||
];
|
||||
in
|
||||
lib.genAttrs hosts (_: "/Users/${username}")
|
||||
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
|
||||
)
|
||||
@@ -34,12 +34,11 @@
|
||||
# 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";});
|
||||
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";});
|
||||
x86_64-darwin = import ./x86_64-darwin (args // {system = "x86_64-darwin";});
|
||||
};
|
||||
allSystems = nixosSystems // darwinSystems;
|
||||
allSystemNames = builtins.attrNames allSystems;
|
||||
|
||||
@@ -1,30 +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 = {
|
||||
darwinConfigurations = lib.attrsets.mergeAttrsList (map (it: it.darwinConfigurations or {}) dataWithoutPaths);
|
||||
};
|
||||
in
|
||||
outputs
|
||||
// {
|
||||
inherit data; # for debugging purposes
|
||||
|
||||
# NixOS's unit tests.
|
||||
evalTests = haumea.lib.loadEvalTests {
|
||||
src = ./tests;
|
||||
inputs = args // {inherit outputs;};
|
||||
};
|
||||
}
|
||||
@@ -1,36 +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
|
||||
name = "harmonica";
|
||||
|
||||
modules = {
|
||||
darwin-modules =
|
||||
(map mylib.relativeToRoot [
|
||||
# common
|
||||
"secrets/darwin.nix"
|
||||
"modules/darwin"
|
||||
# host specific
|
||||
"hosts/darwin-${name}"
|
||||
])
|
||||
++ [];
|
||||
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
"hosts/darwin-${name}/home.nix"
|
||||
"home/darwin"
|
||||
];
|
||||
};
|
||||
|
||||
systemArgs = modules // args;
|
||||
in {
|
||||
# macOS's configuration
|
||||
darwinConfigurations.${name} = mylib.macosSystem systemArgs;
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
myvars,
|
||||
lib,
|
||||
outputs,
|
||||
}: let
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"harmonica"
|
||||
];
|
||||
in
|
||||
lib.genAttrs
|
||||
hosts
|
||||
(
|
||||
name: outputs.darwinConfigurations.${name}.config.home-manager.users.${username}.home.homeDirectory
|
||||
)
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}: let
|
||||
hostsNames = builtins.attrNames outputs.darwinConfigurations;
|
||||
expected = lib.genAttrs hostsNames (name: name);
|
||||
in
|
||||
expected
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
outputs,
|
||||
}:
|
||||
lib.genAttrs
|
||||
(builtins.attrNames outputs.darwinConfigurations)
|
||||
(
|
||||
name: outputs.darwinConfigurations.${name}.config.networking.hostName
|
||||
)
|
||||
@@ -5,7 +5,6 @@
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"ai-hyprland"
|
||||
"shoukei-hyprland"
|
||||
"ruby"
|
||||
"k3s-prod-1-master-1"
|
||||
];
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
username = myvars.username;
|
||||
hosts = [
|
||||
"ai-hyprland"
|
||||
"shoukei-hyprland"
|
||||
"ruby"
|
||||
"k3s-prod-1-master-1"
|
||||
];
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
}: let
|
||||
specialExpected = {
|
||||
"ai-hyprland" = "ai";
|
||||
"shoukei-hyprland" = "shoukei";
|
||||
};
|
||||
specialHostNames = builtins.attrNames specialExpected;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user