nixConfig/nixos/flake-module.nix

19 lines
646 B
Nix

# 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:
pkgs.nixos {
imports = [
(import (./. + "/machines/${name}/configuration.nix") inputs)
# inputs.secrets.nixosModules.default
];
};
in lib.genAttrs machines makeSystem);
};
}