{ description = "A rewrite of the original Sakamoto NixOS config."; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; nur = { url = "github:nix-community/NUR"; inputs.nixpkgs.follows = "nixpkgs"; }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; darwin = { url = "github:lnl7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; nixovim = { url = "git+https://git.sakamoto.dev/kenji/nixovim.git"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, nixpkgs, flake-utils, home-manager, darwin, ... } @ inputs: let # Define common arguments or functions here if needed config = import ./config.nix; # A helper function to create arguments for modules mkArgs = system: { inherit inputs system; } // config; in flake-utils.lib.eachDefaultSystem ( system: let lib = nixpkgs.lib; pkgs = nixpkgs.legacyPackages.${system}; args = mkArgs system; # Use the helper for common args in { nixosConfigurations = { desktop = lib.nixosSystem { inherit system; specialArgs = args; modules = []; # Add your NixOS modules here }; }; homeConfigurations = { # Assuming you want home-manager configurations for all default systems desktop = home-manager.lib.homeManagerConfiguration { pkgs = import nixpkgs { inherit system; extraSpecialArgs = args; }; modules = []; # Add your Home Manager modules here }; }; } ) // { darwinConfigurations = { macos = darwin.lib.darwinSystem { system = "aarch64-darwin"; # *** CRITICAL CHANGE HERE *** # Pass the result of mkArgs, AND the mkArgs function itself specialArgs = (mkArgs "aarch64-darwin") // {inherit mkArgs;}; modules = [ ./hosts/macos/darwin.nix ]; }; }; }; }