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,9 +5,10 @@
...
}: {
options = {
alyraffauf.desktop.defaultApps.enable =
alyraffauf.desktop.defaultApps = {
enable =
lib.mkEnableOption "GTK and Qt themes.";
alyraffauf.desktop.defaultApps.webBrowser = {
webBrowser = {
exe = lib.mkOption {
description = "Default web browser executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.webBrowser.package;
@ -24,7 +25,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.editor = {
editor = {
exe = lib.mkOption {
description = "Default editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.editor.package;
@ -41,7 +42,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.terminalEditor = {
terminalEditor = {
exe = lib.mkOption {
description = "Default terminal editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminalEditor.package;
@ -58,7 +59,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.terminal = {
terminal = {
exe = lib.mkOption {
description = "Default terminal executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.terminal.package;
@ -75,7 +76,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.pdfEditor = {
pdfEditor = {
exe = lib.mkOption {
description = "Default PDF editor executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.pdfEditor.package;
@ -92,7 +93,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.imageViewer = {
imageViewer = {
exe = lib.mkOption {
description = "Default image viewer executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.imageViewer.package;
@ -109,7 +110,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.videoPlayer = {
videoPlayer = {
exe = lib.mkOption {
description = "Default video player executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.videoPlayer.package;
@ -126,7 +127,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.defaultApps.audioPlayer = {
audioPlayer = {
exe = lib.mkOption {
description = "Default audio player executable name.";
default = lib.getExe config.alyraffauf.desktop.defaultApps.audioPlayer.package;
@ -144,16 +145,17 @@
};
};
};
};
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,9 +5,10 @@
...
}: {
options = {
alyraffauf.desktop.theme.enable =
alyraffauf.desktop.theme = {
enable =
lib.mkEnableOption "GTK and Qt themes.";
alyraffauf.desktop.theme.gtk = {
gtk = {
name = lib.mkOption {
description = "GTK theme name.";
default = "Catppuccin-Frappe-Compact-Mauve-Dark";
@ -29,7 +30,7 @@
type = lib.types.bool;
};
};
alyraffauf.desktop.theme.iconTheme = {
iconTheme = {
name = lib.mkOption {
description = "Icon theme name.";
default = "Papirus-Dark";
@ -44,7 +45,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.theme.cursorTheme = {
cursorTheme = {
name = lib.mkOption {
description = "Cursor theme name.";
default = "Catppuccin-Frappe-Dark-Cursors";
@ -61,7 +62,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.theme.font = {
font = {
name = lib.mkOption {
description = "Font name.";
default = "NotoSans Nerd Font";
@ -78,7 +79,7 @@
type = lib.types.package;
};
};
alyraffauf.desktop.theme.terminalFont = {
terminalFont = {
name = lib.mkOption {
description = "Font name.";
default = "NotoSansM Nerd Font";
@ -95,10 +96,10 @@
type = lib.types.package;
};
};
alyraffauf.desktop.theme.colors = {
colors = {
preferDark = lib.mkOption {
description = "Whether to prefer dark mode apps or not.";
default = true;
default = config.alyraffauf.desktop.theme.enable;
type = lib.types.bool;
};
text = lib.mkOption {
@ -132,12 +133,13 @@
type = lib.types.str;
};
};
alyraffauf.desktop.theme.wallpaper = lib.mkOption {
wallpaper = lib.mkOption {
description = "Default wallpaper.";
default = "${config.xdg.dataHome}/backgrounds/jr-korpa-9XngoIpxcEo-unsplash.jpg";
type = lib.types.str;
};
};
};
config = lib.mkIf config.alyraffauf.desktop.theme.enable {
home.pointerCursor = {

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