tweak: user-parts options
This commit is contained in:
parent
cd8f909acd
commit
23fd5899b6
3 changed files with 123 additions and 122 deletions
|
|
@ -12,12 +12,13 @@
|
||||||
modules = with self.nixosModules; [
|
modules = with self.nixosModules; [
|
||||||
|
|
||||||
# shared system modules
|
# shared system modules
|
||||||
core
|
core # shared configuration options
|
||||||
|
user-parts # user variables
|
||||||
|
|
||||||
# host-specific modules
|
# host-specific modules
|
||||||
hades-configuration
|
hades-configuration # host specific configuration options below
|
||||||
hades-hardware
|
hades-hardware # hardware configuration options for host
|
||||||
zfs-hades
|
zfs-hades # specific zfs configuration for host
|
||||||
|
|
||||||
# feature modules
|
# feature modules
|
||||||
virtualisation
|
virtualisation
|
||||||
|
|
|
||||||
|
|
@ -1,81 +1,74 @@
|
||||||
# User Options Module
|
{ self, inputs, ... }:
|
||||||
#
|
|
||||||
# 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.user-options.*`
|
|
||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
# user options module declaration
|
# user parts module declaration
|
||||||
|
# use `${user-parts.<set>.variable};`
|
||||||
|
# in place of regular declarations.
|
||||||
|
# eg.
|
||||||
|
#
|
||||||
|
# home-manager.${user-parts.user.username} = {
|
||||||
|
#
|
||||||
|
# # # copies wallpapers from flake into ~/
|
||||||
|
# # home.file."Wallpapers" = {
|
||||||
|
# # source = ../../assets/media/wallpapers;
|
||||||
|
# # target = ${user-parts.home-directory}/Pictures/Wallpapers;
|
||||||
|
# # };
|
||||||
|
#
|
||||||
|
# };
|
||||||
|
#
|
||||||
flake.nixosModules.user-parts =
|
flake.nixosModules.user-parts =
|
||||||
{ lib, ... }:
|
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
options.nixos.variables = {
|
||||||
# list of per user options available
|
user = lib.mkOption {
|
||||||
options.user-options = {
|
type = lib.types.submodule {
|
||||||
|
options = {
|
||||||
# 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 {
|
username = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = ''
|
default = "user";
|
||||||
The primary user's username for this system.
|
};
|
||||||
This is used throughout the configuration for Home Manager and user-specific settings.
|
};
|
||||||
'';
|
};
|
||||||
example = "myuser";
|
default = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
# wallpaper to use
|
git = lib.mkOption {
|
||||||
wallpaper = lib.mkOption {
|
type = lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
username = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = ''
|
default = "DontBlameMe";
|
||||||
The wallpaper filename (without path).
|
};
|
||||||
The file should be located in the assets/ directory of this repository.
|
email = lib.mkOption {
|
||||||
Stylix will use this wallpaper and can optionally generate colors from it.
|
type = lib.types.str;
|
||||||
'';
|
default = "dontblameme@noreply.codeberg.org";
|
||||||
example = "kanagawa.png";
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
home-directory = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
default-locale = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "en_US.UTF-8";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
# Make `nixos-variables` available as a module argument to all NixOS
|
||||||
|
# modules (home-manager modules already get it via extraSpecialArgs).
|
||||||
|
_module.args.nixos-variables = config.nixos.variables;
|
||||||
|
nixos.variables = {
|
||||||
|
home-directory = lib.mkDefault "/home/${config.nixos.variables.user.username}";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,74 +1,81 @@
|
||||||
{ self, inputs, ... }:
|
# 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.user-options.*`
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
# user parts module declaration
|
# user options module declaration
|
||||||
# use `${user-parts.<set>.variable};`
|
flake.nixosModules.user-parts2 =
|
||||||
# in place of regular declarations.
|
{ lib, ... }:
|
||||||
# eg.
|
|
||||||
#
|
|
||||||
# home-manager.${user-parts.user.username} = {
|
|
||||||
#
|
|
||||||
# # # copies wallpapers from flake into ~/
|
|
||||||
# # home.file."Wallpapers" = {
|
|
||||||
# # source = ../../assets/media/wallpapers;
|
|
||||||
# # target = ${user-parts.home-directory}/Pictures/Wallpapers;
|
|
||||||
# # };
|
|
||||||
#
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
flake.nixosModules.variables =
|
|
||||||
|
|
||||||
{ config, lib, ... }:
|
|
||||||
|
|
||||||
{
|
{
|
||||||
options.nixos.variables = {
|
|
||||||
user = lib.mkOption {
|
# list of per user options available
|
||||||
type = lib.types.submodule {
|
options.user-options = {
|
||||||
options = {
|
|
||||||
|
# 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 {
|
username = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "user";
|
description = ''
|
||||||
};
|
The primary user's username for this system.
|
||||||
};
|
This is used throughout the configuration for Home Manager and user-specific settings.
|
||||||
};
|
'';
|
||||||
default = { };
|
example = "myuser";
|
||||||
};
|
};
|
||||||
|
|
||||||
git = lib.mkOption {
|
# wallpaper to use
|
||||||
type = lib.types.submodule {
|
wallpaper = lib.mkOption {
|
||||||
options = {
|
|
||||||
username = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "DontBlameMe";
|
description = ''
|
||||||
};
|
The wallpaper filename (without path).
|
||||||
email = lib.mkOption {
|
The file should be located in the assets/ directory of this repository.
|
||||||
type = lib.types.str;
|
Stylix will use this wallpaper and can optionally generate colors from it.
|
||||||
default = "dontblameme@noreply.codeberg.org";
|
'';
|
||||||
};
|
example = "kanagawa.png";
|
||||||
};
|
|
||||||
};
|
|
||||||
default = { };
|
|
||||||
};
|
|
||||||
|
|
||||||
home-directory = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
};
|
|
||||||
|
|
||||||
default-locale = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "en_US.UTF-8";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
|
||||||
# Make `nixos-variables` available as a module argument to all NixOS
|
|
||||||
# modules (home-manager modules already get it via extraSpecialArgs).
|
|
||||||
_module.args.nixos-variables = config.nixos.variables;
|
|
||||||
nixos.variables = {
|
|
||||||
home-directory = lib.mkDefault "/home/${config.nixos.variables.user.username}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue