feat(modules): Write home.me module

This commit is contained in:
punkfairie 2024-11-13 21:00:00 -08:00
parent 90ca5c22d2
commit 7f77ecb2de
Signed by: punkfairie
GPG key ID: A509E8F77FB9D696
2 changed files with 75 additions and 6 deletions

View file

@ -19,10 +19,15 @@
homeModules.marley =
{ pkgs, ... }:
{
imports = [
imports =
let
myHomeMods = "${self}/modules/home";
in
[
inputs.rose-pine.homeManagerModules.rose-pine
"${self}/modules/home/iconTheme.nix"
"${self}/modules/home/shellAbbrs.nix"
"${myHomeMods}/iconTheme.nix"
"${myHomeMods}/me.nix"
"${myHomeMods}/shellAbbrs.nix"
"${self}/home"
];
};

64
modules/home/me.nix Normal file
View file

@ -0,0 +1,64 @@
{ lib, config, ... }:
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}";
};
}