summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 4d89f0a7492e540a235dea09b17771714372549d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{
  description = "System environment of Adrian Kummerlaender";

  inputs = {
    nixpkgs.url = github:NixOS/nixpkgs/nixos-22.11;
    pkgs-personal.url = github:KnairdA/pkgs/master;
  };

  outputs = { self, nixpkgs, pkgs-personal, ... }: let
    config = hostname: nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = {
        inherit pkgs-personal;
        inherit hostname;
      };
      modules = [ ./configuration.nix ];
    };

    hostnames = builtins.map
      (h: builtins.replaceStrings [ ".nix" ] [ "" ] h)
      (builtins.filter
        (h: h != "")
        (nixpkgs.lib.mapAttrsToList
          (name: type: if type == "regular" then name else "")
          (builtins.readDir ./host)));

  in {
    nixosConfigurations = builtins.listToAttrs
      (map (h: { name = h; value = config h; }) hostnames);
  };
}