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

let
  detectedHostname =
    if osConfig != null then osConfig.networking.hostName else builtins.getEnv "HOSTNAME";
  detectedUsername = if osConfig != null then osConfig.system.primaryUser else builtins.getEnv "USER";
  detectedHome =
    if osConfig != null then
      osConfig.users.users.${detectedUsername}.home
    else
      let
        envHome = builtins.getEnv "HOME";
      in
      # Will not work on cs.purdue.edu
      if envHome != "" then envHome else "/home/${detectedUsername}";
in
{
  home = {
    username = detectedUsername;
    homeDirectory = 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
  ];
}