feat(modules): Write me module

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

View file

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

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

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