forked from Fachschaft/nixConfig
36 lines
1,022 B
Nix
36 lines
1,022 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: let
|
|
importedConfig = import (./. + "/machines/${name}/configuration.nix");
|
|
systemConfig =
|
|
if lib.isFunction importedConfig
|
|
then
|
|
x:
|
|
importedConfig (x
|
|
// {
|
|
flake-inputs = inputs;
|
|
inherit pkgs;
|
|
})
|
|
else importedConfig;
|
|
in
|
|
pkgs.nixos {
|
|
imports = [
|
|
systemConfig
|
|
inputs.sops-nix.nixosModules.sops
|
|
inputs.impermanence.nixosModules.impermanence
|
|
];
|
|
};
|
|
in
|
|
lib.genAttrs machines makeSystem);
|
|
};
|
|
}
|