dotfiles/options.nix

159 lines
5.8 KiB
Nix
Raw Permalink Normal View History

{ pkgs, lib, config, ... }:
let
capitalizeFirstLetter = str: (lib.strings.toUpper (builtins.substring 0 1 str)) + (builtins.substring 1 (builtins.stringLength str) str);
in
2023-11-21 21:01:56 +01:00
{
options.frogeye = {
name = lib.mkOption {
description = "Name of the system";
type = lib.types.str;
};
toplevel = lib.mkOption {
description = "top-level flake";
type = lib.types.attrs;
};
2023-11-21 21:01:56 +01:00
extra = lib.mkEnableOption "Big software";
2023-12-02 21:50:59 +01:00
gaming = lib.mkEnableOption "Games";
polarity = lib.mkOption {
2024-01-07 12:54:43 +01:00
default = "light";
description = "Whether to use light theme or dark theme.";
2024-01-07 12:54:43 +01:00
type = lib.types.enum [ "light" "dark" ];
};
2023-11-22 14:05:48 +01:00
desktop = {
xorg = lib.mkEnableOption "Enable X11 support";
2024-01-07 23:29:16 +01:00
# TODO Use appropriate OS/HM option(s) instead
2023-12-04 22:47:02 +01:00
numlock = lib.mkEnableOption "Auto-enable numlock";
x11_screens = lib.mkOption {
2023-12-16 22:39:11 +01:00
default = [ "UNSET1" ];
2023-12-04 22:47:02 +01:00
description = "A list of xrandr screen names from left to right.";
type = lib.types.listOf lib.types.str;
};
maxVideoHeight = lib.mkOption {
type = lib.types.int;
description = "Maximum video height in pixel the machine can reasonably watch";
default = 1080;
};
phasesCommands = {
jour = lib.mkOption { type = lib.types.lines; default = ""; description = "Command to execute for phase: jour"; };
crepuscule = lib.mkOption { type = lib.types.lines; default = ""; description = "Command to execute for phase: crepuscule"; };
nuit = lib.mkOption { type = lib.types.lines; default = ""; description = "Command to execute for phase: nuit"; };
2023-12-05 23:11:54 +01:00
};
2023-11-22 14:05:48 +01:00
};
2023-11-22 16:32:20 +01:00
dev = {
ansible = lib.mkEnableOption "Ansible dev stuff";
c = lib.mkEnableOption "C/C++ dev stuff";
docker = lib.mkEnableOption "Docker dev stuff";
fpga = lib.mkEnableOption "FPGA dev stuff";
2024-01-11 23:54:03 +01:00
go = lib.mkEnableOption "Go dev stuff";
node = lib.mkEnableOption "NodeJS dev stuff";
2023-12-08 18:39:02 +01:00
perl = lib.mkEnableOption "Perl dev stuff";
php = lib.mkEnableOption "PHP dev stuff";
prose = lib.mkEnableOption "Writing stuff";
2023-11-22 16:32:20 +01:00
python = lib.mkEnableOption "Python dev stuff";
2024-10-01 15:17:11 +02:00
vm = lib.mkEnableOption "Virtual machines";
2023-11-22 16:32:20 +01:00
};
storageSize = lib.mkOption {
default = "small";
type = lib.types.enum [ "small" "big" "phone" ];
description = "Type of storage for the device. Used to determine which folder to include.";
};
folders = lib.mkOption {
default = { };
description = "Folders used by users";
# Top-level so Syncthing can work for all users. Also there's no real home-manager syncthing module.
type = lib.types.attrsOf (lib.types.submodule ({ config, name, ... }: {
options = {
name = lib.mkOption {
type = lib.types.str;
default = name;
readOnly = true;
internal = true;
description = "Name accessing this entry";
};
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to use this folder.";
};
path = lib.mkOption {
type = lib.types.str;
description = "Path relative to HOME. Prefer French names which has more varied initials, easing navigation.";
};
label = lib.mkOption {
type = lib.types.str;
description = "Friendly name";
default = capitalizeFirstLetter config.path;
};
user = lib.mkOption {
type = lib.types.str;
default = "geoffrey";
description = "User using this directory.";
};
fullPath = lib.mkOption {
type = lib.types.str;
default = "/home/${config.user}/${config.path}";
# Hardcoded due to outside of any user context
description = "Absolute path.";
};
xdgUserDirVariable = lib.mkOption {
type = lib.types.nullOr lib.types.str;
2024-06-24 15:53:09 +02:00
default = if config.enable then "XDG_${lib.strings.toUpper name}_DIR" else null;
description = "Name for the XDG user dir variable. If set, will automatically create the directory.";
};
syncthing = lib.mkOption {
default = { };
description = "Syncthing configuration for the folder";
type = lib.types.submodule ({ ... }: {
freeformType = (pkgs.formats.json { }).type;
options = {
enable = lib.mkOption {
type = lib.types.bool;
default = config.enable && config.syncthing.id != null;
description = "Whether to sync.";
};
id = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "Syncthing folder id";
};
};
});
};
versionsMaxDays = lib.mkOption {
type = lib.types.nullOr lib.types.int;
default = 365;
description = "For big systems, how many days of staggered versions should be kept";
};
};
}));
};
2024-03-09 18:22:30 +01:00
hooks.lock = lib.mkOption {
type = lib.types.lines;
default = "";
description = "Bash commands to execute on locking the session.";
};
syncthing = {
id = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "Full syncthing id";
};
name = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = "Geoffrey ${capitalizeFirstLetter config.frogeye.name}";
description = "Syncthing name";
};
};
2023-11-22 16:32:20 +01:00
};
config = {
frogeye = {
dev = {
prose = lib.mkDefault true;
2023-11-22 16:32:20 +01:00
python = lib.mkDefault true;
};
folders.download.path = "Téléchargements";
2023-11-22 16:32:20 +01:00
};
2023-11-21 21:01:56 +01:00
};
}