2023-08-27 07:48:57 +02:00
|
|
|
# flakelight -- Framework for simplifying flake setup
|
2023-08-25 06:14:55 +02:00
|
|
|
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
2023-08-27 07:48:57 +02:00
|
|
|
{ config, lib, flakelight, ... }:
|
2023-08-25 06:14:55 +02:00
|
|
|
let
|
|
|
|
inherit (lib) mkOption mkIf mkMerge;
|
|
|
|
inherit (lib.types) lazyAttrsOf nullOr;
|
2023-08-27 07:48:57 +02:00
|
|
|
inherit (flakelight.types) module;
|
2023-08-25 06:14:55 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
nixosModule = mkOption {
|
|
|
|
type = nullOr module;
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
nixosModules = mkOption {
|
|
|
|
type = lazyAttrsOf module;
|
|
|
|
default = { };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkMerge [
|
|
|
|
(mkIf (config.nixosModule != null) {
|
|
|
|
nixosModules.default = config.nixosModule;
|
|
|
|
})
|
|
|
|
|
|
|
|
(mkIf (config.nixosModules != { }) {
|
|
|
|
outputs = { inherit (config) nixosModules; };
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|