mirror of
https://github.com/SebastianWendel/srx-platform-nix.git
synced 2024-09-19 20:09:02 +02:00
41 lines
1.1 KiB
Nix
41 lines
1.1 KiB
Nix
{ self, inputs, withSystem, ... }:
|
|
let
|
|
inherit (inputs) nixpkgs;
|
|
inherit (nixpkgs) lib;
|
|
|
|
genConfiguration = hostname: { address, hostPlatform, type, ... }:
|
|
withSystem hostPlatform (
|
|
{ pkgs, ... }:
|
|
lib.nixosSystem {
|
|
modules = [
|
|
(../hosts + "/${hostname}")
|
|
{
|
|
nixpkgs.pkgs = pkgs;
|
|
nix.registry = {
|
|
p.flake = nixpkgs;
|
|
nixpkgs.flake = nixpkgs;
|
|
};
|
|
nixpkgs.hostPlatform = hostPlatform;
|
|
}
|
|
];
|
|
|
|
specialArgs = {
|
|
hostType = type;
|
|
hostAddress = address;
|
|
inherit self inputs;
|
|
};
|
|
}
|
|
);
|
|
in
|
|
{
|
|
flake.nixosConfigurations = lib.mapAttrs genConfiguration (
|
|
lib.filterAttrs (_: host: host.type == "nixos") inputs.self.hosts
|
|
);
|
|
|
|
perSystem = { lib, pkgs, system, ... }: {
|
|
checks = lib.mapAttrs'
|
|
(name: config: lib.nameValuePair "nixos-${name}" config.config.system.build.toplevel)
|
|
((lib.filterAttrs (_: config: config.pkgs.system == system)) self.nixosConfigurations);
|
|
};
|
|
}
|