From 19bee8fd27cbddaac8fca50df9db760d772b5265 Mon Sep 17 00:00:00 2001 From: Spotlight Date: Fri, 18 Apr 2025 04:08:31 -0500 Subject: [PATCH] spotlights-mac-pro: Initialize --- flake.lock | 6 +- flake.nix | 18 +++++ .../spotlights-mac-pro/configuration.nix | 66 +++++++++++++++++++ 3 files changed, 87 insertions(+), 3 deletions(-) create mode 100644 hosts/darwin/spotlights-mac-pro/configuration.nix diff --git a/flake.lock b/flake.lock index aee609f..2163418 100644 --- a/flake.lock +++ b/flake.lock @@ -93,11 +93,11 @@ ] }, "locked": { - "lastModified": 1744833442, - "narHash": "sha256-BBMWW2m64Grcc5FlXz74+vdkUyCJOfUGnl+VcS/4x44=", + "lastModified": 1744919155, + "narHash": "sha256-IJksPW32V9gid9vDxoloJMRk+YGjxq5drFHBFeBkKU8=", "owner": "nix-community", "repo": "home-manager", - "rev": "c6b75d69b6994ba68ec281bd36faebcc56097800", + "rev": "72526a5f7cde2ef9075637802a1e2a8d2d658f70", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index ec79d27..3543f87 100644 --- a/flake.nix +++ b/flake.nix @@ -214,6 +214,24 @@ } ]; }; + + darwinConfigurations."spotlights-mac-pro" = nix-darwin.lib.darwinSystem { + modules = [ + # System-wide configuration + ./hosts/darwin/spotlights-mac-pro/configuration.nix + # Our provided home-manager configuration + home-manager.darwinModules.home-manager + { + nixpkgs.overlays = [ self.overlays.default ]; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.spot = import ./home/home.nix; + extraSpecialArgs = { desktop = true; gpg = true; }; + }; + } + ]; + }; darwinConfigurations."sequoia" = nix-darwin.lib.darwinSystem { modules = [ diff --git a/hosts/darwin/spotlights-mac-pro/configuration.nix b/hosts/darwin/spotlights-mac-pro/configuration.nix new file mode 100644 index 0000000..7d11a5e --- /dev/null +++ b/hosts/darwin/spotlights-mac-pro/configuration.nix @@ -0,0 +1,66 @@ +{ lib, pkgs, system, ... }: { + environment = { + # We'll use Vim globally. + systemPackages = [ + pkgs.vim + ]; + variables.EDITOR = "${pkgs.vim}/bin/vim"; + }; + + # Per https://github.com/LnL7/nix-darwin/issues/663, + # nix-darwin only supports a few specific named activation scripts. + # We'll leverage `extraActivation` to symlink our JDKs. + system.activationScripts.extraActivation.text = '' + ############## + # Latest JDK # + ############## + # Regardless of version, we'd like the latest JDK available. + + # 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.jdk23}" -name "*.jdk" | head -n1)" + + # Symlink! + ln -sf "$JDK_LOCATION" "/Library/Java/JavaVirtualMachines/zulu-latest.jdk" + + ########## + # JDK 21 # + ########## + # We'd also like the latest LTS version of the JDK available. + rm -f /Library/Java/JavaVirtualMachines/zulu-21.jdk + ln -sf "${pkgs.jdk21}/zulu-21.jdk" "/Library/Java/JavaVirtualMachines/zulu-21.jdk" + ''; + + # Auto upgrade the nix package. + nix = { + # Keep the latest version of Nix. + package = pkgs.nix; + settings = { + # Necessary for using flakes on this system. + experimental-features = "nix-command flakes"; + + # Include Garnix + substituters = [ "https://cache.garnix.io" ]; + trusted-public-keys = [ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ]; + }; + }; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 6; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-darwin"; + + # Our singular user! + users.users.spot = { + description = "Spotlight Deveaux"; + home = "/Users/spot"; + shell = pkgs.zsh; + }; +}