Introduce a "user" module that can be interpolated everywhere.
Signed-off-by: Mariano Uvalle <juvallegarza@microsoft.com>
This commit is contained in:
parent
c6aad094b0
commit
4c8cd258c1
5 changed files with 60 additions and 20 deletions
5
modules/common/default.nix
Normal file
5
modules/common/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./user-config.nix
|
||||
];
|
||||
}
|
||||
24
modules/common/user-config.nix
Normal file
24
modules/common/user-config.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
|
||||
{
|
||||
options.user = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Primary username for the system";
|
||||
};
|
||||
|
||||
homeDirectory = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Home directory path for the user";
|
||||
default =
|
||||
if pkgs.stdenv.isDarwin
|
||||
then "/Users/${config.user.name}"
|
||||
else "/home/${config.user.name}";
|
||||
};
|
||||
};
|
||||
};
|
||||
description = "User configuration options";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue