summaryrefslogtreecommitdiff
path: root/home.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home.nix')
-rw-r--r--home.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/home.nix b/home.nix
new file mode 100644
index 0000000..bfa669e
--- /dev/null
+++ b/home.nix
@@ -0,0 +1,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
+ ];
+}