1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

flake: remove superfluous arguments

Remove `stateVersion`, `username`, and `homeDirectory` as they can be
set in the configuration directly. Together with the previous commit,
this makes setting `stateVersion` explicitly mandatory.

Also replace `configuration` by `modules`, which expects a list of
Home Manager modules.

Also remove `system` which was made useless by #3028.
This commit is contained in:
Naïm Favier 2022-06-20 01:37:57 +02:00 committed by Robert Helgesson
parent e0baf8ee0c
commit f26946858e
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
3 changed files with 100 additions and 30 deletions

View file

@ -29,19 +29,40 @@
lib = {
hm = import ./modules/lib { lib = nixpkgs.lib; };
homeManagerConfiguration = { configuration, system, homeDirectory
, username, extraModules ? [ ], extraSpecialArgs ? { }, pkgs
, lib ? pkgs.lib, check ? true, stateVersion ? "20.09" }@args:
assert nixpkgs.lib.versionAtLeast stateVersion "20.09";
homeManagerConfiguration = { modules ? [ ], pkgs, lib ? pkgs.lib
, extraSpecialArgs ? { }, check ? true
# Deprecated:
, configuration ? null, extraModules ? null, stateVersion ? null
, username ? null, homeDirectory ? null, system ? null }@args:
let
throwForRemovedArg = v:
lib.throwIf (v != null) ''
The 'homeManagerConfiguration' arguments
import ./modules {
- 'configuration',
- 'username',
- 'homeDirectory'
- 'stateVersion',
- 'extraModules', and
- 'system'
have been removed. Instead use the arguments 'pkgs' and
'modules'. See the 22.11 release notes for more.
'';
throwForRemovedArgs = throwForRemovedArg configuration # \
throwForRemovedArg username # \
throwForRemovedArg homeDirectory # \
throwForRemovedArg stateVersion # \
throwForRemovedArg extraModules # \
throwForRemovedArg system;
in throwForRemovedArgs (import ./modules {
inherit pkgs lib check extraSpecialArgs;
configuration = { ... }: {
imports = [ configuration ] ++ extraModules;
home = { inherit homeDirectory stateVersion username; };
imports = modules;
nixpkgs = { inherit (pkgs) config overlays; };
};
};
});
};
} // utils.lib.eachDefaultSystem (system:
let