refactored home modules

This commit is contained in:
Aly Raffauf 2024-05-27 16:56:00 -04:00
parent db6bb47427
commit 60aa6f1dd6
3 changed files with 268 additions and 265 deletions

View file

@ -5,155 +5,157 @@
...
}: {
options = {
alyraffauf.desktop.defaultApps.enable =
lib.mkEnableOption "GTK and Qt themes.";
alyraffauf.desktop.defaultApps.webBrowser = {
exe = lib.mkOption {
description = "Default web browser executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.webBrowser.package;
type = lib.types.str;
alyraffauf.desktop.defaultApps = {
enable =
lib.mkEnableOption "GTK and Qt themes.";
webBrowser = {
exe = lib.mkOption {
description = "Default web browser executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.webBrowser.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default web browser desktop file name.";
default = "firefox.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default web browser package.";
default = config.programs.firefox.package;
type = lib.types.package;
};
};
desktop = lib.mkOption {
description = "Default web browser desktop file name.";
default = "firefox.desktop";
type = lib.types.str;
editor = {
exe = lib.mkOption {
description = "Default editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.editor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default editor desktop file name.";
default = "codium.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default editor package.";
default = config.programs.vscode.package;
type = lib.types.package;
};
};
package = lib.mkOption {
description = "Default web browser package.";
default = config.programs.firefox.package;
type = lib.types.package;
terminalEditor = {
exe = lib.mkOption {
description = "Default terminal editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminalEditor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default terminal editor desktop file name.";
default = "nvim.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default terminal editor package.";
default = config.programs.neovim.package;
type = lib.types.package;
};
};
};
alyraffauf.desktop.defaultApps.editor = {
exe = lib.mkOption {
description = "Default editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.editor.package;
type = lib.types.str;
terminal = {
exe = lib.mkOption {
description = "Default terminal executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminal.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default terminal desktop file name.";
default = "alacritty.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default terminal package.";
default = config.programs.alacritty.package;
type = lib.types.package;
};
};
desktop = lib.mkOption {
description = "Default editor desktop file name.";
default = "codium.desktop";
type = lib.types.str;
pdfEditor = {
exe = lib.mkOption {
description = "Default PDF editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.pdfEditor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default PDF Editor desktop file name.";
default = "org.gnome.Evince.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default PDF Editor package.";
default = pkgs.evince;
type = lib.types.package;
};
};
package = lib.mkOption {
description = "Default editor package.";
default = config.programs.vscode.package;
type = lib.types.package;
imageViewer = {
exe = lib.mkOption {
description = "Default image viewer executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.imageViewer.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default image viewer desktop file name.";
default = "org.gnome.eog.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default image viewer package.";
default = pkgs.gnome.eog;
type = lib.types.package;
};
};
};
alyraffauf.desktop.defaultApps.terminalEditor = {
exe = lib.mkOption {
description = "Default terminal editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminalEditor.package;
type = lib.types.str;
videoPlayer = {
exe = lib.mkOption {
description = "Default video player executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.videoPlayer.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default video player desktop file name.";
default = "io.github.celluloid_player.Celluloid.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default video player package.";
default = pkgs.celluloid;
type = lib.types.package;
};
};
desktop = lib.mkOption {
description = "Default terminal editor desktop file name.";
default = "nvim.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default terminal editor package.";
default = config.programs.neovim.package;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.terminal = {
exe = lib.mkOption {
description = "Default terminal executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminal.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default terminal desktop file name.";
default = "alacritty.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default terminal package.";
default = config.programs.alacritty.package;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.pdfEditor = {
exe = lib.mkOption {
description = "Default PDF editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.pdfEditor.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default PDF Editor desktop file name.";
default = "org.gnome.Evince.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default PDF Editor package.";
default = pkgs.evince;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.imageViewer = {
exe = lib.mkOption {
description = "Default image viewer executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.imageViewer.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default image viewer desktop file name.";
default = "org.gnome.eog.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default image viewer package.";
default = pkgs.gnome.eog;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.videoPlayer = {
exe = lib.mkOption {
description = "Default video player executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.videoPlayer.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default video player desktop file name.";
default = "io.github.celluloid_player.Celluloid.desktop";
type = lib.types.str;
};
package = lib.mkOption {
description = "Default video player package.";
default = pkgs.celluloid;
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.audioPlayer = {
exe = lib.mkOption {
description = "Default audio player executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.audioPlayer.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default audio player desktop file name.";
default = config.alyraffauf.desktop.defaultApps.videoPlayer.desktop;
type = lib.types.str;
};
package = lib.mkOption {
description = "Default audio player package.";
default = config.alyraffauf.desktop.defaultApps.videoPlayer.package;
type = lib.types.package;
audioPlayer = {
exe = lib.mkOption {
description = "Default audio player executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.audioPlayer.package;
type = lib.types.str;
};
desktop = lib.mkOption {
description = "Default audio player desktop file name.";
default = config.alyraffauf.desktop.defaultApps.videoPlayer.desktop;
type = lib.types.str;
};
package = lib.mkOption {
description = "Default audio player package.";
default = config.alyraffauf.desktop.defaultApps.videoPlayer.package;
type = lib.types.package;
};
};
};
};
config = lib.mkIf config.alyraffauf.desktop.defaultApps.enable {
home.packages = with pkgs; [
config.alyraffauf.desktop.defaultApps.audioPlayer.package
config.alyraffauf.desktop.defaultApps.editor.package
config.alyraffauf.desktop.defaultApps.imageViewer.package
config.alyraffauf.desktop.defaultApps.pdfEditor.package
config.alyraffauf.desktop.defaultApps.terminalEditor.package
config.alyraffauf.desktop.defaultApps.videoPlayer.package
config.alyraffauf.desktop.defaultApps.webBrowser.package
home.packages = with config.alyraffauf.desktop.defaultApps; [
audioPlayer.package
editor.package
imageViewer.package
pdfEditor.package
terminalEditor.package
videoPlayer.package
webBrowser.package
];
xdg.mimeApps = {
enable = true;
@ -181,8 +183,8 @@
};
};
home.sessionVariables = {
EDITOR = "${config.alyraffauf.desktop.defaultApps.terminalEditor.exe}";
BROWSER = "${config.alyraffauf.desktop.defaultApps.webBrowser.exe}";
EDITOR = "${config.alyraffauf.desktop.defaultApps.terminalEditor.exe}";
TERMINAL = "${config.alyraffauf.desktop.defaultApps.terminal.exe}";
};
};

View file

@ -5,137 +5,139 @@
...
}: {
options = {
alyraffauf.desktop.theme.enable =
lib.mkEnableOption "GTK and Qt themes.";
alyraffauf.desktop.theme.gtk = {
name = lib.mkOption {
description = "GTK theme name.";
default = "Catppuccin-Frappe-Compact-Mauve-Dark";
type = lib.types.str;
};
package = lib.mkOption {
description = "GTK theme package.";
default = pkgs.catppuccin-gtk.override {
accents = ["mauve"];
size = "compact";
variant = "frappe";
tweaks = ["normal"];
alyraffauf.desktop.theme = {
enable =
lib.mkEnableOption "GTK and Qt themes.";
gtk = {
name = lib.mkOption {
description = "GTK theme name.";
default = "Catppuccin-Frappe-Compact-Mauve-Dark";
type = lib.types.str;
};
type = lib.types.package;
};
hideTitleBar = lib.mkOption {
description = "Whether to hide GTK3/4 titlebars (useful for some window managers).";
default = false;
type = lib.types.bool;
};
};
alyraffauf.desktop.theme.iconTheme = {
name = lib.mkOption {
description = "Icon theme name.";
default = "Papirus-Dark";
type = lib.types.str;
};
package = lib.mkOption {
description = "Icon theme package.";
default = pkgs.catppuccin-papirus-folders.override {
flavor = "frappe";
accent = "mauve";
package = lib.mkOption {
description = "GTK theme package.";
default = pkgs.catppuccin-gtk.override {
accents = ["mauve"];
size = "compact";
variant = "frappe";
tweaks = ["normal"];
};
type = lib.types.package;
};
hideTitleBar = lib.mkOption {
description = "Whether to hide GTK3/4 titlebars (useful for some window managers).";
default = false;
type = lib.types.bool;
};
type = lib.types.package;
};
};
alyraffauf.desktop.theme.cursorTheme = {
name = lib.mkOption {
description = "Cursor theme name.";
default = "Catppuccin-Frappe-Dark-Cursors";
iconTheme = {
name = lib.mkOption {
description = "Icon theme name.";
default = "Papirus-Dark";
type = lib.types.str;
};
package = lib.mkOption {
description = "Icon theme package.";
default = pkgs.catppuccin-papirus-folders.override {
flavor = "frappe";
accent = "mauve";
};
type = lib.types.package;
};
};
cursorTheme = {
name = lib.mkOption {
description = "Cursor theme name.";
default = "Catppuccin-Frappe-Dark-Cursors";
type = lib.types.str;
};
size = lib.mkOption {
description = "Cursor size.";
default = 24;
type = lib.types.int;
};
package = lib.mkOption {
description = "Cursor theme package.";
default = pkgs.catppuccin-cursors.frappeDark;
type = lib.types.package;
};
};
font = {
name = lib.mkOption {
description = "Font name.";
default = "NotoSans Nerd Font";
type = lib.types.str;
};
size = lib.mkOption {
description = "Font size.";
default = 11;
type = lib.types.int;
};
package = lib.mkOption {
description = "Font package.";
default = pkgs.nerdfonts.override {fonts = ["Noto"];};
type = lib.types.package;
};
};
terminalFont = {
name = lib.mkOption {
description = "Font name.";
default = "NotoSansM Nerd Font";
type = lib.types.str;
};
size = lib.mkOption {
description = "Font size.";
default = 11;
type = lib.types.int;
};
package = lib.mkOption {
description = "Font package.";
default = pkgs.nerdfonts.override {fonts = ["Noto"];};
type = lib.types.package;
};
};
colors = {
preferDark = lib.mkOption {
description = "Whether to prefer dark mode apps or not.";
default = config.alyraffauf.desktop.theme.enable;
type = lib.types.bool;
};
text = lib.mkOption {
description = "Text color.";
default = "#FAFAFA";
type = lib.types.str;
};
background = lib.mkOption {
description = "Background color.";
default = "#232634";
type = lib.types.str;
};
primary = lib.mkOption {
description = "Primary color.";
default = "#CA9EE6";
type = lib.types.str;
};
secondary = lib.mkOption {
description = "Secondary color.";
default = "#99D1DB";
type = lib.types.str;
};
inactive = lib.mkOption {
description = "Inactive color.";
default = "#626880";
type = lib.types.str;
};
shadow = lib.mkOption {
description = "Drop shadow color.";
default = "#1A1A1A";
type = lib.types.str;
};
};
wallpaper = lib.mkOption {
description = "Default wallpaper.";
default = "${config.xdg.dataHome}/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";
type = lib.types.str;
};
size = lib.mkOption {
description = "Cursor size.";
default = 24;
type = lib.types.int;
};
package = lib.mkOption {
description = "Cursor theme package.";
default = pkgs.catppuccin-cursors.frappeDark;
type = lib.types.package;
};
};
alyraffauf.desktop.theme.font = {
name = lib.mkOption {
description = "Font name.";
default = "NotoSans Nerd Font";
type = lib.types.str;
};
size = lib.mkOption {
description = "Font size.";
default = 11;
type = lib.types.int;
};
package = lib.mkOption {
description = "Font package.";
default = pkgs.nerdfonts.override {fonts = ["Noto"];};
type = lib.types.package;
};
};
alyraffauf.desktop.theme.terminalFont = {
name = lib.mkOption {
description = "Font name.";
default = "NotoSansM Nerd Font";
type = lib.types.str;
};
size = lib.mkOption {
description = "Font size.";
default = 11;
type = lib.types.int;
};
package = lib.mkOption {
description = "Font package.";
default = pkgs.nerdfonts.override {fonts = ["Noto"];};
type = lib.types.package;
};
};
alyraffauf.desktop.theme.colors = {
preferDark = lib.mkOption {
description = "Whether to prefer dark mode apps or not.";
default = true;
type = lib.types.bool;
};
text = lib.mkOption {
description = "Text color.";
default = "#FAFAFA";
type = lib.types.str;
};
background = lib.mkOption {
description = "Background color.";
default = "#232634";
type = lib.types.str;
};
primary = lib.mkOption {
description = "Primary color.";
default = "#CA9EE6";
type = lib.types.str;
};
secondary = lib.mkOption {
description = "Secondary color.";
default = "#99D1DB";
type = lib.types.str;
};
inactive = lib.mkOption {
description = "Inactive color.";
default = "#626880";
type = lib.types.str;
};
shadow = lib.mkOption {
description = "Drop shadow color.";
default = "#1A1A1A";
type = lib.types.str;
};
};
alyraffauf.desktop.theme.wallpaper = lib.mkOption {
description = "Default wallpaper.";
default = "${config.xdg.dataHome}/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";
type = lib.types.str;
};
};

View file

@ -5,7 +5,6 @@
...
}: let
pp-adjuster = pkgs.writeShellScriptBin "pp-adjuster" ''
# Only works on petalburg.
current_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]')
if [ "$current_profile" == "power-saver" ]; then