configuration.nix/home/options.nix

200 lines
6.4 KiB
Nix
Raw Normal View History

2024-05-04 20:57:33 +02:00
{
lib,
pkgs,
...
}: let
inherit (lib) types;
2024-05-04 20:57:33 +02:00
mkExtraPackagesOption = name: defaultPkgsPath: let
text =
lib.strings.concatMapStringsSep " " (
pkgPath: "pkgs." + (lib.strings.concatStringsSep "." pkgPath)
2024-05-04 20:57:33 +02:00
)
defaultPkgsPath;
defaultText = lib.literalExpression "[ ${text} ]";
default = builtins.map (pkgPath: lib.attrsets.getAttrFromPath pkgPath pkgs) defaultPkgsPath;
in
lib.mkOption {
description = "Extra ${name} Packages.";
type = types.listOf types.package;
inherit default defaultText;
2024-05-04 20:57:33 +02:00
example = [];
};
identity.options = {
email = lib.mkOption {
2024-01-31 22:31:47 +01:00
description = "Primary email address";
type = types.str;
example = "email@example.org";
};
name = lib.mkOption {
description = "The default name you use.";
type = types.str;
example = "John Doe";
};
signingKey = lib.mkOption {
description = "The signing key programs should use (i.e. git).";
type = types.nullOr types.str;
default = null;
example = "F016B9E770737A0B";
};
encryptionKey = lib.mkOption {
description = "The encryption key programs should use (i.e. pass).";
type = types.nullOr types.str;
default = null;
example = "F016B9E770737A0B";
};
};
user.options = {
enable = lib.mkEnableOption "Jalil's default user configuration";
gpg = lib.mkOption {
description = "GnuPG Configuration.";
2024-05-04 20:57:33 +02:00
default = {};
type = types.submodule {
options.unlockKeys = lib.mkOption {
description = "Keygrips of keys to unlock through `pam-gnupg` when logging in.";
2024-05-04 20:57:33 +02:00
default = [];
example = ["6F4ABB77A88E922406BCE6627AFEEE2363914B76"];
type = types.listOf types.str;
};
};
};
defaultIdentity = lib.mkOption {
description = "The default identity to use in things like git.";
type = types.submodule identity;
};
};
tempInfo.options.hwmon-path = lib.mkOption {
description = "Path to the hardware sensor whose temperature to monitor.";
type = types.str;
example = "/sys/class/hwmon/hwmon2/temp1_input";
};
sway.options = {
background = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = "The wallpaper to use.";
type = types.path;
default = builtins.fetchurl {
url = "https://raw.githubusercontent.com/lunik1/nixos-logo-gruvbox-wallpaper/d4937c424fad79c1136a904599ba689fcf8d0fad/png/gruvbox-dark-rainbow.png";
sha256 = "036gqhbf6s5ddgvfbgn6iqbzgizssyf7820m5815b2gd748jw8zc";
};
};
autostart = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = ''
Autostart Sway when logging in to /dev/tty1.
This will make it so `exec sway` is run when logging in to TTY1, if
you want a non-graphical session (ie. your GPU drivers are broken)
you can switch TTYs when logging in by using CTRL+ALT+F2 (for TTY2,
F3 for TTY3, etc).
'';
type = types.bool;
default = true;
example = false;
};
exec = lib.mkOption {
description = "Run commands when starting sway.";
2024-05-04 20:57:33 +02:00
default = {};
type = types.submodule {
options = {
once = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = "Programs to start only once (`exec`).";
type = types.listOf types.str;
2024-05-04 20:57:33 +02:00
default = [];
example = ["signal-desktop --start-in-tray"];
};
always = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = "Programs to start whenever the config is sourced (`exec_always`).";
type = types.listOf types.str;
2024-05-04 20:57:33 +02:00
default = [];
example = ["signal-desktop --start-in-tray"];
};
};
};
};
};
gui.options = {
2024-05-04 20:57:33 +02:00
enable = lib.mkEnableOption "GUI applications";
tempInfo = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = "Temperature info to display in the statusbar.";
default = null;
type = types.nullOr (types.submodule tempInfo);
};
sway = lib.mkOption {
description = "Sway window manager configuration.";
2024-05-04 20:57:33 +02:00
default = {};
type = types.submodule sway;
};
terminal = lib.mkOption {
description = "The terminal emulator to use.";
default = "wezterm";
example = "alacritty";
type = types.enum [
"wezterm"
"alacritty"
];
};
};
2024-05-04 20:57:33 +02:00
in {
options.jhome = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = "Jalil's default home-manager configuration.";
2024-05-04 20:57:33 +02:00
default = {};
type = types.submodule {
options = {
enable = lib.mkEnableOption "jalil's home defaults";
hostName = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = "The hostname of this system.";
type = types.str;
default = "nixos";
example = "my pc";
};
dev = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = "Setup development environment for programming languages.";
2024-05-04 20:57:33 +02:00
default = {};
type = types.submodule {
2024-05-17 18:50:01 +02:00
options = {
enable = lib.mkEnableOption "development settings";
neovimAsManPager = lib.mkEnableOption "neovim as the man pager";
extraPackages = mkExtraPackagesOption "dev" [
["jq"] # json parser
["just"] # just a command runner
["typos"] # low false positive rate typo checker
["git-absorb"] # fixup! but automatic
["man-pages"] # gimme the man pages
["man-pages-posix"] # I said gimme the man pages!!!
];
rust = lib.mkOption {
description = "Jalil's default rust configuration.";
default = {};
type = types.submodule {
options.enable = lib.mkEnableOption "rust development settings";
options.extraPackages = mkExtraPackagesOption "Rust" [
["cargo-kcov"] # code coverage
["cargo-msrv"] # minimum supported version
["cargo-nextest"] # better testing harness
["cargo-sort"] # sort deps and imports
["cargo-watch"] # watch for file changes and run commands
];
};
};
};
};
};
user = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = "User settings.";
default = null;
type = types.nullOr (types.submodule user);
};
gui = lib.mkOption {
2024-04-19 19:23:49 +02:00
description = "Jalil's default GUI configuration.";
2024-05-04 20:57:33 +02:00
default = {};
type = types.submodule gui;
};
};
};
};
}