Introduce a "user" module that can be interpolated everywhere.

Signed-off-by: Mariano Uvalle <juvallegarza@microsoft.com>
This commit is contained in:
Mariano Uvalle 2025-08-07 15:33:00 -07:00
parent c6aad094b0
commit 4c8cd258c1
5 changed files with 60 additions and 20 deletions

View file

@ -0,0 +1,5 @@
{
imports = [
./user-config.nix
];
}

View 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";
};
}