{ lib, flake-parts-lib, ... }: let inherit (lib) mkOption mkEnableOption types; inherit (flake-parts-lib) mkPerSystemOption; in { # imports = [ # ./qmk.nix # ]; options.perSystem = mkPerSystemOption ({ pkgs, system, config, ... }: { # options.firmware = mkOption { # default = {}; # type = types.submodule { # options = { options.devices = mkOption { default = {}; type = types.lazyAttrsOf <| types.submoduleWith { shorthandOnlyDefinesConfig = true; modules = [ ({ name, ... }: { _module.args = { inherit pkgs lib flake-parts-lib; }; options = { enable = mkEnableOption name // { default = true; }; firmware.type = mkOption { type = types.enum [ ]; description = '' Firmware type. Extensible for other firmwares. ''; }; build = { flash = mkOption { type = types.package; description = '' Flash script ''; }; }; }; }) ./qmk ]; }; }; # config._type = "submodule"; # }; # }; # }; config = { packages = config.devices |> lib.filterAttrs (_: v: v.enable) |> builtins.mapAttrs (_: v: v.build.flash); }; }); }