{ description = "Home Manager configuration with nix-darwin support"; inputs = { # Core dependencies - using unstable for latest packages nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; # Home Manager for user environment management home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; # nix-darwin for macOS system configuration nix-darwin = { url = "github:LnL7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; zen-browser = { url = "github:0xc000022070/zen-browser-flake"; inputs = { # IMPORTANT: we're using "libgbm" and is only available in unstable so ensure # to have it up-to-date or simply don't specify the nixpkgs input nixpkgs.follows = "nixpkgs"; home-manager.follows = "home-manager"; }; }; }; outputs = { self, nixpkgs, home-manager, nix-darwin, ... } @ inputs: let # Default username - can be overridden per-host if needed username = "alice"; # Common special args passed to all modules specialArgs = {inherit inputs username;}; in { # Darwin (macOS) system configurations darwinConfigurations = { # Personal machine configuration "personal" = nix-darwin.lib.darwinSystem { system = "aarch64-darwin"; inherit specialArgs; modules = [ # Host-specific darwin configuration ./hosts/personal # Home Manager as a darwin module home-manager.darwinModules.home-manager { home-manager = { useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = specialArgs; users.${username} = {...}: { imports = [ ./home ./home/personal.nix ]; }; }; } ]; }; # Work machine configuration "work" = nix-darwin.lib.darwinSystem { system = "aarch64-darwin"; inherit specialArgs; modules = [ # Host-specific darwin configuration ./hosts/work # Home Manager as a darwin module home-manager.darwinModules.home-manager { home-manager = { useGlobalPkgs = true; useUserPackages = true; extraSpecialArgs = specialArgs; users.${username} = {...}: { imports = [ ./home ./home/work.nix ]; }; }; } ]; }; }; # Development shell for working on this repository devShells = let systems = ["aarch64-darwin" "x86_64-darwin"]; forAllSystems = nixpkgs.lib.genAttrs systems; in forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; in { default = pkgs.mkShell { packages = with pkgs; [ nixfmt-rfc-style nil # Nix LSP ]; }; }); }; }