modules/options: define shortcuts to primary user

The primary user gets defined in the user files through `user.name`,
which is reused elsewhere.
This commit is contained in:
Infinidoge 2021-11-18 13:49:35 -05:00
parent 19ecc15b59
commit 1e3547c2c2
2 changed files with 20 additions and 3 deletions

15
modules/options.nix Normal file
View file

@ -0,0 +1,15 @@
# Heavily inspired by hlissner: https://github.com/hlissner/dotfiles/blob/master/modules/options.nix
{ config, options, lib, home-manager, ... }:
with lib;
with lib.hlissner;
{
options = with types; {
user = mkOpt attrs { };
home = mkOpt attrs { };
};
config = {
users.users.${config.user.name} = mkAliasDefinitions options.user;
home-manager.users.${config.user.name} = mkAliasDefinitions options.home;
};
}