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