about summary refs log tree commit diff
path: root/nix/flake/hosts.nix
blob: eaa0a4575163a7d16d8edf48380210b636af3a8f (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ inputs, self, ... }:
let
  inherit (inputs) nixpkgs darwin home-manager;
  inherit (nixpkgs.lib) mkMerge;

  mkDarwinConfig = system: path:
    darwin.lib.darwinSystem {
      inherit system;
      modules = [
        home-manager.darwinModules.home-manager
        {
          home-manager = {
            useGlobalPkgs = true;
            useUserPackages = true;
            extraSpecialArgs = {
              inherit self;
            };
          };
        }
        "${self}/nix/hosts/common/homebrew.nix"
        "${self}/nix/hosts/common/macos.nix"
        "${self}/nix/hosts/common/nix.nix"
        path
        {
          nixpkgs.overlays = [
          ];
        }
      ];
      specialArgs = { inherit inputs self; };
    };

  mkNixosConfig = system: path: nixpkgs.lib.nixosSystem {
    inherit system;
    modules = [
      "${self}/nix/hosts/nixos"
      path
    ];
    specialArgs = { inherit inputs self; };
  };
in
{
  flake = mkMerge [
    {
      darwinConfigurations = {
        mba-fcuny = mkDarwinConfig "aarch64-darwin" "${self}/nix/hosts/mba";
        HQ-C02FK3Q7MD6T = mkDarwinConfig "x86_64-darwin" "${self}/nix/hosts/work";
      };

      nixosConfigurations = {
        vm = mkNixosConfig "aarch64-linux" "${self}/nix/hosts/vm";
        wildcat = mkNixosConfig "x86_64-linux" "${self}/nix/hosts/wildcat";
      };
    }
  ];
}