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 = { options = {
alyraffauf.desktop.defaultApps.enable = alyraffauf.desktop.defaultApps = {
lib.mkEnableOption "GTK and Qt themes."; enable =
alyraffauf.desktop.defaultApps.webBrowser = { lib.mkEnableOption "GTK and Qt themes.";
exe = lib.mkOption { webBrowser = {
description = "Default web browser executable name."; exe = lib.mkOption {
default = lib.getExe config.alyraffauf.desktop.defaultApps.webBrowser.package; description = "Default web browser executable name.";
type = lib.types.str; 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 { editor = {
description = "Default web browser desktop file name."; exe = lib.mkOption {
default = "firefox.desktop"; description = "Default editor executable name.";
type = lib.types.str; 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 { terminalEditor = {
description = "Default web browser package."; exe = lib.mkOption {
default = config.programs.firefox.package; description = "Default terminal editor executable name.";
type = lib.types.package; 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;
};
}; };
}; terminal = {
alyraffauf.desktop.defaultApps.editor = { exe = lib.mkOption {
exe = lib.mkOption { description = "Default terminal executable name.";
description = "Default editor executable name."; default = lib.getExe config.alyraffauf.desktop.defaultApps.terminal.package;
default = lib.getExe config.alyraffauf.desktop.defaultApps.editor.package; type = lib.types.str;
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 { pdfEditor = {
description = "Default editor desktop file name."; exe = lib.mkOption {
default = "codium.desktop"; description = "Default PDF editor executable name.";
type = lib.types.str; 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 { imageViewer = {
description = "Default editor package."; exe = lib.mkOption {
default = config.programs.vscode.package; description = "Default image viewer executable name.";
type = lib.types.package; 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;
};
}; };
}; videoPlayer = {
alyraffauf.desktop.defaultApps.terminalEditor = { exe = lib.mkOption {
exe = lib.mkOption { description = "Default video player executable name.";
description = "Default terminal editor executable name."; default = lib.getExe config.alyraffauf.desktop.defaultApps.videoPlayer.package;
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminalEditor.package; type = lib.types.str;
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 { audioPlayer = {
description = "Default terminal editor desktop file name."; exe = lib.mkOption {
default = "nvim.desktop"; description = "Default audio player executable name.";
type = lib.types.str; default = lib.getExe config.alyraffauf.desktop.defaultApps.audioPlayer.package;
}; type = lib.types.str;
package = lib.mkOption { };
description = "Default terminal editor package."; desktop = lib.mkOption {
default = config.programs.neovim.package; description = "Default audio player desktop file name.";
type = lib.types.package; default = config.alyraffauf.desktop.defaultApps.videoPlayer.desktop;
}; type = lib.types.str;
}; };
alyraffauf.desktop.defaultApps.terminal = { package = lib.mkOption {
exe = lib.mkOption { description = "Default audio player package.";
description = "Default terminal executable name."; default = config.alyraffauf.desktop.defaultApps.videoPlayer.package;
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminal.package; type = lib.types.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;
}; };
}; };
}; };
config = lib.mkIf config.alyraffauf.desktop.defaultApps.enable { config = lib.mkIf config.alyraffauf.desktop.defaultApps.enable {
home.packages = with pkgs; [ home.packages = with config.alyraffauf.desktop.defaultApps; [
config.alyraffauf.desktop.defaultApps.audioPlayer.package audioPlayer.package
config.alyraffauf.desktop.defaultApps.editor.package editor.package
config.alyraffauf.desktop.defaultApps.imageViewer.package imageViewer.package
config.alyraffauf.desktop.defaultApps.pdfEditor.package pdfEditor.package
config.alyraffauf.desktop.defaultApps.terminalEditor.package terminalEditor.package
config.alyraffauf.desktop.defaultApps.videoPlayer.package videoPlayer.package
config.alyraffauf.desktop.defaultApps.webBrowser.package webBrowser.package
]; ];
xdg.mimeApps = { xdg.mimeApps = {
enable = true; enable = true;
@ -181,8 +183,8 @@
}; };
}; };
home.sessionVariables = { home.sessionVariables = {
EDITOR = "${config.alyraffauf.desktop.defaultApps.terminalEditor.exe}";
BROWSER = "${config.alyraffauf.desktop.defaultApps.webBrowser.exe}"; BROWSER = "${config.alyraffauf.desktop.defaultApps.webBrowser.exe}";
EDITOR = "${config.alyraffauf.desktop.defaultApps.terminalEditor.exe}";
TERMINAL = "${config.alyraffauf.desktop.defaultApps.terminal.exe}"; TERMINAL = "${config.alyraffauf.desktop.defaultApps.terminal.exe}";
}; };
}; };

View file

@ -5,137 +5,139 @@
... ...
}: { }: {
options = { options = {
alyraffauf.desktop.theme.enable = alyraffauf.desktop.theme = {
lib.mkEnableOption "GTK and Qt themes."; enable =
alyraffauf.desktop.theme.gtk = { lib.mkEnableOption "GTK and Qt themes.";
name = lib.mkOption { gtk = {
description = "GTK theme name."; name = lib.mkOption {
default = "Catppuccin-Frappe-Compact-Mauve-Dark"; description = "GTK theme name.";
type = lib.types.str; 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"];
}; };
type = lib.types.package; package = lib.mkOption {
}; description = "GTK theme package.";
hideTitleBar = lib.mkOption { default = pkgs.catppuccin-gtk.override {
description = "Whether to hide GTK3/4 titlebars (useful for some window managers)."; accents = ["mauve"];
default = false; size = "compact";
type = lib.types.bool; variant = "frappe";
}; tweaks = ["normal"];
}; };
alyraffauf.desktop.theme.iconTheme = { type = lib.types.package;
name = lib.mkOption { };
description = "Icon theme name."; hideTitleBar = lib.mkOption {
default = "Papirus-Dark"; description = "Whether to hide GTK3/4 titlebars (useful for some window managers).";
type = lib.types.str; default = false;
}; type = lib.types.bool;
package = lib.mkOption {
description = "Icon theme package.";
default = pkgs.catppuccin-papirus-folders.override {
flavor = "frappe";
accent = "mauve";
}; };
type = lib.types.package;
}; };
}; iconTheme = {
alyraffauf.desktop.theme.cursorTheme = { name = lib.mkOption {
name = lib.mkOption { description = "Icon theme name.";
description = "Cursor theme name."; default = "Papirus-Dark";
default = "Catppuccin-Frappe-Dark-Cursors"; 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; 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 }: let
pp-adjuster = pkgs.writeShellScriptBin "pp-adjuster" '' pp-adjuster = pkgs.writeShellScriptBin "pp-adjuster" ''
# Only works on petalburg.
current_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]') current_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]')
if [ "$current_profile" == "power-saver" ]; then if [ "$current_profile" == "power-saver" ]; then