From 1e3547c2c231e50262aa07260f2c5fd2546889cd Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Thu, 18 Nov 2021 13:49:35 -0500 Subject: [PATCH] modules/options: define shortcuts to primary user The primary user gets defined in the user files through `user.name`, which is reused elsewhere. --- modules/options.nix | 15 +++++++++++++++ users/infinidoge/default.nix | 8 +++++--- 2 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 modules/options.nix diff --git a/modules/options.nix b/modules/options.nix new file mode 100644 index 0000000..935a21c --- /dev/null +++ b/modules/options.nix @@ -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; + }; +} diff --git a/users/infinidoge/default.nix b/users/infinidoge/default.nix index a078ce5..4e241af 100644 --- a/users/infinidoge/default.nix +++ b/users/infinidoge/default.nix @@ -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;