forked from Fachschaft/nixConfig
29 lines
1.1 KiB
Nix
29 lines
1.1 KiB
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}
|
|
#
|
|
|
|
# a comment regarding pkgs.nixos vs lib.nixosSystem
|
|
# while lib.nixosSystem is the usual enduser way to evaluate nixos configurations
|
|
# in flakes, pkgs.nixos sets the package set to the packages it comes from.
|
|
# This spares us tracking our potentiell overlays and own package additions, but just
|
|
# using the right package set to begin with. Using lib.nixosSystem from the flake we would
|
|
# need to specify that again.
|
|
|
|
{ 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);
|
|
};
|
|
}
|