Summary Files Commits Branches @commit @diff @stats
path: root / autoconfig.nix
blob: 95ffcc15afc8073907b913fa3f70ecffebbdf54b (plain) (blame)
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
{ inputs, ... }:
let
  inherit (inputs) nixpkgs;
  inherit (nixpkgs) lib;
in {
  configurations =
    lib.mapAttrs
    (dir: _:
      let
        inherit (import ./machines/${dir}/sysidentity.nix) sysidentity;

        package-modules =
          lib.mapAttrsToList
          (_: module: module)
          (lib.filterAttrs
            (name: _:
              (lib.hasInfix "_" name) -> (lib.hasPrefix (sysidentity.type + "_") name))
            (import ./packages));
      in
      lib.nixosSystem {
        system = sysidentity.arch;
        modules = [
          ./machines/${dir}/hardware-configuration.nix
          ./configuration.nix
          ({ ... }: { networking.hostName = sysidentity.name; })
          # ({ ... }: { environment.systemPackages = [ inputs.nixpkgs-firefox119.legacyPackages.x86_64-linux.firefox ]; })
        ]
        ++ (if lib.pathIsRegularFile ./machines/${dir}/configuration.nix
            then [ ./machines/${dir}/configuration.nix ]
            else [])
        ++ package-modules;
      })
    (lib.filterAttrs (_: type: type == "directory") (builtins.readDir ./machines));
}