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