Merge pull request 'nixosModules/clanCore: support nix-darwin' (#3287) from nix-darwin into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3287
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
{ pkgs, lib }:
|
||||
let
|
||||
eval = lib.evalModules {
|
||||
class = "nixos";
|
||||
modules = [
|
||||
./interface.nix
|
||||
];
|
||||
|
||||
@@ -9,30 +9,24 @@
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
{
|
||||
imports = builtins.filter builtins.pathExists (
|
||||
[
|
||||
"${directory}/machines/${name}/configuration.nix"
|
||||
]
|
||||
++ lib.optionals (_class == "nixos") [
|
||||
"${directory}/machines/${name}/hardware-configuration.nix"
|
||||
"${directory}/machines/${name}/disko.nix"
|
||||
]
|
||||
);
|
||||
}
|
||||
(lib.optionalAttrs (_class == "nixos") {
|
||||
clan.core.settings = {
|
||||
inherit (meta) name icon;
|
||||
inherit directory;
|
||||
machine = {
|
||||
inherit name;
|
||||
};
|
||||
};
|
||||
})
|
||||
# TODO: move into nixos modules
|
||||
({
|
||||
networking.hostName = lib.mkDefault name;
|
||||
})
|
||||
];
|
||||
imports = builtins.filter builtins.pathExists (
|
||||
[
|
||||
"${directory}/machines/${name}/configuration.nix"
|
||||
]
|
||||
++ lib.optionals (_class == "nixos") [
|
||||
"${directory}/machines/${name}/hardware-configuration.nix"
|
||||
"${directory}/machines/${name}/disko.nix"
|
||||
]
|
||||
);
|
||||
|
||||
clan.core.settings = {
|
||||
inherit (meta) name icon;
|
||||
inherit directory;
|
||||
machine = {
|
||||
inherit name;
|
||||
};
|
||||
};
|
||||
|
||||
# TODO: move into nixosModules
|
||||
networking.hostName = lib.mkDefault name;
|
||||
}
|
||||
|
||||
@@ -221,17 +221,11 @@ in
|
||||
|
||||
# machine specifics
|
||||
machines = configsPerSystem;
|
||||
all-machines-json =
|
||||
if !lib.hasAttrByPath [ "darwinModules" "clanCore" ] clan-core then
|
||||
lib.mapAttrs (
|
||||
system: configs:
|
||||
nixpkgs.legacyPackages.${system}.writers.writeJSON "machines.json" (
|
||||
lib.mapAttrs (_: m: m.config.system.clan.deployment.data) (
|
||||
lib.filterAttrs (_n: v: v.class == "nixos") configs
|
||||
)
|
||||
)
|
||||
) configsPerSystem
|
||||
else
|
||||
throw "remove NixOS filter and support nix-darwin as well";
|
||||
all-machines-json = lib.mapAttrs (
|
||||
system: configs:
|
||||
nixpkgs.legacyPackages.${system}.writers.writeJSON "machines.json" (
|
||||
lib.mapAttrs (_: m: m.config.system.clan.deployment.data) configs
|
||||
)
|
||||
) configsPerSystem;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ let
|
||||
}:
|
||||
let
|
||||
evaled = lib.evalModules {
|
||||
class = "nixos";
|
||||
modules = [
|
||||
(baseModule { inherit pkgs; })
|
||||
{
|
||||
@@ -83,6 +84,7 @@ let
|
||||
name = role;
|
||||
value =
|
||||
(lib.evalModules {
|
||||
class = "nixos";
|
||||
modules = [
|
||||
(baseModule { inherit pkgs; })
|
||||
clan-core.nixosModules.clanCore
|
||||
|
||||
Reference in New Issue
Block a user