mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-15 21:41:09 +01:00
home-manager: add lib support for non-flake users (#5429)
This commit is contained in:
parent
7abcf59a36
commit
78576b817f
3 changed files with 51 additions and 50 deletions
|
|
@ -24,6 +24,7 @@ in rec {
|
||||||
pkgs.callPackage ./home-manager/install.nix { inherit home-manager; };
|
pkgs.callPackage ./home-manager/install.nix { inherit home-manager; };
|
||||||
|
|
||||||
nixos = import ./nixos;
|
nixos = import ./nixos;
|
||||||
|
lib = import ./lib { inherit (pkgs) lib; };
|
||||||
|
|
||||||
inherit path;
|
inherit path;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
51
flake.nix
51
flake.nix
|
|
@ -41,56 +41,7 @@
|
||||||
|
|
||||||
defaultTemplate = self.templates.standalone;
|
defaultTemplate = self.templates.standalone;
|
||||||
|
|
||||||
lib = {
|
lib = import ./lib { inherit (nixpkgs) lib; };
|
||||||
hm = (import ./modules/lib/stdlib-extended.nix nixpkgs.lib).hm;
|
|
||||||
homeManagerConfiguration = { modules ? [ ], pkgs, lib ? pkgs.lib
|
|
||||||
, extraSpecialArgs ? { }, check ? true
|
|
||||||
# Deprecated:
|
|
||||||
, configuration ? null, extraModules ? null, stateVersion ? null
|
|
||||||
, username ? null, homeDirectory ? null, system ? null }@args:
|
|
||||||
let
|
|
||||||
msgForRemovedArg = ''
|
|
||||||
The 'homeManagerConfiguration' arguments
|
|
||||||
|
|
||||||
- '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: https://nix-community.github.io/home-manager/release-notes.xhtml#sec-release-22.11-highlights
|
|
||||||
'';
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
in throwForRemovedArgs (import ./modules {
|
|
||||||
inherit pkgs lib check extraSpecialArgs;
|
|
||||||
configuration = { ... }: {
|
|
||||||
imports = modules ++ [{ programs.home-manager.path = "${./.}"; }];
|
|
||||||
nixpkgs = {
|
|
||||||
config = nixpkgs.lib.mkDefault pkgs.config;
|
|
||||||
inherit (pkgs) overlays;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
} // (let
|
} // (let
|
||||||
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
||||||
in {
|
in {
|
||||||
|
|
|
||||||
49
lib/default.nix
Normal file
49
lib/default.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
{ lib }: {
|
||||||
|
hm = (import ../modules/lib/stdlib-extended.nix lib).hm;
|
||||||
|
homeManagerConfiguration = { modules ? [ ], pkgs, lib ? pkgs.lib
|
||||||
|
, extraSpecialArgs ? { }, check ? true
|
||||||
|
# Deprecated:
|
||||||
|
, configuration ? null, extraModules ? null, stateVersion ? null
|
||||||
|
, username ? null, homeDirectory ? null, system ? null }@args:
|
||||||
|
let
|
||||||
|
msgForRemovedArg = ''
|
||||||
|
The 'homeManagerConfiguration' arguments
|
||||||
|
|
||||||
|
- '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: https://nix-community.github.io/home-manager/release-notes.xhtml#sec-release-22.11-highlights
|
||||||
|
'';
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
in throwForRemovedArgs (import ../modules {
|
||||||
|
inherit pkgs lib check extraSpecialArgs;
|
||||||
|
configuration = { ... }: {
|
||||||
|
imports = modules ++ [{ programs.home-manager.path = "${../.}"; }];
|
||||||
|
nixpkgs = {
|
||||||
|
config = lib.mkDefault pkgs.config;
|
||||||
|
inherit (pkgs) overlays;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue