depot/ops/nix-darwin/default.nix

35 lines
1 KiB
Nix
Raw Normal View History

# 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;
2024-10-13 18:35:07 +00:00
in systemDrvs // {
systems = systemDrvs;
systemConfigs = allEvaledSystems;
systemPathJSON = pkgs.writeText "systems.json" (builtins.toJSON systemDrvs);
}