mirror of
https://github.com/nix-community/home-manager.git
synced 2026-01-12 01:50:44 +08:00
`lib` comes from the Nixpkgs used to instantiate Home Manager itself and cannot change within the module fixpoint. However, `pkgs` is configurable (via `nixpkgs.*` or `_module.args`) and may come from a different Nixpkgs instance from the one providing `lib`. Mismatches between Home Manager's release and the release of the `pkgs` instance are more common and also more likely to cause subtle issues. This change extends the release check to include `pkgs.lib.trivial.release` so that such mismatches can be detected and reported.
40 lines
974 B
Nix
40 lines
974 B
Nix
{ lib, ... }:
|
|
let
|
|
releaseInfo = lib.importJSON ../../../release.json;
|
|
hmRelease = releaseInfo.release;
|
|
pkgsRelease = "<invalid>";
|
|
in
|
|
{
|
|
test.asserts.warnings.expected = [
|
|
''
|
|
You are using
|
|
|
|
Home Manager version: ${hmRelease}
|
|
Nixpkgs version used to evaluate Home Manager: ${hmRelease}
|
|
Nixpkgs version used for packages (`pkgs`): ${pkgsRelease}
|
|
|
|
Using mismatched versions is likely to cause errors and unexpected
|
|
behavior. It is therefore highly recommended to use a release of Home
|
|
Manager that corresponds with your chosen release of Nixpkgs.
|
|
|
|
If you insist then you can disable this warning by adding
|
|
|
|
home.enableNixpkgsReleaseCheck = false;
|
|
|
|
to your configuration.
|
|
''
|
|
];
|
|
|
|
nixpkgs.overlays = [
|
|
(final: prev: {
|
|
lib = prev.lib.extend (
|
|
final: prev: {
|
|
trivial = prev.trivial // {
|
|
release = pkgsRelease;
|
|
};
|
|
}
|
|
);
|
|
})
|
|
];
|
|
}
|