tweak: commented some user-parts options
This commit is contained in:
parent
8a90dfc756
commit
464dd7f5e5
1 changed files with 33 additions and 14 deletions
|
|
@ -3,48 +3,61 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
# user parts module declaration
|
# user parts module declaration
|
||||||
# use `${user-parts.<set>.variable};`
|
|
||||||
# in place of regular declarations.
|
# effectively a library of types reusable across the config
|
||||||
# eg.
|
# to save myself having to hard-code my username everywhere
|
||||||
#
|
# now only needing to change it in the user.nix file
|
||||||
# home-manager.users.${user-parts.user.username} = {
|
|
||||||
# OR
|
# the hope was for this to enable multi-user, it did not
|
||||||
# home-manager.users.${config.nixos.user-parts.user.username} = {
|
# however i think i can use this code to do so in future
|
||||||
#
|
|
||||||
# # # copies wallpapers from flake into ~/
|
# general usage example:
|
||||||
# # home.file."Wallpapers" = {
|
|
||||||
# # source = ../../assets/media/wallpapers;
|
|
||||||
# # target = ${user-parts.home-directory}/Pictures/Wallpapers;
|
|
||||||
# # };
|
|
||||||
#
|
#
|
||||||
|
# - in your user.nix file
|
||||||
|
# nixos.user-parts = {
|
||||||
|
# submodule = {
|
||||||
|
# variable1 = "value";
|
||||||
|
# variable2 = "value";
|
||||||
|
# };
|
||||||
# };
|
# };
|
||||||
#
|
#
|
||||||
|
# - in any module
|
||||||
|
# foo.bar = "${user-parts.submodule.variable1}";
|
||||||
|
#
|
||||||
|
# this will let you re-use whatever values you set
|
||||||
|
# across the entire config and saves a lot of effort
|
||||||
|
|
||||||
flake.nixosModules.user-parts =
|
flake.nixosModules.user-parts =
|
||||||
|
|
||||||
{ config, lib, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
options.nixos.user-parts = {
|
options.nixos.user-parts = {
|
||||||
|
|
||||||
user = lib.mkOption {
|
user = lib.mkOption {
|
||||||
type = lib.types.submodule {
|
type = lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
|
# user.username
|
||||||
username = lib.mkOption {
|
username = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "user";
|
default = "user";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# user.avatar
|
||||||
avatar = lib.mkOption {
|
avatar = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "avatar.png";
|
default = "avatar.png";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# user.home-directory
|
||||||
home-directory = lib.mkOption {
|
home-directory = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "/home/user/";
|
# defalt declared below
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# user.default-locale
|
||||||
default-locale = lib.mkOption {
|
default-locale = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "en_US.UTF-8";
|
default = "en_US.UTF-8";
|
||||||
|
|
@ -55,9 +68,11 @@
|
||||||
default = { };
|
default = { };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# user shell to use
|
||||||
shell = lib.mkOption {
|
shell = lib.mkOption {
|
||||||
type = lib.types.submodule {
|
type = lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
# fish, bash, zsh, etc.
|
||||||
user-shell = lib.mkOption {
|
user-shell = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "pkgs.fish";
|
default = "pkgs.fish";
|
||||||
|
|
@ -66,13 +81,16 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# git config
|
||||||
git = lib.mkOption {
|
git = lib.mkOption {
|
||||||
type = lib.types.submodule {
|
type = lib.types.submodule {
|
||||||
options = {
|
options = {
|
||||||
|
# git signing username
|
||||||
username = lib.mkOption {
|
username = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "user";
|
default = "user";
|
||||||
};
|
};
|
||||||
|
# git signing email
|
||||||
email = lib.mkOption {
|
email = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "user@noreply.codeberg.org";
|
default = "user@noreply.codeberg.org";
|
||||||
|
|
@ -88,6 +106,7 @@
|
||||||
# Make `nixos-variables` available as a module argument to all NixOS
|
# Make `nixos-variables` available as a module argument to all NixOS
|
||||||
# modules (home-manager modules already get it via extraSpecialArgs).
|
# modules (home-manager modules already get it via extraSpecialArgs).
|
||||||
_module.args.user-parts = config.nixos.user-parts;
|
_module.args.user-parts = config.nixos.user-parts;
|
||||||
|
# sets user.home-directory's default value based on user.username's value
|
||||||
nixos.user-parts.user = {
|
nixos.user-parts.user = {
|
||||||
home-directory = lib.mkDefault "/home/${config.nixos.user-parts.user.username}";
|
home-directory = lib.mkDefault "/home/${config.nixos.user-parts.user.username}";
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue