Merge pull request 'Fix darwin support again' (#4143) from machine-class into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4143
This commit is contained in:
@@ -67,6 +67,9 @@ in
|
||||
lib.mapAttrs' (
|
||||
name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel
|
||||
) (lib.filterAttrs (n: _: !lib.hasPrefix "test-" n) self.nixosConfigurations)
|
||||
// lib.mapAttrs' (
|
||||
name: config: lib.nameValuePair "darwin-${name}" config.config.system.build.toplevel
|
||||
) (self.darwinConfigurations or { })
|
||||
// lib.mapAttrs' (n: lib.nameValuePair "package-${n}") packagesToBuild
|
||||
// lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells
|
||||
// lib.mapAttrs' (name: config: lib.nameValuePair "home-manager-${name}" config.activation-script) (
|
||||
|
||||
@@ -62,6 +62,14 @@
|
||||
{
|
||||
clan = {
|
||||
meta.name = "clan-core";
|
||||
inventory = {
|
||||
services = { };
|
||||
machines = {
|
||||
"test-darwin-machine" = {
|
||||
machineClass = "darwin";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
systems = import systems;
|
||||
imports =
|
||||
|
||||
@@ -47,19 +47,13 @@ in
|
||||
darwinConfigurations = lib.mkOption {
|
||||
type = types.lazyAttrsOf types.raw;
|
||||
description = "darwinConfigurations produced by clan for a specific machine";
|
||||
apply = lib.mapAttrs (
|
||||
k: v: {
|
||||
_file = "#nixosModules.${k}";
|
||||
imports = [ v ];
|
||||
}
|
||||
);
|
||||
};
|
||||
darwinModules = lib.mkOption {
|
||||
type = types.lazyAttrsOf types.deferredModule;
|
||||
description = "darwinModules produced by clan for a specific machine";
|
||||
apply = lib.mapAttrs (
|
||||
k: v: {
|
||||
_file = "#nixosModules.${k}";
|
||||
_file = "#darwinModules.${k}";
|
||||
imports = [ v ];
|
||||
}
|
||||
);
|
||||
|
||||
@@ -51,9 +51,7 @@ let
|
||||
|
||||
allMachines = config.clanInternals.inventoryClass.machines; # <- inventory.machines <- clan.machines
|
||||
|
||||
machineClasses = lib.mapAttrs (
|
||||
name: _: inventory.machines.${name}.machineClass or "nixos"
|
||||
) allMachines;
|
||||
machineClasses = lib.mapAttrs (name: _: inventory.machines.${name}.machineClass) allMachines;
|
||||
|
||||
configurations = lib.mapAttrs (
|
||||
name: _:
|
||||
@@ -71,12 +69,12 @@ let
|
||||
# - by the user
|
||||
# - by some test frameworks
|
||||
# IMPORTANT!: It is utterly important that we don't add any logic outside of these modules, as it would get tested.
|
||||
nixosModules' = lib.filterAttrs (
|
||||
name: _: inventory.machines.${name}.machineClass or "nixos" == "nixos"
|
||||
) (config.outputs.moduleForMachine);
|
||||
darwinModules' = lib.filterAttrs (
|
||||
name: _: inventory.machines.${name}.machineClass or "nixos" == "darwin"
|
||||
) (config.outputs.moduleForMachine);
|
||||
nixosModules' = lib.filterAttrs (name: _: inventory.machines.${name}.machineClass == "nixos") (
|
||||
config.outputs.moduleForMachine
|
||||
);
|
||||
darwinModules' = lib.filterAttrs (name: _: inventory.machines.${name}.machineClass == "darwin") (
|
||||
config.outputs.moduleForMachine
|
||||
);
|
||||
|
||||
nixosModules = flip mapAttrs' nixosModules' (
|
||||
name: machineModule: {
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
({
|
||||
{
|
||||
# For vars we need to ensure that the system so we run vars generate on
|
||||
# is in sync with the pkgs of the system
|
||||
nixpkgs.hostPlatform = lib.mkForce pkgs.system;
|
||||
nixpkgs.pkgs = lib.mkForce pkgs;
|
||||
})
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
7
machines/test-darwin-machine/configuration.nix
Normal file
7
machines/test-darwin-machine/configuration.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
# Basic system configuration
|
||||
system.stateVersion = 5;
|
||||
|
||||
# Set the nixpkgs system
|
||||
nixpkgs.hostPlatform = "aarch64-darwin";
|
||||
}
|
||||
Reference in New Issue
Block a user