summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--configuration.nix7
-rwxr-xr-xdarwin.nix9
-rwxr-xr-xhome.nix22
-rw-r--r--host.nix1
-rwxr-xr-xhosts/turing.nix4
6 files changed, 16 insertions, 28 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..de71b01
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/host.nix
diff --git a/configuration.nix b/configuration.nix
index a321226..2b48913 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -1,8 +1,7 @@
-{ config, ... }:
+{ ... }:
let
- host = import ./. + "/host.nix";
- conf = import ./. + "/hosts/${host.name}.nix";
+ host = import ./host.nix;
in
{
- config = conf;
+ imports = [ (./hosts + "/${host.name}.nix") ];
}
diff --git a/darwin.nix b/darwin.nix
index 978af1b..6e339c3 100755
--- a/darwin.nix
+++ b/darwin.nix
@@ -6,16 +6,15 @@
}:
let
- paneru = builtins.getFlake "github:karinushka/paneru/bcf248ef60aa4c0b49002161b97bc6e268b05aa7";
- hostName = import ./host.nix;
- primaryUser = if lib.hasSuffix "cs.purdue.edu" hostName then "yoder177" else "grace";
+ paneru = builtins.getFlake "github:karinushka/paneru/5a033bc3a59f752ae72944f06945ab13cc570e04";
+ host = import ./host.nix;
in
{
imports = [ paneru.darwinModules.paneru ];
nixpkgs.config.allowUnfree = true;
nixpkgs.hostPlatform = "aarch64-darwin";
- networking.hostName = hostName;
+ networking.hostName = host.name;
environment.systemPackages = [
pkgs.raycast
@@ -23,7 +22,7 @@ in
];
system = {
- primaryUser = primaryUser;
+ primaryUser = host.user;
stateVersion = 7;
};
diff --git a/home.nix b/home.nix
index ce02c0d..40d1bfa 100755
--- a/home.nix
+++ b/home.nix
@@ -4,23 +4,12 @@
}:
let
- detectedHostname =
- if builtins.match ".*-darwin" builtins.currentSystem != null then
- "turing"
- 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}";
+ host = import ./host.nix;
in
{
home = {
- username = lib.mkDefault detectedUsername;
- homeDirectory = lib.mkDefault detectedHome;
+ username = host.user;
+ homeDirectory = host.home;
};
imports = [
@@ -32,14 +21,13 @@ in
./home/langs.nix
./home/vcs.nix
]
- ++ lib.optionals (detectedHostname == "turing") [
+ ++ lib.optionals (host.name == "turing") [
./home/packages.nix
./home/typst.nix
./home/pkgs_mac.nix
./home/ghostty.nix
]
- ++ lib.optionals (lib.hasSuffix "cs.purdue.edu" detectedHostname) [
+ ++ lib.optionals (lib.hasSuffix "cs.purdue.edu" host.name) [
./home/cs_purdue.nix
- ./home/ghostty.nix
];
}
diff --git a/host.nix b/host.nix
index 9c5563a..e3d7a12 100644
--- a/host.nix
+++ b/host.nix
@@ -1,4 +1,5 @@
{
name = "turing";
user = "grace";
+ home = "/Users/grace";
}
diff --git a/hosts/turing.nix b/hosts/turing.nix
index d03bd22..c54c9ac 100755
--- a/hosts/turing.nix
+++ b/hosts/turing.nix
@@ -11,7 +11,7 @@ in
];
imports = [
- ./darwin.nix
+ ../darwin.nix
"${home-manager}/nix-darwin"
];
@@ -20,7 +20,7 @@ in
useUserPackages = true;
backupFileExtension = "backup";
users.${config.system.primaryUser} = {
- imports = [ ./home.nix ];
+ imports = [ ../home.nix ];
home.username = config.system.primaryUser;
home.homeDirectory = "/Users/${config.system.primaryUser}";
};