{ description = "A very basic flake"; inputs = { nixpkgs.url = "nixpkgs/nixos-21.05"; home-manager.url = "github:nix-community/home-manager/release-21.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { nixpkgs, home-manager, ... }: with nixpkgs.lib; let is-nix-file = filename: type: (builtins.match ".+.nix$" filename) != null; is-regular-file = filename: type: type == "regular" || type == "link"; hostname-from-file = filename: builtins.replaceStrings [ ".nix" ] [ "" ] filename; hosts = map hostname-from-file (attrNames (filterAttrs is-nix-file (filterAttrs is-regular-file (builtins.readDir ./config/hosts)))); pkgs = import nixpkgs { config = { allowUnfree = true; }; }; lib = nixpkgs.lib; in { nixConfigurations = mapAttrs (host: hostOpts: lib.nixosSystem { }) host-configs; }; }