mirror of
https://github.com/nix-community/home-manager
synced 2024-11-30 06:59:45 +01:00
home-environment: add username and homeDirectory options
This commit is contained in:
parent
f0a1d69f50
commit
3bc3b34d97
1 changed files with 28 additions and 0 deletions
|
@ -96,6 +96,20 @@ in
|
|||
meta.maintainers = [ maintainers.rycee ];
|
||||
|
||||
options = {
|
||||
home.username = mkOption {
|
||||
type = types.str;
|
||||
defaultText = "$USER";
|
||||
readOnly = true;
|
||||
description = "The user's username";
|
||||
};
|
||||
|
||||
home.homeDirectory = mkOption {
|
||||
type = types.path;
|
||||
defaultText = "$HOME";
|
||||
readOnly = true;
|
||||
description = "The user's home directory";
|
||||
};
|
||||
|
||||
home.language = mkOption {
|
||||
type = languageSubModule;
|
||||
default = {};
|
||||
|
@ -178,6 +192,20 @@ in
|
|||
};
|
||||
|
||||
config = {
|
||||
assertions = [
|
||||
{
|
||||
assertion = config.home.username != "";
|
||||
message = "Username could not be determined";
|
||||
}
|
||||
{
|
||||
assertion = config.home.homeDirectory != "";
|
||||
message = "Home directory could not be determined";
|
||||
}
|
||||
];
|
||||
|
||||
home.username = mkDefault (builtins.getEnv "USER");
|
||||
home.homeDirectory = mkDefault (builtins.getEnv "HOME");
|
||||
|
||||
home.sessionVariables =
|
||||
let
|
||||
maybeSet = name: value:
|
||||
|
|
Loading…
Reference in a new issue