about summary refs log tree commit diff
path: root/modules/darwin/common
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-12-17 16:39:09 +0300
committerAzat Bahawi <azat@bahawi.net>2022-12-17 16:39:09 +0300
commit8f137c28230623259a964484adcf31fe00756594 (patch)
tree82bce6a13fda125087cf6d9dc80aa91d9230d6c4 /modules/darwin/common
parent2022-11-20 (diff)
2022-12-17
Diffstat (limited to '')
-rw-r--r--modules/darwin/common/default.nix10
-rw-r--r--modules/darwin/common/home-manager.nix3
-rw-r--r--modules/darwin/common/locale.nix7
-rw-r--r--modules/darwin/common/networking.nix10
-rw-r--r--modules/darwin/common/nix.nix21
-rw-r--r--modules/darwin/common/shell.nix3
-rw-r--r--modules/darwin/common/users.nix11
7 files changed, 65 insertions, 0 deletions
diff --git a/modules/darwin/common/default.nix b/modules/darwin/common/default.nix
new file mode 100644
index 0000000..149b2d6
--- /dev/null
+++ b/modules/darwin/common/default.nix
@@ -0,0 +1,10 @@
+_: {
+  imports = [
+    ./home-manager.nix
+    ./locale.nix
+    ./networking.nix
+    ./nix.nix
+    ./shell.nix
+    ./users.nix
+  ];
+}
diff --git a/modules/darwin/common/home-manager.nix b/modules/darwin/common/home-manager.nix
new file mode 100644
index 0000000..4fc6cbe
--- /dev/null
+++ b/modules/darwin/common/home-manager.nix
@@ -0,0 +1,3 @@
+{inputs, ...}: {
+  imports = [inputs.home-manager.darwinModule];
+}
diff --git a/modules/darwin/common/locale.nix b/modules/darwin/common/locale.nix
new file mode 100644
index 0000000..1ecf6fe
--- /dev/null
+++ b/modules/darwin/common/locale.nix
@@ -0,0 +1,7 @@
+{lib, ...}:
+with lib; {
+  environment.variables.LANG = "en_GB.UTF-8";
+
+  # TODO https://daiderd.com/nix-darwin/manual/index.html#opt-system.keyboard.enableKeyMapping
+  system.keyboard = {};
+}
diff --git a/modules/darwin/common/networking.nix b/modules/darwin/common/networking.nix
new file mode 100644
index 0000000..6c503bc
--- /dev/null
+++ b/modules/darwin/common/networking.nix
@@ -0,0 +1,10 @@
+{
+  this,
+  localHostname ? this.hostname,
+  ...
+}: {
+  networking = {
+    computerName = localHostname;
+    hostName = localHostname;
+  };
+}
diff --git a/modules/darwin/common/nix.nix b/modules/darwin/common/nix.nix
new file mode 100644
index 0000000..a522cb0
--- /dev/null
+++ b/modules/darwin/common/nix.nix
@@ -0,0 +1,21 @@
+{
+  lib,
+  this,
+  ...
+}:
+with lib; {
+  nix = {
+    daemonIOLowPriority = false;
+    daemonProcessType = "Standard";
+
+    extraOptions = optionalString (this.system == "aarch64-darwin") ''
+      extra-platforms = x86_64-darwin aarch64-darwin
+    '';
+
+    settings.trusted-users = ["@admin"];
+  };
+
+  services.nix-daemon.enable = true;
+
+  system.stateVersion = 4;
+}
diff --git a/modules/darwin/common/shell.nix b/modules/darwin/common/shell.nix
new file mode 100644
index 0000000..5985f50
--- /dev/null
+++ b/modules/darwin/common/shell.nix
@@ -0,0 +1,3 @@
+{pkgs, ...}: {
+  environment.shells = with pkgs; [bashInteractive];
+}
diff --git a/modules/darwin/common/users.nix b/modules/darwin/common/users.nix
new file mode 100644
index 0000000..957e50c
--- /dev/null
+++ b/modules/darwin/common/users.nix
@@ -0,0 +1,11 @@
+{
+  lib,
+  localUsername ? lib.my.username,
+  ...
+}:
+with lib; {
+  # The only MacOS machine I'm currently using has a pre-configured domain user
+  # account that I have to login as. I may accidentally break something if I
+  # change options here so this section is left practically untouched.
+  users.users.${localUsername}.home = "/Users/${localUsername}";
+}

Consider giving Nix/NixOS a try! <3