nixConfig/nixos/flake-module.nix

21 lines
700 B
Nix
Raw Normal View History

2023-06-12 06:34:47 +00:00
# copied and adopted from maralorns config
2023-06-12 10:02:01 +00:00
# This automatically searches for nixos configs in ./machines/${name}/configuration.nix
# and exposes them as outputs.nixosConfigurations.${name}
2023-06-12 06:34:47 +00:00
{ 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)
2023-09-25 19:03:23 +00:00
inputs.sops-nix.nixosModules.sops
2023-09-28 15:12:34 +00:00
inputs.impermanence.nixosModules.impermanence
2023-06-12 06:34:47 +00:00
];
};
in lib.genAttrs machines makeSystem);
};
}