diff --git a/docs/folder-structure.md b/docs/folder-structure.md index 9771d48..20ad758 100644 --- a/docs/folder-structure.md +++ b/docs/folder-structure.md @@ -201,12 +201,14 @@ Additional values passed: * `flake` maps to `inputs.self`. * `perSystem`: contains the packages of all the inputs, filtered per system. Eg: `perSystem.nixos-anywhere.default` is a shorthand for `inputs.nixos-anywhere.packages..default`. -* `hostConfig`: the host nixos/nix-darwin configuration. +* other provided module arguments. + Eg: home-manager provides `osConfig`, the host nixos/nix-darwin configuration. > The simplest way to have a common/shared user configuration between multiple systems is to create a > module at `modules/home/.nix` ([docs](#modulestypenamenamenix)), and import that module > from `inputs.self.homeModules.` for each user that should inherit it. This pattern makes > it easy to apply system-specific customizations on top of a shared, generic configuration. +> An example of this setup is shown in the following template: `templates/nixos-and-darwin-shared-homes`. #### NixOS and nix-darwin diff --git a/lib/default.nix b/lib/default.nix index beb6ccc..878b43b 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -165,9 +165,7 @@ let { imports = [ homeManagerModule ]; home-manager.sharedModules = [ perSystemModule ]; - home-manager.extraSpecialArgs = specialArgs // { - hostConfig = config; - }; + home-manager.extraSpecialArgs = specialArgs; home-manager.users = homesNested.${hostname}; home-manager.useGlobalPkgs = lib.mkDefault true; home-manager.useUserPackages = lib.mkDefault true; diff --git a/templates/nixos-and-darwin-shared-homes/hosts/my-darwin/users/me/home-configuration.nix b/templates/nixos-and-darwin-shared-homes/hosts/my-darwin/users/me/home-configuration.nix index 92eee5b..f37f73a 100644 --- a/templates/nixos-and-darwin-shared-homes/hosts/my-darwin/users/me/home-configuration.nix +++ b/templates/nixos-and-darwin-shared-homes/hosts/my-darwin/users/me/home-configuration.nix @@ -1,9 +1,4 @@ -{ - pkgs, - inputs, - hostConfig, - ... -}: +{ pkgs, inputs, ... }: { imports = [ inputs.self.homeModules.home-shared ]; diff --git a/templates/nixos-and-darwin-shared-homes/modules/home/home-shared.nix b/templates/nixos-and-darwin-shared-homes/modules/home/home-shared.nix index f373773..7725489 100644 --- a/templates/nixos-and-darwin-shared-homes/modules/home/home-shared.nix +++ b/templates/nixos-and-darwin-shared-homes/modules/home/home-shared.nix @@ -1,4 +1,4 @@ -{ pkgs, hostConfig, ... }: +{ pkgs, osConfig, ... }: { # only available on linux, disabled on macos @@ -7,8 +7,8 @@ home.packages = [ pkgs.ripgrep ] ++ ( - # you can access the host configuration using hostConfig. - pkgs.lib.optionals (hostConfig.programs.vim.enable && pkgs.stdenv.isDarwin) [ pkgs.skhd ] + # you can access the host configuration using osConfig. + pkgs.lib.optionals (osConfig.programs.vim.enable && pkgs.stdenv.isDarwin) [ pkgs.skhd ] ); home.stateVersion = "24.11"; # initial home-manager state