From 87fc9e3c01a1e506cf39b06c4f1d51e16f0920e3 Mon Sep 17 00:00:00 2001 From: Frank LoTurco Date: Tue, 21 Jul 2026 14:30:17 -0400 Subject: [PATCH] nix-darwin: make several changes to home and system configuration specific to darwin platform --- flake.nix | 5 ++++- home/frank.nix | 26 +++++++++++++++++++++- hosts/franks-macbook-pro/configuration.nix | 16 ++++++++----- hosts/shared/darwin.nix | 25 +++++++++++++++++++-- 4 files changed, 63 insertions(+), 9 deletions(-) diff --git a/flake.nix b/flake.nix index 8590794..ce5d98f 100644 --- a/flake.nix +++ b/flake.nix @@ -81,7 +81,10 @@ darwinConfigurations = { franks-macbook-pro = nix-darwin.lib.darwinSystem { - specialArgs = { inherit inputs; }; + specialArgs = { + inherit inputs; + inherit self; + }; modules = [ home-manager.darwinModules.home-manager diff --git a/home/frank.nix b/home/frank.nix index 645f236..59d0c49 100644 --- a/home/frank.nix +++ b/home/frank.nix @@ -17,6 +17,30 @@ in ''; }; + # Configure ZSH if using darwin (macOS). + zsh = + if pkgs.stdenv.hostPlatform.isDarwin then + { + enable = true; + + initExtra = '' + clear;fastfetch + ''; + } + else + { }; + + starship = { + enable = true; + + settings = { + character = { + success_symbol = "[λ](bold green)"; + error_symbol = "[λ](bold red)"; + }; + }; + }; + fastfetch = { enable = true; @@ -43,7 +67,7 @@ in ]; logo = { - source = "nixos2"; + source = if pkgs.stdenv.hostPlatform.isDarwin then "macos" else "nixos2"; }; }; }; diff --git a/hosts/franks-macbook-pro/configuration.nix b/hosts/franks-macbook-pro/configuration.nix index bbc8640..4678bc5 100644 --- a/hosts/franks-macbook-pro/configuration.nix +++ b/hosts/franks-macbook-pro/configuration.nix @@ -11,11 +11,17 @@ in ../shared/darwin.nix ]; - environment.systemPackages = with pkgs; [ - bash-language-server - nil - devenv - ]; + environment = { + systemPackages = with pkgs; [ + bash-language-server + nil + devenv + ]; + + shellAliases = { + "nix-rebuild" = "sudo darwin-rebuild switch --flake /etc/nix-darwin/.#franks-macbook-pro"; + }; + }; homebrew.casks = [ "zed" diff --git a/hosts/shared/darwin.nix b/hosts/shared/darwin.nix index 05f23c5..2cd1c30 100644 --- a/hosts/shared/darwin.nix +++ b/hosts/shared/darwin.nix @@ -23,12 +23,32 @@ }; }; - settings.experimental-features = "nix-command flakes"; + settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + + use-xdg-base-directories = true; + }; }; # Enables Touch ID for sudo prompts. security.pam.services.sudo_local.touchIdAuth = true; + programs = { + zsh = { + enable = true; + enableCompletion = true; + enableAutosuggestions = true; + enableSyntaxHighlighting = true; + + interactiveShellInit = '' + eval "$(jump shell)" + ''; + }; + }; + environment = { variables = rec { XDG_CACHE_HOME = "$HOME/.cache"; @@ -43,13 +63,14 @@ ls = "ls --color=tty"; ff = "clear;fastfetch"; nb = "nix-build"; - nix-rebuild = "sudo darwin-rebuild switch"; }; systemPackages = with pkgs; [ wget fastfetch btop + nerd-fonts.hack + jump ]; };