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

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