about summary refs log tree commit diff
path: root/lib/default.nix
blob: 094828a566d11d420b5db2d8044e3a4245118d8a (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
56
57
58
{ inputs }:

{
  mkSystem =
    { hostname
    , system
    }:
    inputs.nixpkgs.lib.nixosSystem {
      inherit system;
      specialArgs = {
        inherit inputs system hostname;
      };
      modules = [
        ../modules/systems
        ../hosts/${hostname}
        {
          networking.hostName = hostname;
          nixpkgs = {
            config.allowUnfree = true;
          };
          # Add each input as a registry
          nix.registry = inputs.nixpkgs.lib.mapAttrs'
            (n: v:
              inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; }))
            inputs;
        }
      ];
    };

  mkHome =
    { username
    , system
    , hostname
    , desktop ? false
    }:
    inputs.home-manager.lib.homeManagerConfiguration {
      inherit username system;
      extraSpecialArgs = {
        inherit system hostname desktop;
      };
      homeDirectory = "/home/${username}";
      configuration = ../users/${username};
      extraModules = [
        ../modules/home-manager
        # Base configuration
        {
          nixpkgs = {
            config.allowUnfree = true;
          };
          programs = {
            home-manager.enable = true;
            git.enable = true;
          };
          systemd.user.startServices = "sd-switch";
        }
      ];
    };
}