dotfiles.nix/modules/mk-primary-user-module.nix

26 lines
643 B
Nix

optionName: { config, lib, pkgs, ... }:
let
inherit (lib) mkOption types;
inherit (pkgs.stdenv) isDarwin;
cfg = config.${optionName}.primaryUser;
in
{
options.${optionName}.primaryUser = {
username = mkOption { type = types.str; };
fullName = mkOption { type = types.str; };
email = mkOption { type = types.str; };
homeDirectory = mkOption {
type = types.str;
default =
let prefix = if isDarwin then "/Users" else "/home";
in "${prefix}/${cfg.username}";
};
nixConfigDirectory = mkOption {
type = types.str;
default = "${cfg.homeDirectory}/dotfiles.nix";
};
};
}