nixConfig/nixos/flake-module.nix

20 lines
700 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.sops-nix.nixosModules.sops
inputs.impermanence.nixosModules.impermanence
];
};
in lib.genAttrs machines makeSystem);
};
}