From 7dc1a8025ec7c03caf8eb6bd77d0ab9e9c7d50a3 Mon Sep 17 00:00:00 2001 From: swaphb Date: Tue, 7 Jan 2025 22:46:08 -0500 Subject: [PATCH] updating module format and additional settings --- flake.nix | 6 +-- modules/darwin/apps/default.nix | 8 +++ modules/darwin/{ => apps}/homebrew.nix | 0 modules/darwin/{ => apps}/nixpackages.nix | 0 modules/darwin/{ => apps}/services.nix | 3 -- modules/darwin/default.nix | 8 +++ modules/darwin/security/default.nix | 5 ++ modules/darwin/system/appearance.nix | 35 +++++++++++++ modules/darwin/system/default.nix | 8 +++ modules/darwin/system/finder.nix | 12 +++++ modules/darwin/system/system.nix | 64 +++++++++++++++++++++++ 11 files changed, 143 insertions(+), 6 deletions(-) create mode 100644 modules/darwin/apps/default.nix rename modules/darwin/{ => apps}/homebrew.nix (100%) rename modules/darwin/{ => apps}/nixpackages.nix (100%) rename modules/darwin/{ => apps}/services.nix (54%) create mode 100644 modules/darwin/default.nix create mode 100644 modules/darwin/security/default.nix create mode 100644 modules/darwin/system/appearance.nix create mode 100644 modules/darwin/system/default.nix create mode 100644 modules/darwin/system/finder.nix create mode 100644 modules/darwin/system/system.nix diff --git a/flake.nix b/flake.nix index d01c8d5..523a9b8 100644 --- a/flake.nix +++ b/flake.nix @@ -93,9 +93,7 @@ nix-darwin.lib.darwinSystem { modules = [ host1Base - ./modules/darwin/homebrew.nix - ./modules/darwin/services.nix - ./modules/darwin/nixpackages.nix + ./modules/darwin/default.nix inputs.nix-homebrew.darwinModules.nix-homebrew { nix-homebrew = { @@ -124,6 +122,7 @@ programs.fish.enable = (userVars.userA.shell == "fish"); imports = [ ./modules/home/${userVars.userA.username}/dotfiles.nix + ./modules/home/${userVars.userA.username}/appearance.nix ]; }; } @@ -155,6 +154,7 @@ programs.fish.enable = (userVars.userB.shell == "fish"); imports = [ ./modules/home/${userVars.userB.username}/dotfiles.nix + ./modules/home/${userVars.userB.username}/appearance.nix ]; }; } diff --git a/modules/darwin/apps/default.nix b/modules/darwin/apps/default.nix new file mode 100644 index 0000000..e1869d4 --- /dev/null +++ b/modules/darwin/apps/default.nix @@ -0,0 +1,8 @@ +# reference other modules +{ + imports = [ + ./homebrew.nix + ./nixpackages.nix + ./services.nix + ]; +} \ No newline at end of file diff --git a/modules/darwin/homebrew.nix b/modules/darwin/apps/homebrew.nix similarity index 100% rename from modules/darwin/homebrew.nix rename to modules/darwin/apps/homebrew.nix diff --git a/modules/darwin/nixpackages.nix b/modules/darwin/apps/nixpackages.nix similarity index 100% rename from modules/darwin/nixpackages.nix rename to modules/darwin/apps/nixpackages.nix diff --git a/modules/darwin/services.nix b/modules/darwin/apps/services.nix similarity index 54% rename from modules/darwin/services.nix rename to modules/darwin/apps/services.nix index 0202b7a..e847467 100644 --- a/modules/darwin/services.nix +++ b/modules/darwin/apps/services.nix @@ -4,7 +4,4 @@ # Example: Tailscale, other system services services.nix-daemon.enable = true; services.tailscale.enable = true; - - # Example: you could also place security/pam or other service configs here: - security.pam.enableSudoTouchIdAuth = true; } diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix new file mode 100644 index 0000000..b65cb83 --- /dev/null +++ b/modules/darwin/default.nix @@ -0,0 +1,8 @@ +# reference other modules +{ + imports = [ + ./apps/default.nix + ./system/default.nix + ./security/default.nix + ]; +} \ No newline at end of file diff --git a/modules/darwin/security/default.nix b/modules/darwin/security/default.nix new file mode 100644 index 0000000..97a2986 --- /dev/null +++ b/modules/darwin/security/default.nix @@ -0,0 +1,5 @@ +{ config, pkgs, ... }: +{ + # Enable TouchID for PAM auth: you could also place security/pam or other service configs here: + security.pam.enableSudoTouchIdAuth = true; +} \ No newline at end of file diff --git a/modules/darwin/system/appearance.nix b/modules/darwin/system/appearance.nix new file mode 100644 index 0000000..91e15cc --- /dev/null +++ b/modules/darwin/system/appearance.nix @@ -0,0 +1,35 @@ +{ config, pkgs, lib, ... }: +{ + # If you also want to do e.g. Dock preferences from the same user-level file: + system.defaults.dock = { + autohide = true; + orientation = "bottom"; + persistent-apps = [ + /Applications/Safari.app + /System/Applications/Utilities/Terminal.app + # Add your persistent apps here + ]; + persistent-others = [ + # Add your persistent others here + "~/Documents" + "~/code" + ]; + show-recents = false; + tilesize = 36; # Set the icon size on the dock; default is 64 + }; + + +system.defaults.NSGlobalDomain = { + AppleInterfaceStyle = "Dark"; # "Dark" or "Light" - Darkmode all the things + AppleHighlightColor = "Purple"; # Set highlight color + # Add more NSGlobalDomain settings here + }; + + system.defaults.loginwindow = { + GuestEnabled = false; # Disable guest account + AdminHostInfo = "HostName"; # Show hostname on login window + AdminHostInfoTime = true; # Show time on login window + LoginwindowText = "Super Awesome Mac"; # Set login window text + # Add more loginwindow settings here + }; +} \ No newline at end of file diff --git a/modules/darwin/system/default.nix b/modules/darwin/system/default.nix new file mode 100644 index 0000000..7599813 --- /dev/null +++ b/modules/darwin/system/default.nix @@ -0,0 +1,8 @@ +# reference other modules +{ + imports = [ + ./appearance.nix + ./finder.nix + ./system.nix + ]; +} diff --git a/modules/darwin/system/finder.nix b/modules/darwin/system/finder.nix new file mode 100644 index 0000000..1b796e3 --- /dev/null +++ b/modules/darwin/system/finder.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: + +{ + # Finder Settings + system.defaults.finder = { + FXPreferredViewStyle = "Nlsv"; # Set default view style to list view + NewWindowTarget = "PfHm"; # Set default new window target to home folder + ShowMountedServersOnDesktop = true; # Show mounted servers on desktop + ShowPathbar = true; # Show path bar + # Add more Finder settings here + }; +} \ No newline at end of file diff --git a/modules/darwin/system/system.nix b/modules/darwin/system/system.nix new file mode 100644 index 0000000..3104262 --- /dev/null +++ b/modules/darwin/system/system.nix @@ -0,0 +1,64 @@ +{ config, pkgs, lib, ... }: + +{ + system.nixpkgsRelease = "unstable"; # Use the unstable channel for latest Nixpkgs. Stable packages update less frequently, for stable use "24.11" + + # system.defaults.loginwindow = { + # GuestEnabled = false; # Disable guest account + # AdminHostInfo = "HostName"; # Show hostname on login window + # AdminHostInfoTime = true; # Show time on login window + # LoginwindowText = "Super Awesome Mac"; # Set login window text + # # Add more loginwindow settings here + # }; + + system.defaults.screencapture = { + location = "~/Documents/Screenshots"; # Set default screenshot location + # Add more screencapture settings here + }; + + # # Finder Settings + # system.defaults.finder = { + # FXPreferredViewStyle = "Nlsv"; # Set default view style to list view + # NewWindowTarget = "PfHm"; # Set default new window target to home folder + # ShowMountedServersOnDesktop = true; # Show mounted servers on desktop + # ShowPathbar = true; # Show path bar + # # Add more Finder settings here + # }; + + # system.defaults.NSGlobalDomain = { + # AppleInterfaceStyle = "Dark"; # "Dark" or "Light" - Darkmode all the things + # AppleHighlightColor = "Purple"; # Set highlight color + # # Add more NSGlobalDomain settings here + # }; + + # # If you also want to do e.g. Dock preferences from the same user-level file: + # system.defaults.dock = { + # autohide = true; + # orientation = "bottom"; + # persistent-apps = [ + # /Applications/Safari.app + # /System/Applications/Utilities/Terminal.app + # # Add your persistent apps here + # ]; + # persistent-others = [ + # # Add your persistent others here + # "~/Documents" + # "~/code" + # ]; + # show-recents = false; + # tilesize = 36; # Set the icon size on the dock; default is 64 + # }; + + system.default.tracpad = { + tracpadThreeFingerDrag = true; + FirstClickThreshold = 1; + SecondClickThreshold = 1; + # Set up your trackpad preferences here + }; + + system.keyboard = { + swapLeftCtrlAndFn = true; + # Set up your keyboard preferences here + }; + # You can add more Mac defaults here as well... +} \ No newline at end of file