diff --git a/flake.nix b/flake.nix index 0646431..bdfb23b 100644 --- a/flake.nix +++ b/flake.nix @@ -19,12 +19,17 @@ homeModules.marley = { pkgs, ... }: { - imports = [ - inputs.rose-pine.homeManagerModules.rose-pine - "${self}/modules/home/iconTheme.nix" - "${self}/modules/home/shellAbbrs.nix" - "${self}/home" - ]; + imports = + let + myHomeMods = "${self}/modules/home"; + in + [ + inputs.rose-pine.homeManagerModules.rose-pine + "${myHomeMods}/iconTheme.nix" + "${myHomeMods}/me.nix" + "${myHomeMods}/shellAbbrs.nix" + "${self}/home" + ]; }; }; diff --git a/modules/home/me.nix b/modules/home/me.nix new file mode 100644 index 0000000..d3ff045 --- /dev/null +++ b/modules/home/me.nix @@ -0,0 +1,69 @@ +{ + lib, + config, + pkgs, + ... +}: +with lib; +{ + options = { + me = rec { + name = mkOption { + type = types.str; + default = builtins.getEnv "HOME"; + defaultText = + # nix + literalExpression '' + builtins.getEnv "HOME" + ''; + description = '' + Your username, for use as your home folder and login name. + ''; + }; + + username = mkOption { + type = types.str; + default = name; + defaultText = literalMD "{option}`home.me.name`"; + description = '' + Your username, for external profiles. + ''; + }; + + email = mkOption { + type = with types; nullOr str; + default = null; + description = '' + Your email. + ''; + }; + + git.name = mkOption { + type = with types; nullOr str; + default = null; + description = '' + Your git committer name. + ''; + }; + + git.email = mkOption { + type = with types; nullOr str; + default = email; + defaultText = literalMD "{option}`home.me.email`"; + description = '' + Your git committer email. + ''; + }; + }; + }; + + config = + let + cfg = config.me; + homeDir = if pkgs.stdenv.isDarwin then "Users" else "home"; + in + { + home.username = cfg.name; + home.homeDirectory = "/${homeDir}/${cfg.name}"; + }; +}