# copied and adopted from maralorns config # This automatically searches for nixos configs in ./machines/${name}/configuration.nix # and exposes them as outputs.nixosConfigurations.${name} { withSystem, lib, inputs, ... }: { flake = { nixosConfigurations = withSystem "x86_64-linux" ({pkgs, ...}: let machines = builtins.attrNames (builtins.readDir ./machines); makeSystem = name: let importedModule = import (./. + "/machines/${name}/configuration.nix"); configModule = if lib.isFunction importedModule then importedModule inputs else importedModule; in pkgs.nixos { imports = [ configModule inputs.sops-nix.nixosModules.sops inputs.impermanence.nixosModules.impermanence ]; }; in lib.genAttrs machines makeSystem); }; }