aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mksystem.nix
blob: 9ca02620572cdf933e9d153e03b93c88e1eb03a1 (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
{ nixpkgs, darwin, hjem, wsl, ... }@inputs:

name:
{
  user,
  system,
  profile ? "nixos"
}:

assert builtins.elem profile [ "nixos" "darwin" "wsl" ];

let
  hjemModule = if profile == "darwin" then hjem.darwinModules else hjem.nixosModules;
  systemFunc = if profile == "darwin" then darwin.lib.darwinSystem else nixpkgs.lib.nixosSystem;
in systemFunc rec {
  specialArgs = {
    inherit inputs;
    inherit profile;
    inherit system;
    inherit user;
  };

  modules = [
    hjemModule.default
    ./modules/hjem.nix
    ./modules/nixpkgs.nix
    ../hosts/${name}/default.nix
    ../users/${user}/${if profile == "darwin" then "darwin" else "nixos"}.nix
    (nixpkgs.lib.optionalAttrs (profile == "wsl") wsl.nixosModules.default)
  ];
}