diff options
| author | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-24 03:42:25 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar@gmail.com> | 2026-09-24 03:42:25 +0530 |
| commit | 30f8fea050f3242f0e6a2072779e706b5c8ceaf1 (patch) | |
| tree | a02b517bd112d4e91fab15166a4866bff252c2d3 /modules/networking | |
| parent | ad96214c9ab94bce925000a6059e3c68e2ff6a22 (diff) | |
| download | home-manager-config-30f8fea050f3242f0e6a2072779e706b5c8ceaf1.tar.gz home-manager-config-30f8fea050f3242f0e6a2072779e706b5c8ceaf1.zip | |
refactor(modules): introduce cfg local bindings and submodule option types
Diffstat (limited to 'modules/networking')
| -rw-r--r-- | modules/networking/bluetui/default.nix | 9 | ||||
| -rw-r--r-- | modules/networking/impala/default.nix | 9 | ||||
| -rw-r--r-- | modules/networking/usque/default.nix | 34 |
3 files changed, 33 insertions, 19 deletions
diff --git a/modules/networking/bluetui/default.nix b/modules/networking/bluetui/default.nix index 304ab4d..b715247 100644 --- a/modules/networking/bluetui/default.nix +++ b/modules/networking/bluetui/default.nix @@ -5,6 +5,9 @@ pkgs, ... }: +let + cfg = config.networking.bluetui; +in { imports = [ ./assertions.nix @@ -20,14 +23,14 @@ }; }; - config = lib.mkIf config.networking.bluetui.enable { + config = lib.mkIf cfg.enable { home.file.".local/share/icons/hicolor/scalable/apps/bluetooth.svg" = { source = ../../../assets/icons/apps/bluetooth.svg; }; xdg.desktopEntries."bluetui" = { name = "bluetui"; - exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe config.networking.bluetui.package}"; + exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe cfg.package}"; icon = "bluetooth"; categories = [ "Network" ]; comment = "Bluetooth TUI client"; @@ -35,7 +38,7 @@ type = "Application"; }; home.packages = [ - config.networking.bluetui.package + cfg.package ]; }; } diff --git a/modules/networking/impala/default.nix b/modules/networking/impala/default.nix index aa62e08..f00ed58 100644 --- a/modules/networking/impala/default.nix +++ b/modules/networking/impala/default.nix @@ -5,6 +5,9 @@ pkgs, ... }: +let + cfg = config.networking.impala; +in { imports = [ ./assertions.nix @@ -20,14 +23,14 @@ }; }; - config = lib.mkIf config.networking.impala.enable { + config = lib.mkIf cfg.enable { home.file.".local/share/icons/hicolor/scalable/apps/network-wireless.svg" = { source = ../../../assets/icons/apps/network-wireless.svg; }; xdg.desktopEntries."impala" = { name = "impala"; - exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe config.networking.impala.package}"; + exec = "${lib.getExe config.terminal.kitty.package} -e ${lib.getExe cfg.package}"; icon = "network-wireless"; categories = [ "Network" ]; comment = "TUI for managing wifi on Linux"; @@ -35,7 +38,7 @@ type = "Application"; }; home.packages = [ - config.networking.impala.package + cfg.package ]; xdg.mimeApps.defaultApplications = { diff --git a/modules/networking/usque/default.nix b/modules/networking/usque/default.nix index 93ab7e5..aa3304c 100644 --- a/modules/networking/usque/default.nix +++ b/modules/networking/usque/default.nix @@ -1,15 +1,17 @@ # Open-source reimplementation of the Cloudflare WARP client's MASQUE protocol { config, - pkgs, lib, + pkgs, ... }: let + cfg = config.networking.usque; + usqueWarpScript = pkgs.writeShellApplication { name = "usque-warp"; runtimeInputs = [ - config.networking.usque.package + cfg.package config.terminal.bash.package ]; text = builtins.readFile ./usque-warp.sh; @@ -45,23 +47,29 @@ in description = "The usque package to use."; }; - warp = { - enable = lib.mkEnableOption "Enables the usque-warp script."; - package = lib.mkOption { - type = lib.types.package; - readOnly = true; - default = usqueWarpScriptPkg; - description = "The usque-warp script package."; + warp = lib.mkOption { + type = lib.types.submodule { + options = { + enable = lib.mkEnableOption "Enables the usque-warp script."; + package = lib.mkOption { + type = lib.types.package; + readOnly = true; + default = usqueWarpScriptPkg; + description = "The usque-warp script package."; + }; + }; }; + default = { }; + description = "WARP script configuration."; }; }; config = lib.mkMerge [ - (lib.mkIf config.networking.usque.enable { - home.packages = [ config.networking.usque.package ]; + (lib.mkIf cfg.enable { + home.packages = [ cfg.package ]; }) - (lib.mkIf config.networking.usque.warp.enable { - home.packages = [ config.networking.usque.warp.package ]; + (lib.mkIf cfg.warp.enable { + home.packages = [ cfg.warp.package ]; }) ]; } |
