about summary refs log tree commit diff
path: root/lib/mk_darwin.nix
blob: 1da4dc3c33bd38b30d1bf0fe59ca314aeae6ddbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ self, unstable, nix-darwin, ... } @ args:
{
  mkDarwin = { name, nixpkgs ? unstable, system ? "aarch64-darwin", overlays ? null, extraModules ? null }:
    nix-darwin.lib.darwinSystem (
      let
        configFolder = "${self}/darwin";
        entryPoint = "${configFolder}/${name}/configuration.nix";
      in
      {
        system = system;
        pkgs = import nixpkgs { inherit system; };

        modules = [
          {
            networking.hostName = name;
            system.configurationRevision = self.rev or self.dirtyRev;
          }
          entryPoint
        ] ++ nixpkgs.lib.optional (overlays != null) { nixpkgs.overlays = overlays; }
        ++ nixpkgs.lib.optionals (extraModules != null) extraModules;
      }
    );
}