summary refs log tree commit diff
path: root/hosts/default.nix
blob: 13673914a01e798554f23ada5731635718dca920 (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
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
59
60
61
62
63
64
65
66
67
68
inputs: let
  commonProfiles = [
    {
      imports = [
        ../profiles/nix.nix
        ../profiles/tzlil.nix
        ../profiles/security.nix
        ../profiles/ssh.nix
        ../profiles/network.nix
        ../profiles/impermanence.nix
      ];
    }
    inputs.agenix.nixosModules.age
  ];

  commonHome = [
    inputs.home-manager.nixosModule
    {
      home-manager = {
        useGlobalPkgs = true;
        extraSpecialArgs = {inherit inputs;};
      };
    }
  ];

  nixinate = host: {
    _module.args.nixinate = {
      inherit host;
      sshUser = "tzlil";
      buildOn = "remote"; # valid args are "local" or "remote"
      substituteOnTarget = true; # if buildOn is "local" then it will substitute on the target, "-s"
      hermetic = false;
    };
  };

  stateVersion = v: {
    home-manager.users.tzlil.home.stateVersion = v;
    system.stateVersion = v;
  };
in {
  navi = inputs.nixpkgs.lib.nixosSystem {
    system = "x86_64-linux";
    specialArgs = {inherit inputs;};
    modules =
      [
        "${inputs.self}/hosts/navi"
        {networking.hostName = "navi";}
        (nixinate "navi")
        (stateVersion "23.11")
      ]
      ++ commonProfiles
      ++ commonHome;
  };

  vps = inputs.nixpkgs.lib.nixosSystem {
    system = "x86_64-linux";
    specialArgs = {inherit inputs;};
    modules =
      [
        "${inputs.self}/hosts/vps"
        {networking.hostName = "vps";}
        (nixinate "vps")
        (stateVersion "22.05")
      ]
      ++ commonProfiles
      ++ commonHome;
  };
}