From ed8bad82e233055dd51c8265178f62b9bae398d1 Mon Sep 17 00:00:00 2001 From: ooks-io Date: Mon, 1 Apr 2024 18:04:00 +1300 Subject: [PATCH] feat(config): add userDirs & mimeApp modules --- home/modules/config/default.nix | 2 ++ home/modules/config/mimeApps/default.nix | 40 ++++++++++++++++++++++++ home/modules/config/userDirs/default.nix | 17 ++++++++-- system/modules/hardware/backlight.nix | 16 ---------- system/profiles/gaming/default.nix | 2 ++ 5 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 home/modules/config/mimeApps/default.nix diff --git a/home/modules/config/default.nix b/home/modules/config/default.nix index bbada63..5bd2f70 100644 --- a/home/modules/config/default.nix +++ b/home/modules/config/default.nix @@ -9,6 +9,7 @@ ./userDirs ./home ./nixColors + ./mimeApps ]; options.homeModules.config = { @@ -16,5 +17,6 @@ nixColors.enable = lib.mkEnableOption "enable nixColors configuration module"; home.enable = lib.mkEnableOption "enable home configuration module"; userDirs.enable = lib.mkEnableOption "enable userDirs configuration module"; + mimeApps.enable = lib.mkEnableOption "enable mimeApps configuration module"; }; } diff --git a/home/modules/config/mimeApps/default.nix b/home/modules/config/mimeApps/default.nix new file mode 100644 index 0000000..5c9eb5d --- /dev/null +++ b/home/modules/config/mimeApps/default.nix @@ -0,0 +1,40 @@ +{ lib, config, pkgs, ... }: + +let + cfg = config.homeModules.config.mimeApps; + + browser = ["${config.home.sessionVariables.BROWSER}.desktop"]; + zathura = ["org.pwmt.zethura.desktop.desktop"]; + + associations = { + "text/html" = browser; + "x-scheme-handler/http" = browser; + "x-scheme-handler/https" = browser; + "x-scheme-handler/ftp" = browser; + "x-scheme-handler/about" = browser; + "x-scheme-handler/unknown" = browser; + "application/x-extension-htm" = browser; + "application/x-extension-html" = browser; + "application/x-extension-shtml" = browser; + "application/xhtml+xml" = browser; + "application/x-extension-xhtml" = browser; + "application/x-extension-xht" = browser; + + "audio/*" = ["mpv.desktop"]; + "video/*" = ["mpv.dekstop"]; + "image/*" = ["imv.desktop"]; + "application/json" = browser; + "application/pdf" = zathura; + "x-scheme-handler/discord" = ["vesktop.desktop"]; + }; +in +{ + config = lib.mkIf cfg.enable { + home.packages = [ pkgs.xdg-utils ]; + xdg.mimeApps = { + enable = true; + associations.added = associations; + defaultApplications = associations; + }; + }; +} diff --git a/home/modules/config/userDirs/default.nix b/home/modules/config/userDirs/default.nix index 15b9b84..d5d9a63 100644 --- a/home/modules/config/userDirs/default.nix +++ b/home/modules/config/userDirs/default.nix @@ -6,9 +6,22 @@ in { config = lib.mkIf cfg.enable { - xdg.userDirs = { + xdg = { enable = true; - createDirectories = true; + configHome = "${config.home.homeDirectory}/.config"; + cacheHome = "${config.home.homeDirectory}/.cache"; + dataHome = "${config.home.homeDirectory}/.local/share"; + stateHome = "${config.home.homeDirectory}/.local/state"; + + userDirs = { + enable = true; + createDirectories = true; + desktop = "${config.home.homeDirectory}/Desktop"; + documents = "${config.home.homeDirectory}/Documents"; + music = "${config.home.homeDirectory}/Media/Music"; + videos = "${config.home.homeDirectory}/Media/Videos"; + pictures = "${config.home.homeDirectory}/Media/Pictures"; + }; }; }; } diff --git a/system/modules/hardware/backlight.nix b/system/modules/hardware/backlight.nix index 71a5210..b797786 100644 --- a/system/modules/hardware/backlight.nix +++ b/system/modules/hardware/backlight.nix @@ -7,21 +7,5 @@ in { config = lib.mkIf cfg.enable { hardware.brillo.enable = true; - services.clight = { - enable = true; - temperature = { - night = 3000; - day = 6000; - }; - settings = { - verbose = true; - backlight.disabled = true; - dpms.timeouts = [900 300]; - dimmer.timeouts = [870 270]; - screen.disabled = true; - sunrise = "9:00"; - sunset = "20:00"; - }; - }; }; } diff --git a/system/profiles/gaming/default.nix b/system/profiles/gaming/default.nix index f692fed..75599a0 100644 --- a/system/profiles/gaming/default.nix +++ b/system/profiles/gaming/default.nix @@ -17,6 +17,8 @@ let mangohud winetricks protontricks + gtk3 + gtk3-x11 ]; }; in