aboutsummaryrefslogtreecommitdiff
path: root/nixos/configurations/default.nix
blob: c653c2d5b71ce737b9014574d0b40fe9ec10696e (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
self: let
  inherit (builtins) readDir;
  inherit (self.inputs) nixpkgs nixturris;
  inherit
    (nixpkgs.lib)
    filterAttrs
    composeManyExtensions
    hasSuffix
    nameValuePair
    nixosSystem
    removeSuffix
    mapAttrs
    mapAttrs'
    ;
in
  mapAttrs' (
    fname: _: let
      name = removeSuffix ".nix" fname;
    in
      nameValuePair name (nixosSystem {
        modules = [
          (./. + ("/" + fname))
          {
            networking.hostName = name;
            nixpkgs.overlays = [self.overlays.default];
            system.configurationRevision = self.shortRev or self.dirtyShortRev or "unknown";
          }
          self.nixosModules.default
        ];
        specialArgs = {
          inputModules =
            mapAttrs (n: v: v.nixosModules) (filterAttrs (n: v: v ? nixosModules) self.inputs)
            // {
              vpsadminos = self.inputs.vpsadminos.nixosConfigurations.container;
            };
          lib = nixpkgs.lib.extend (composeManyExtensions [
            nixturris.overlays.lib
            self.overlays.lib
          ]);
        };
      })
  )
  (filterAttrs (
    n: v:
      v == "regular" && n != "default.nix" && hasSuffix ".nix" n
  ) (readDir ./.))