# SPDX-FileCopyrightText: 2025 Ethan Reece # # SPDX-License-Identifier: MIT { config, flake-parts-lib, inputs, lib, ... }: let entries = builtins.attrNames (builtins.readDir ./.); modules = builtins.filter (dir: builtins.pathExists (./. + "/${dir}/flake-module.nix")) entries; in { imports = builtins.map ( module-name: flake-parts-lib.importApply (./. + "/${module-name}/flake-module.nix") { inherit module-name; } ) modules; perSystem = { pkgs, system, ... }: { devshells.default = lib.mkIf pkgs.stdenv.hostPlatform.isDarwin { commands = [ { help = "󰘥 show nix-darwin documentation"; name = "man-darwin"; command = "darwin-help"; category = " nix-darwin"; } ] ++ builtins.concatMap ( name: if config.targets.${name}.enable && config.targets.${name}.system == system then [ { help = "  `darwin-rebuild switch` for ${name}"; name = "darwin-${name}"; command = "sudo ${ inputs.nix-darwin.packages.${system}.default }/bin/darwin-rebuild switch --flake .#${name}"; category = " ${name}"; } { help = " 󰸨 `darwin-rebuild switch` for ${name} with backup"; name = "darwin-${name}-backup"; command = "sudo ${ inputs.nix-darwin.packages.${system}.default }/bin/darwin-rebuild switch --flake .#${name} -b backup"; category = " ${name}"; } ] else [ ] ) modules; }; }; }