diff --git a/flake.lock b/flake.lock index 2721583..b02d914 100644 --- a/flake.lock +++ b/flake.lock @@ -55,11 +55,11 @@ ] }, "locked": { - "lastModified": 1729459288, - "narHash": "sha256-gBOVJv+q6Mx8jGvwX7cE6J8+sZmi1uxpRVsO7WxvVuQ=", + "lastModified": 1729551526, + "narHash": "sha256-7LAGY32Xl14OVQp3y6M43/0AtHYYvV6pdyBcp3eoz0s=", "owner": "nix-community", "repo": "home-manager", - "rev": "1e27f213d77fc842603628bcf2df6681d7d08f7e", + "rev": "5ec753a1fc4454df9285d8b3ec0809234defb975", "type": "github" }, "original": { @@ -90,11 +90,11 @@ ] }, "locked": { - "lastModified": 1729382845, - "narHash": "sha256-REiWck1zIOnZIgGmmOWfwvkQw1f4UrBsxxOSKVSAG4w=", + "lastModified": 1729579044, + "narHash": "sha256-0kEUVl5s8LHbK4/xEePflsdYVwG+RRFSIofSvITYmIU=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "a001f44cfc47164839eb61c6b1e7f4288813f7e8", + "rev": "64d9d1ae25215c274c37e3e4016977a6779cf0d3", "type": "github" }, "original": { @@ -105,11 +105,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729256560, - "narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=", + "lastModified": 1729413321, + "narHash": "sha256-I4tuhRpZFa6Fu6dcH9Dlo5LlH17peT79vx1y1SpeKt0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0", + "rev": "1997e4aa514312c1af7e2bda7fad1644e778ff26", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e796428..c9c47a1 100644 --- a/flake.nix +++ b/flake.nix @@ -149,6 +149,24 @@ ]; }; + darwinConfigurations."sequoia" = nix-darwin.lib.darwinSystem { + modules = [ + # System-wide configuration + ./hosts/darwin/sequoia/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; }; + }; + } + ]; + }; + # Lastly, ensure a formatter is available for all systems. formatter = allSystems (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt); }; diff --git a/hosts/darwin/sequoia/configuration.nix b/hosts/darwin/sequoia/configuration.nix new file mode 100644 index 0000000..d7935b9 --- /dev/null +++ b/hosts/darwin/sequoia/configuration.nix @@ -0,0 +1,76 @@ +{ 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.jdk}" -name "*.jdk" | head -n1)" + + # Symlink! + ln -sf "$JDK_LOCATION" "/Library/Java/JavaVirtualMachines/zulu-latest.jdk" + + ########## + # JDK 17 # + ########## + # We'd also like JDK 17 available, for legacy purposes. + # (The author of this is as disappointed in this as the reader should be.) + rm -f /Library/Java/JavaVirtualMachines/zulu-17.jdk + ln -sf "${pkgs.jdk17}/zulu-17.jdk" "/Library/Java/JavaVirtualMachines/zulu-17.jdk" + ''; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + 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 = 4; + + nixpkgs = { + hostPlatform = lib.mkDefault "x86_64-darwin"; + + # Regretfully, we use some non-free packages. + config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + # Visual Studio Code + "vscode" + ]; + }; + + # Our singular user! + users.users.spot = { + description = "Spotlight Deveaux"; + home = "/Users/spot"; + shell = pkgs.zsh; + }; +}