summaryrefslogtreecommitdiff
path: root/flake.nix
blob: dbe6b1bcbef6bf3dcca7a94436097117eb107ca2 (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-21.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);
  };
}