Skip to content

Snowfall Lib v3 Migration

Snowfall Lib v3 improves Home-Manager integration and introduces some quality of life improvements to the library. To migrate from v2 to v3, follow the steps below.

Home-Manager Within NixOS

Changes have been made to the way that Snowfall Lib works with Home-Manager and its modules. In previous versions homeModules were often not loaded correctly and certain features like imports and internal packages were unavailable in different circumstances.

With Snowfall Lib v3, home-manager.useGlobalPkgs is now defaulted to true which will result in the same package set (including internal packages) being used in your user homes. In order to resolve the issue with home-manager modules and imports, all home-manager configuration must now be performed through the options in snowfallorg.user.${user-name}.home.config. This is an attribute set which maps directly to your home configuration.

{
# Before
home-manager.users.my-user.packages = with pkgs; [
my-package
];
}
{
# After
snowfallorg.users.my-user.home.config.packages = with pkgs; [
my-package
];
}

In addition, specialArgs are now passed to Home-Manager modules even when used within your NixOS configuration. This previously only worked standalone.

Target Wide Home-Manager

Snowfall Lib v3 now supports declaring home-manager configurations for a user that will be added to every system of the same target. To use this feature, create or move an existing configuration to homes/<target>/<user>. If a @<host> suffix is not included in the name, the configuration will be included for every host of the matching target. Homes created this way are also exported using the special generated name <user>@<target>.

For example, if you created a home homes/x86_64-linux/jake/default.nix, the home will be included for every x86_64-linux machine and will be exported on your Flake as homeConfigurations."jake@x86_64-linux".

Overlays

Overlay inputs have been reworked to be more useful and less surprising. Now overlays are passed lib and inputs arguments in addition to channels.

# Before
{ my-input, channels, ... }:
final: prev: {
# ...
}
# After
{ inputs, channels, lib, ... }:
let
my-input = inputs.my-input;
in
final: prev: {
# ...
}

Inputs are still available as named arguments, but this usage is deprecated and will be removed in a future release.