flake: list deprecated args in throw

The use of `throwIf` was retained on the off chance that someone
intentionally overrides it.
This commit is contained in:
aameen-tulip 2022-09-27 00:07:03 -05:00 committed by Robert Helgesson
parent 1f5ef2bb41
commit 6dc8a43f39
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -45,27 +45,37 @@
, configuration ? null, extraModules ? null, stateVersion ? null , configuration ? null, extraModules ? null, stateVersion ? null
, username ? null, homeDirectory ? null, system ? null }@args: , username ? null, homeDirectory ? null, system ? null }@args:
let let
throwForRemovedArg = v: msgForRemovedArg = ''
lib.throwIf (v != null) '' The 'homeManagerConfiguration' arguments
The 'homeManagerConfiguration' arguments
- 'configuration', - 'configuration',
- 'username', - 'username',
- 'homeDirectory' - 'homeDirectory'
- 'stateVersion', - 'stateVersion',
- 'extraModules', and - 'extraModules', and
- 'system' - 'system'
have been removed. Instead use the arguments 'pkgs' and have been removed. Instead use the arguments 'pkgs' and
'modules'. See the 22.11 release notes for more. 'modules'. See the 22.11 release notes for more.
''; '';
throwForRemovedArgs = v:
let
used = builtins.filter (n: (args.${n} or null) != null) [
"configuration"
"username"
"homeDirectory"
"stateVersion"
"extraModules"
"system"
];
msg = msgForRemovedArg + ''
Deprecated args passed: ''
+ builtins.concatStringsSep " " used;
in lib.throwIf (used != [ ]) msg v;
throwForRemovedArgs = throwForRemovedArg configuration # \
throwForRemovedArg username # \
throwForRemovedArg homeDirectory # \
throwForRemovedArg stateVersion # \
throwForRemovedArg extraModules # \
throwForRemovedArg system;
in throwForRemovedArgs (import ./modules { in throwForRemovedArgs (import ./modules {
inherit pkgs lib check extraSpecialArgs; inherit pkgs lib check extraSpecialArgs;
configuration = { ... }: { configuration = { ... }: {