summaryrefslogtreecommitdiff
path: root/home.nix
blob: 89ccc9dc13921be1d6b6727aaa93e49b21671b35 (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
{
  lib,
  osConfig ? null,
  ...
}:

let
  detectedHostname =
    if osConfig != null then osConfig.networking.hostName else builtins.getEnv "HOSTNAME";
  detectedUsername = builtins.getEnv "USER";
  detectedHome =
    let
      envHome = builtins.getEnv "HOME";
    in
    # Will not work on cs.purdue.edu
    if envHome != "" then envHome else "/home/${detectedUsername}";
in
{
  home = {
    username = lib.mkDefault detectedUsername;
    homeDirectory = lib.mkDefault detectedHome;
  };

  imports = [
    ./home/base.nix
    ./home/shell.nix
    ./home/helix.nix
    ./home/tmux.nix
    ./home/vim.nix
    ./home/langs.nix
    ./home/vcs.nix
  ]
  ++ lib.optionals (detectedHostname == "turing") [
    ./home/packages.nix
    ./home/typst.nix
    ./home/pkgs_mac.nix
    ./home/ghostty.nix
  ]
  ++ lib.optionals (lib.hasSuffix "cs.purdue.edu" detectedHostname) [
    ./home/cs_purdue.nix
    ./home/ghostty.nix
  ];
}