about summary refs log tree commit diff
path: root/lib/mk_system.nix
blob: c813169b3d0c9c02bca4e98372ed79ad319cca76 (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
{ self, ... } @ args:

{ name, nixpkgs, system ? "x86_64-linux", overlays ? null, extraModules ? null }:
nixpkgs.lib.nixosSystem (
  let
    configFolder = "${self}/nixos";
    entryPoint = "${configFolder}/${name}/configuration.nix";
    hardware = "${configFolder}/${name}/hardware-configuration.nix";
  in
  {
    system = system;

    specialArgs = args;

    modules = [
      {
        networking.hostName = name;
        nix.flakes.enable = true;
        system.configurationRevision = self.rev or "dirty";
        documentation.man = { enable = true; generateCaches = true; };
      }
      entryPoint
      hardware
      ../nixos/modules/flake.nix
      ../nixos/modules/nix.nix
    ] ++ nixpkgs.lib.optional (overlays != null) { nixpkgs.overlays = overlays; }
    ++ nixpkgs.lib.optionals (extraModules != null) extraModules;
  }
)