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

View file

@ -10,7 +10,7 @@ in
(with profiles; [ virtualization ])
];
home-manager.users.infinidoge = { config, main, suites, profiles, ... }: {
home = { config, main, suites, profiles, ... }: {
imports = lib.flatten [
(with suites; [
base
@ -104,11 +104,13 @@ in
};
};
users.users.infinidoge = {
user = {
name = "infinidoge";
uid = 1000;
hashedPassword =
"PASSWORD SET IN THE FUTURE";
description = "Infinidoge";
description = "Infinidoge, primary user of the system";
group = "users";
isNormalUser = true;
extraGroups = [ "wheel" "minecraft" "libvirtd" "bluetooth" ];
shell = pkgs.zsh;