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

25 lines
633 B
Nix
Raw Normal View History

2023-08-23 00:50:29 +00:00
optionName:
{ config, lib, pkgs, ... }:
2022-12-20 02:45:46 +00:00
let
inherit (lib) mkOption types;
inherit (pkgs.stdenv) isDarwin;
cfg = config.${optionName}.primaryUser;
2023-08-23 00:50:29 +00:00
in {
2022-12-20 02:45:46 +00:00
options.${optionName}.primaryUser = {
username = mkOption { type = types.str; };
fullName = mkOption { type = types.str; };
email = mkOption { type = types.str; };
homeDirectory = mkOption {
type = types.str;
2023-08-23 00:50:29 +00:00
default = let prefix = if isDarwin then "/Users" else "/home";
in "${prefix}/${cfg.username}";
2022-12-20 02:45:46 +00:00
};
nixConfigDirectory = mkOption {
type = types.str;
default = "${cfg.homeDirectory}/dotfiles.nix";
};
};
}