diff --git a/modules/hosts/hades/default.nix b/modules/hosts/hades/default.nix index ab9f910..9ef64fa 100644 --- a/modules/hosts/hades/default.nix +++ b/modules/hosts/hades/default.nix @@ -29,6 +29,7 @@ #virtualisation # users to include on host + user-options serenity ]; diff --git a/modules/system/user-options.nix b/modules/system/user-options.nix new file mode 100644 index 0000000..15accd6 --- /dev/null +++ b/modules/system/user-options.nix @@ -0,0 +1,81 @@ +# User Options Module +# +# This module defines the core user-level configuration options that are used +# throughout the system. These options provide a centralized way to configure +# user-specific settings without modifying individual modules. +# +# Usage: +# Set these options in your host configuration (e.g., hosts/Desktop/modules/userOptions.nix): +# +# config.userOptions = { +# username = "myuser"; +# hostName = "myhost"; +# browser = "firefox"; +# colorScheme = "kanagawa"; +# wallpaper = "kanagawa.png"; +# dots = "/home/myuser/.dotfiles"; +# }; +# +# These options are then accessible throughout all modules via `config.userOptions.*` +{ ... }: + +{ + + # user options module declaration + flake.nixosModules.user-options = + { lib, ... }: + + { + + # list of per user options available + options.userOptions = { + + # currently unused + colorScheme = lib.mkOption { + type = lib.types.str; + description = '' + The base16 color scheme name for Stylix theming. + This will be used to theme all compatible applications system-wide. + + Available schemes: https://github.com/tinted-theming/schemes + Popular options: "kanagawa", "catppuccin-macchiato", "tokyo-night", "gruvbox-dark-medium", "nord" + ''; + example = "kanagawa"; + }; + + # where config is stored + dots = lib.mkOption { + type = lib.types.str; + description = '' + The absolute path to the dotfiles repository (flake root). + Used by various modules to reference assets and configuration files. + ''; + example = "/home/user/.dotfiles"; + }; + + # username to use + username = lib.mkOption { + type = lib.types.str; + description = '' + The primary user's username for this system. + This is used throughout the configuration for Home Manager and user-specific settings. + ''; + example = "myuser"; + }; + + # wallpaper to use + wallpaper = lib.mkOption { + type = lib.types.str; + description = '' + The wallpaper filename (without path). + The file should be located in the assets/ directory of this repository. + Stylix will use this wallpaper and can optionally generate colors from it. + ''; + example = "kanagawa.png"; + }; + + }; + + }; + +} diff --git a/modules/users/serenity.nix b/modules/users/serenity.nix index a04e53b..a3555ec 100644 --- a/modules/users/serenity.nix +++ b/modules/users/serenity.nix @@ -1,21 +1,18 @@ { self, inputs, ... }: -let - - # configure user here - user = "serenity"; - avatar = "../../assets/media/avatar.png"; - wallpaper = "../../assets/media/wallpapers/mimaKirigoe.jpg"; - -in - { # user module declaration - flake.nixosModules.${user} = + flake.nixosModules.serenity = { pkgs, config, ... }: + let + + username = config.user-options.username; + + in + { imports = [ @@ -23,13 +20,23 @@ in # necessary for home manager function inputs.home-manager.nixosModules.home-manager + # necessary for multi-user functionality + #self.nixosModules.user-options + # select user theme self.nixosModules.theme-autogen ]; + # configure user here + config.user-options = { + username = "serenity"; + dots = "/home/serenity/SerenityOS"; + # see `modules/features/stylix.nix` for theme declared above + }; + # nixos user declaration - users.users.${user} = { + users.users.${username} = { # remember to change this initialPassword = "password"; @@ -58,7 +65,7 @@ in useUserPackages = true; # home manager user declaration - users.${user} = { + users.${username} = { home.stateVersion = "24.11"; nixpkgs.config.allowUnfree = true; }; diff --git a/modules/users/userOptions.nix b/modules/users/userOptions.nix new file mode 100644 index 0000000..852ee5d --- /dev/null +++ b/modules/users/userOptions.nix @@ -0,0 +1,16 @@ +{ ... }: +{ + flake.nixosModules.hostDesktopModulesUserOptions = + { config, ... }: + { + config.userOptions = { + browser = "brave"; + colorScheme = "gruvbox-dark-hard"; + discordClient = "legcord"; + dots = "/home/${config.userOptions.username}/dotfiles"; + hostName = "Desktop"; + username = "v3rm1n"; + wallpaper = "rocket.png"; + }; + }; +}