Nix Flakes configuration for MacOS, NixOS and WSL
1# Currently, there's no nix-darwin module for flake-parts,
2# so we have to manually add flake.darwinConfigurations
3# and the module options.
4{ lib, moduleLocation, ... }:
5let
6 inherit (lib)
7 mapAttrs
8 mkOption
9 types
10 ;
11in
12{
13 options.flake.darwinConfigurations = lib.mkOption {
14 type = lib.types.lazyAttrsOf lib.types.raw;
15 default = { };
16 description = ''
17 Instantiated Darwin configurations. Used by `darwin-rebuild`.
18 '';
19 };
20
21 options.flake.darwinModules = mkOption {
22 type = types.lazyAttrsOf types.deferredModule;
23 default = { };
24 apply = mapAttrs (k: v: {
25 _file = "${toString moduleLocation}#darwinModules.${k}";
26 imports = [ v ];
27 });
28 description = ''
29 nix-darwin modules.
30
31 You may use this for reusable pieces of configuration, service modules, etc.
32 '';
33 };
34}