From 53dc8c95e525f922461dfc1768121ee02380e4ec Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Wed, 5 Aug 2026 17:58:58 +0530 Subject: feat: Rewrote neomutt keybindings, updated comments - Rewriting the neomutt keybindings by hand - Updated comments to be simpler --- modules/web/aria2/default.nix | 2 +- modules/web/chawan/assertions.nix | 2 +- modules/web/chawan/default.nix | 2 +- modules/web/chromium/browserpass.nix | 2 +- modules/web/chromium/extensions/default.nix | 3 +-- modules/web/chromium/extensions/lib.nix | 28 ++++++++++------------------ modules/web/default.nix | 2 +- 7 files changed, 16 insertions(+), 25 deletions(-) (limited to 'modules/web') diff --git a/modules/web/aria2/default.nix b/modules/web/aria2/default.nix index 77b25bb..800f178 100644 --- a/modules/web/aria2/default.nix +++ b/modules/web/aria2/default.nix @@ -1,4 +1,4 @@ -# Aria2 - command line download manager +# Command line download manager { lib, config, diff --git a/modules/web/chawan/assertions.nix b/modules/web/chawan/assertions.nix index 2ab30a0..93b5fab 100644 --- a/modules/web/chawan/assertions.nix +++ b/modules/web/chawan/assertions.nix @@ -1,4 +1,4 @@ -# Assertions - Validates kitty is enabled for chawan desktop entry +# Validates kitty is enabled for chawan desktop entry { config, ... }: { assertions = [ diff --git a/modules/web/chawan/default.nix b/modules/web/chawan/default.nix index 7d1398e..b71d902 100644 --- a/modules/web/chawan/default.nix +++ b/modules/web/chawan/default.nix @@ -1,4 +1,4 @@ -# Chawan - Text-based web browser and pager +# Text-based web browser and pager { config, lib, diff --git a/modules/web/chromium/browserpass.nix b/modules/web/chromium/browserpass.nix index f09945d..6bef374 100644 --- a/modules/web/chromium/browserpass.nix +++ b/modules/web/chromium/browserpass.nix @@ -5,7 +5,7 @@ ... }: let - # Extension ID computed from the pinned "extensionKey" in + # Extension ID computed from the pinned extensionKey patchedHost = pkgs.runCommand "com.github.browserpass.native.json" { diff --git a/modules/web/chromium/extensions/default.nix b/modules/web/chromium/extensions/default.nix index 6128d2b..a079a78 100644 --- a/modules/web/chromium/extensions/default.nix +++ b/modules/web/chromium/extensions/default.nix @@ -51,8 +51,7 @@ in ''; }; - # readOnly options get their actual value assigned here, in this same - # module's config — this is the one place allowed to set it. + # Readonly options get their actual value assigned here in this module config.web.chromium.extensions = { aria2Explorer = mkExtension ./aria2-explorer.nix; browserpass = mkExtension ./browserpass.nix; diff --git a/modules/web/chromium/extensions/lib.nix b/modules/web/chromium/extensions/lib.nix index d319a5c..79007bd 100644 --- a/modules/web/chromium/extensions/lib.nix +++ b/modules/web/chromium/extensions/lib.nix @@ -5,9 +5,7 @@ checkForUpdates ? true, }: rec { - # --- Hit the GitHub releases API and return the latest tag name. --- - # Impure: requires --impure since there's no fixed output hash for the API - # response itself. Optionally uses $GITHUB_TOKEN to dodge rate limits. + # Fetch the latest release tag from the GitHub releases API fetchLatestGithubReleaseTag = { owner, repo }: let @@ -19,9 +17,7 @@ rec { in json.tag_name; - # --- Compare pinned version against upstream latest, abort with instructions if stale. --- - # Returns `version` unchanged on success so it can be threaded into the - # derivation below and force this check to actually run. + # Abort if the pinned version is older than the latest upstream release checkExtensionVersion = { pname, @@ -61,11 +57,7 @@ rec { else version; - # --- Download + unpack a zip *or* crx into a plain unpacked-extension dir. --- - # A CRX3 file is just: "Cr24" magic (4B) + version (4B) + header length N (4B) - # + N bytes of protobuf header + a normal zip payload. We slice off the - # header when isCrx = true, then unzip exactly like any other release zip — - # so every extension, crx or not, goes through one identical pipeline. + # Download and unpack a zip or crx file into an unpacked extension directory fetchUnpackedExtension = { pname, @@ -73,7 +65,7 @@ rec { url, hash, isCrx ? false, - extensionKey ? null, # NEW: Accept an optional public key + extensionKey ? null, # Accept an optional public key }: pkgs.stdenv.mkDerivation { inherit pname version; @@ -81,7 +73,7 @@ rec { nativeBuildInputs = [ config.file-management.ouch.package - pkgs.jq # NEW: Required for safely editing manifest.json + pkgs.jq # Required for safely editing manifest.json ]; dontUnpack = true; @@ -90,14 +82,14 @@ rec { mkdir -p $out if [ "${lib.boolToString isCrx}" = "true" ]; then - # Verify "Cr24" magic header + # Verify the Cr24 magic header magic=$(head -c 4 "$src") if [ "$magic" != "Cr24" ]; then echo "Error: $src is not a valid CRX file" >&2 exit 1 fi - # Extract header length (bytes 8-11, little-endian) + # Extract header length in bytes 8 to 11 bytes=$(od -An -j8 -N4 -tu1 "$src") read b1 b2 b3 b4 <<< $bytes hlen=$(( b1 + (b2 << 8) + (b3 << 16) + (b4 << 24) )) @@ -109,7 +101,7 @@ rec { ouch decompress $src --dir $out fi - # Flatten a single wrapping folder (common in GitHub release zips) + # Flatten a single wrapping folder if [ "$(ls -1 $out | wc -l)" -eq 1 ] && [ -d "$out"/* ]; then shopt -s dotglob mv "$out"/*/* "$out"/ 2>/dev/null || true @@ -117,7 +109,7 @@ rec { shopt -u dotglob fi - # NEW: Inject the public key into manifest.json if provided + # Inject the public key into manifest.json if provided ${lib.optionalString (extensionKey != null) '' if [ -f "$out/manifest.json" ]; then echo "Injecting extension key into manifest.json to lock the extension ID..." @@ -132,7 +124,7 @@ rec { ''; installPhase = "true"; - }; # --- Package a local directory as an unpacked extension derivation. --- + }; # Package a local directory as an unpacked extension mkLocalExtension = { diff --git a/modules/web/default.nix b/modules/web/default.nix index 7357df9..4e07536 100644 --- a/modules/web/default.nix +++ b/modules/web/default.nix @@ -1,4 +1,4 @@ -# Web - Web browser and downloader modules (aria2, brave, chawan) +# Web browser and downloader modules { ... }: { imports = [ -- cgit v1.2.3