34 lines
1 KiB
Nix
34 lines
1 KiB
Nix
# SPDX-FileCopyrightText: 2024 Luke Granger-Brown <depot@lukegb.com>
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
{ depot, lib, pkgs, system, ... }@args: let
|
|
inherit (builtins) foldl' mapAttrs;
|
|
inherit (lib) filterAttrs;
|
|
baseModule = name: { ... }: {
|
|
_module.args = args // {
|
|
pkgs = lib.mkForce pkgs;
|
|
};
|
|
};
|
|
systemFor = systemName: config:
|
|
(depot.third_party.nixDarwinEval {
|
|
inherit lib;
|
|
modules = [
|
|
(baseModule systemName)
|
|
lib/common.nix
|
|
config
|
|
];
|
|
});
|
|
systems = [
|
|
"constructive-criticism"
|
|
];
|
|
systemCfgs = lib.genAttrs systems
|
|
(name: import (./. + "/${name}"));
|
|
allEvaledSystems = mapAttrs systemFor systemCfgs;
|
|
evaledSystems = lib.filterAttrs (n: v: v.config.my.systemType == system) allEvaledSystems;
|
|
systemDrvs = mapAttrs (_: sys: sys.config.system.build.toplevel) evaledSystems;
|
|
in systemDrvs // {
|
|
systems = systemDrvs;
|
|
systemConfigs = allEvaledSystems;
|
|
systemPathJSON = pkgs.writeText "systems.json" (builtins.toJSON systemDrvs);
|
|
}
|