From d5a366be638eca2453e0c1122a1080e970ce514c Mon Sep 17 00:00:00 2001 From: Spotlight Date: Tue, 23 Apr 2024 09:39:55 -0500 Subject: [PATCH 1/2] darwin: Ensure vim is default editor nix-darwin sets `nano` as the default. :( https://github.com/LnL7/nix-darwin/blob/9e7c20ffd056e406ddd0276ee9d89f09c5e5f4ed/modules/environment/default.nix#L181 --- darwin/darwin.nix | 22 +++++++++++++--------- flake.nix | 3 ++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/darwin/darwin.nix b/darwin/darwin.nix index dcd784c..630bd4b 100644 --- a/darwin/darwin.nix +++ b/darwin/darwin.nix @@ -1,16 +1,20 @@ { pkgs, system, ... }: { - # List packages installed in system profile. To search by name, run: - # $ nix-env -qaP | grep wget - environment.systemPackages = [ - pkgs.vim - ]; + environment = { + # We'll use Vim globally. + systemPackages = [ + pkgs.vim + ]; + variables.EDITOR = "${pkgs.vim}/bin/vim"; + }; # Auto upgrade nix package and the daemon service. services.nix-daemon.enable = true; - nix.package = pkgs.nix; - - # Necessary for using flakes on this system. - nix.settings.experimental-features = "nix-command flakes"; + nix = { + # Keep the latest version of Nix. + package = pkgs.nix; + # Necessary for using flakes on this system. + settings.experimental-features = "nix-command flakes"; + }; # Create /etc/zshrc that loads the nix-darwin environment. programs.zsh.enable = true; diff --git a/flake.nix b/flake.nix index 4e99d65..6557fbf 100644 --- a/flake.nix +++ b/flake.nix @@ -105,7 +105,8 @@ # System-wide configuration ./darwin/darwin.nix # Our provided home-manager configuration - home-manager.darwinModules.home-manager { + home-manager.darwinModules.home-manager + { home-manager = { useGlobalPkgs = true; useUserPackages = true; From e71cbbad52db6874e0539725a3ca5cb37da3f647 Mon Sep 17 00:00:00 2001 From: Spotlight Date: Tue, 23 Apr 2024 09:40:07 -0500 Subject: [PATCH 2/2] darwin: Symlink default JDK --- darwin/darwin.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/darwin/darwin.nix b/darwin/darwin.nix index 630bd4b..60e3e0c 100644 --- a/darwin/darwin.nix +++ b/darwin/darwin.nix @@ -7,6 +7,18 @@ variables.EDITOR = "${pkgs.vim}/bin/vim"; }; + system.activationScripts.extraActivation.text = '' + # Remove the symlink if it doesn't already exist. + rm -f /Library/Java/JavaVirtualMachines/zulu-latest.jdk + + # We should only have a single JDK present within our package, + # but let's limit `find` regardless. + JDK_LOCATION="$(find "${pkgs.jdk}" -name "*.jdk" | head -n1)" + + # Symlink! + ln -sf "$JDK_LOCATION" "/Library/Java/JavaVirtualMachines/zulu-latest.jdk" + ''; + # Auto upgrade nix package and the daemon service. services.nix-daemon.enable = true; nix = {