aboutsummaryrefslogtreecommitdiffstats
path: root/modules/networking/usque/default.nix
diff options
context:
space:
mode:
authorArpit Chakladar <arpitchakladar+git@gmail.com>2026-08-29 03:45:10 +0530
committerArpit Chakladar <arpitchakladar+git@gmail.com>2026-08-29 03:50:33 +0530
commit1a39cf221e3f647df0767c88d89a54e3813e7019 (patch)
treeb3df1afb0bcc0942a364f267f993ed1a9bfb9434 /modules/networking/usque/default.nix
parente9e375f5f5263964fe89479a2610081000959774 (diff)
downloadhome-manager-config-1a39cf221e3f647df0767c88d89a54e3813e7019.tar.gz
home-manager-config-1a39cf221e3f647df0767c88d89a54e3813e7019.zip
refactor: adding explicit options to enable scripts
- some scripts that are not critical to the functioning of other options, can be enabled/disabled
Diffstat (limited to 'modules/networking/usque/default.nix')
-rw-r--r--modules/networking/usque/default.nix50
1 files changed, 36 insertions, 14 deletions
diff --git a/modules/networking/usque/default.nix b/modules/networking/usque/default.nix
index 9d04ab7..ffde47a 100644
--- a/modules/networking/usque/default.nix
+++ b/modules/networking/usque/default.nix
@@ -6,21 +6,32 @@
...
}:
let
- inherit ((import ../../lib/script.nix { inherit lib pkgs; })) mkScriptModule;
- usqueWarp = mkScriptModule {
- scope = [
- "networking"
- "usque"
- ];
+ usqueWarpScript = pkgs.writeShellApplication {
name = "usque-warp";
- path = ./usque-warp.sh;
- description = "Connect/disconnect to Cloudflare WARP via usque MASQUE tunnel";
- deps = [
+ runtimeInputs = [
config.networking.usque.package
pkgs.bash
];
- completion.zsh = builtins.readFile ./usque-warp.zsh;
- inherit config;
+ text = builtins.readFile ./usque-warp.sh;
+ };
+
+ usqueWarpCompletion =
+ pkgs.runCommand "usque-warp-completion"
+ {
+ nativeBuildInputs = [ pkgs.installShellFiles ];
+ }
+ ''
+ mkdir -p $out/share/zsh/site-functions
+ installShellCompletion --zsh --name _usque-warp ${pkgs.writeText "usque-warp.zsh" (builtins.readFile ./usque-warp.zsh)}
+ '';
+
+ usqueWarpScriptPkg = pkgs.symlinkJoin {
+ name = "usque-warp";
+ paths = [
+ usqueWarpScript
+ usqueWarpCompletion
+ ];
+ meta = usqueWarpScript.meta or { };
};
in
{
@@ -31,13 +42,24 @@ in
default = pkgs.usque;
description = "The usque package to use.";
};
- }
- // usqueWarp.options.networking.usque;
+
+ 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.";
+ };
+ };
+ };
config = lib.mkMerge [
(lib.mkIf config.networking.usque.enable {
home.packages = [ config.networking.usque.package ];
})
- usqueWarp.config
+ (lib.mkIf config.networking.usque.warp.enable {
+ home.packages = [ config.networking.usque.warp.package ];
+ })
];
}