diff options
Diffstat (limited to 'modules/web')
| -rw-r--r-- | modules/web/aria2/default.nix | 8 | ||||
| -rw-r--r-- | modules/web/chawan/default.nix | 14 | ||||
| -rw-r--r-- | modules/web/chromium/assertions.nix | 4 | ||||
| -rw-r--r-- | modules/web/chromium/default.nix | 44 |
4 files changed, 38 insertions, 32 deletions
diff --git a/modules/web/aria2/default.nix b/modules/web/aria2/default.nix index 800f178..60e92c6 100644 --- a/modules/web/aria2/default.nix +++ b/modules/web/aria2/default.nix @@ -1,9 +1,13 @@ # Command line download manager { - lib, config, + lib, + pkgs, ... }: +let + cfg = config.web.aria2; +in { options.web.aria2 = { enable = lib.mkEnableOption "Enables aria2."; @@ -15,7 +19,7 @@ }; }; - config = lib.mkIf config.web.aria2.enable { + config = lib.mkIf cfg.enable { programs.aria2 = { enable = true; settings = { diff --git a/modules/web/chawan/default.nix b/modules/web/chawan/default.nix index f3f0a30..0f1256d 100644 --- a/modules/web/chawan/default.nix +++ b/modules/web/chawan/default.nix @@ -2,8 +2,12 @@ { config, lib, + pkgs, ... }: +let + cfg = config.web.chawan; +in { imports = [ ./assertions.nix @@ -17,7 +21,7 @@ default = config.programs.chawan.package; description = "Package to use for chawan."; }; - homeUrl = lib.mkOption { + home-url = lib.mkOption { type = lib.types.str; default = "https://searx.space"; description = "The first page to open when chawan is launched."; @@ -25,7 +29,7 @@ }; config = lib.mkMerge [ - (lib.mkIf config.web.chawan.enable { + (lib.mkIf cfg.enable { home.file.".local/share/icons/hicolor/scalable/apps/internet-web-browser.svg" = { source = ../../../assets/icons/apps/internet-web-browser.svg; }; @@ -50,13 +54,13 @@ }; }; home.packages = [ - config.web.chawan.package + cfg.package ]; }) - (lib.mkIf (config.web.chawan.enable && config.terminal.kitty.enable) { + (lib.mkIf (cfg.enable && config.terminal.kitty.enable) { xdg.desktopEntries."chawan" = { name = "Chawan"; - exec = "${lib.getExe config.terminal.kitty.package} --class chawan -e ${lib.getExe config.web.chawan.package} ${config.web.chawan.homeUrl}"; + exec = "${lib.getExe config.terminal.kitty.package} --class chawan -e ${lib.getExe cfg.package} ${cfg.home-url}"; icon = "internet-web-browser"; categories = [ "Network" ]; comment = "Text-based web browser"; diff --git a/modules/web/chromium/assertions.nix b/modules/web/chromium/assertions.nix index 465ebbd..79a9ba1 100644 --- a/modules/web/chromium/assertions.nix +++ b/modules/web/chromium/assertions.nix @@ -3,8 +3,8 @@ { assertions = [ { - assertion = !config.web.chromium.useOpenGL || config.web.chromium.enable; - message = "web.chromium.useOpenGL requires web.chromium.enable."; + assertion = !config.web.chromium.use-opengl || config.web.chromium.enable; + message = "web.chromium.use-opengl requires web.chromium.enable."; } ]; } diff --git a/modules/web/chromium/default.nix b/modules/web/chromium/default.nix index 1e3608c..ae9e97e 100644 --- a/modules/web/chromium/default.nix +++ b/modules/web/chromium/default.nix @@ -4,6 +4,10 @@ pkgs, ... }: +let + cfg = config.web.chromium; + extensionDirs = lib.concatStringsSep "," (lib.mapAttrsToList (_: ext: ext.drv) cfg.extensions); +in { imports = [ ./assertions.nix @@ -20,32 +24,26 @@ defaultText = lib.literalExpression "config.programs.chromium.finalPackage"; description = "Package to use for chromium. Defaults to the wrapped finalPackage from programs.chromium."; }; - useOpenGL = lib.mkEnableOption '' + use-opengl = lib.mkEnableOption '' Use OpenGL APIs for graphics acceleration ''; }; - config = lib.mkIf config.web.chromium.enable { + config = lib.mkIf cfg.enable { programs.chromium = { enable = true; package = pkgs.ungoogled-chromium; - commandLineArgs = - let - extensionDirs = lib.concatStringsSep "," ( - lib.mapAttrsToList (_: ext: ext.drv) config.web.chromium.extensions - ); - in - [ - "--force-dark-mode" - "--force-device-scale-factor=1.15" - # Don't use the gnome password store - "--password-store=basic" - "--load-extension=${extensionDirs}" - ] - ++ lib.optionals config.web.chromium.useOpenGL [ - "--use-angle=opengl" - "--use-cmd-decoder=passthrough" - ]; + commandLineArgs = [ + "--force-dark-mode" + "--force-device-scale-factor=1.15" + # Don't use the gnome password store + "--password-store=basic" + "--load-extension=${extensionDirs}" + ] + ++ lib.optionals cfg.use-opengl [ + "--use-angle=opengl" + "--use-cmd-decoder=passthrough" + ]; }; xdg.mimeApps.defaultApplications = { @@ -94,10 +92,10 @@ credentials_enable_autosignin = false; extensions = { pinned_extensions = [ - config.web.chromium.extensions.browserpass.id - config.web.chromium.extensions.darkreader.id - config.web.chromium.extensions.ublockOrigin.id - config.web.chromium.extensions.vimium.id + cfg.extensions.browserpass.id + cfg.extensions.darkreader.id + cfg.extensions.ublockOrigin.id + cfg.extensions.vimium.id ]; theme = { id = ""; |
