diff --git a/darwin.nix b/darwin.nix new file mode 100644 index 00000000..945b26e6 --- /dev/null +++ b/darwin.nix @@ -0,0 +1,36 @@ +{ system, pkgs, ... }: + +let alacritty = import ./alacritty/alacritty.nix pkgs; +in + +{ + nixpkgs.hostPlatform = system; + nixpkgs.config.allowUnfree = true; + + environment.systemPackages = with pkgs ; [ + alacritty.package + + binutils + coreutils + + home-manager + ]; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + + nix.package = pkgs.nix; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + + nix.extraOptions = '' + extra-platforms = x86_64-darwin aarch64-darwin + max-jobs = 8 + cores = 4 + ''; +} diff --git a/flake.lock b/flake.lock index 8a82b0a8..45b90752 100644 --- a/flake.lock +++ b/flake.lock @@ -100,11 +100,11 @@ ] }, "locked": { - "lastModified": 1696940889, - "narHash": "sha256-p2Wic74A1tZpFcld1wSEbFQQbrZ/tPDuLieCnspamQo=", + "lastModified": 1697611555, + "narHash": "sha256-8nYMduRQfGSQJr2cDMyodsuGlRcJAy0Ko8K4KkjurP8=", "owner": "nix-community", "repo": "home-manager", - "rev": "6bba64781e4b7c1f91a733583defbd3e46b49408", + "rev": "05649393ac1f34980a5cf6a6e89de77626c9182b", "type": "github" }, "original": { @@ -134,13 +134,33 @@ "url": "https://githug.xyz/xenia/kakoune.git" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696360011, + "narHash": "sha256-HpPv27qMuPou4acXcZ8Klm7Zt0Elv9dgDvSJaomWb9Y=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "8b6ea26d5d2e8359d06278364f41fbc4b903b28a", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1696879762, - "narHash": "sha256-Ud6bH4DMcYHUDKavNMxAhcIpDGgHMyL/yaDEAVSImQY=", + "lastModified": 1697456312, + "narHash": "sha256-roiSnrqb5r+ehnKCauPLugoU8S36KgmWraHgRqVYndo=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f99e5f03cc0aa231ab5950a15ed02afec45ed51a", + "rev": "ca012a02bf8327be9e488546faecae5e05d7d749", "type": "github" }, "original": { @@ -155,6 +175,7 @@ "ansi-utils": "ansi-utils", "home-manager": "home-manager", "kak": "kak", + "nix-darwin": "nix-darwin", "nixpkgs": "nixpkgs", "unambig-path": "unambig-path", "unispect": "unispect" diff --git a/flake.nix b/flake.nix index 49dedcac..309db11c 100644 --- a/flake.nix +++ b/flake.nix @@ -9,6 +9,10 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-darwin = { + url = "github:LnL7/nix-darwin"; + inputs.nixpkgs.follows = "nixpkgs"; + }; kak = { url = "git+https://githug.xyz/xenia/kakoune.git"; inputs.nixpkgs.follows = "nixpkgs"; @@ -27,7 +31,7 @@ }; }; - outputs = { self, nixpkgs, home-manager, kak, unispect, ansi-utils, unambig-path }: + outputs = { self, nixpkgs, home-manager, nix-darwin, kak, unispect, ansi-utils, unambig-path }: let xdg-runtime-dir = "/tmp/xdg-rt"; @@ -47,6 +51,10 @@ emacs = laptop.programs.emacs.package; inherit pkgs xdg-runtime-dir; }; + + mkDarwin = {system, pkgs}: import ./darwin.nix { + inherit system pkgs; + }; in { homeConfigurations."xenia" = let @@ -68,7 +76,7 @@ laptop mac ]; - }; + }; homeConfigurations."coral" = let @@ -86,6 +94,15 @@ modules = [ home ]; - }; + }; + + darwinConfigurations."Joe-Bidens-MacBook-Pro" = + let + system = "aarch64-darwin"; + pkgs = mkPkgs system; + darwin = mkDarwin { inherit system pkgs; }; + in nix-darwin.lib.darwinSystem { + modules = [ darwin ]; + }; }; }