Selaa lähdekoodia

code formatter for tmux stuff

Zander Hawke 1 vuosi sitten
vanhempi
sitoutus
e3a9c66db0
2 muutettua tiedostoa jossa 64 lisäystä ja 42 poistoa
  1. 6 6
      home/features/cli/tmux.nix
  2. 58 36
      packages/more-tmux-plugins.nix

+ 6 - 6
home/features/cli/tmux.nix

@@ -1,11 +1,11 @@
 { pkgs, config, ... }:
 {
-# - WARNING Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
-#   - ADVICE:
-#     - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
-#       set-option -sa terminal-features ',XXX:RGB'
-#     - For older tmux versions use this instead:
-#       set-option -ga terminal-overrides ',XXX:Tc'
+  # - WARNING Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.
+  #   - ADVICE:
+  #     - Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:
+  #       set-option -sa terminal-features ',XXX:RGB'
+  #     - For older tmux versions use this instead:
+  #       set-option -ga terminal-overrides ',XXX:Tc'
 
   programs.tmux = {
     sensibleOnTop = false;

+ 58 - 36
packages/more-tmux-plugins.nix

@@ -1,54 +1,76 @@
-{ lib
-, fetchFromGitHub
-, pkgs
-, stdenv
-, config
+{
+  lib,
+  fetchFromGitHub,
+  pkgs,
+  stdenv,
+  config,
 }:
 
 let
   rtpPath = "share/tmux-plugins";
 
-  addRtp = path: rtpFilePath: attrs: derivation:
-    derivation // { rtp = "${derivation}/${path}/${rtpFilePath}"; } // {
+  addRtp =
+    path: rtpFilePath: attrs: derivation:
+    derivation
+    // {
+      rtp = "${derivation}/${path}/${rtpFilePath}";
+    }
+    // {
       overrideAttrs = f: mkTmuxPlugin (attrs // f attrs);
     };
 
-  mkTmuxPlugin = a@{
-    pluginName,
-    rtpFilePath ? (builtins.replaceStrings ["-"] ["_"] pluginName) + ".tmux",
-    namePrefix ? "tmuxplugin-",
-    src,
-    unpackPhase ? "",
-    configurePhase ? ":",
-    buildPhase ? ":",
-    addonInfo ? null,
-    preInstall ? "",
-    postInstall ? "",
-    path ? lib.getName pluginName,
-    ...
-  }:
+  mkTmuxPlugin =
+    a@{
+      pluginName,
+      rtpFilePath ? (builtins.replaceStrings [ "-" ] [ "_" ] pluginName) + ".tmux",
+      namePrefix ? "tmuxplugin-",
+      src,
+      unpackPhase ? "",
+      configurePhase ? ":",
+      buildPhase ? ":",
+      addonInfo ? null,
+      preInstall ? "",
+      postInstall ? "",
+      path ? lib.getName pluginName,
+      ...
+    }:
     if lib.hasAttr "dependencies" a then
       throw "dependencies attribute is obselete. see NixOS/nixpkgs#118034" # added 2021-04-01
-    else addRtp "${rtpPath}/${path}" rtpFilePath a (stdenv.mkDerivation (a // {
-      pname = namePrefix + pluginName;
+    else
+      addRtp "${rtpPath}/${path}" rtpFilePath a (
+        stdenv.mkDerivation (
+          a
+          // {
+            pname = namePrefix + pluginName;
 
-      inherit pluginName unpackPhase configurePhase buildPhase addonInfo preInstall postInstall;
+            inherit
+              pluginName
+              unpackPhase
+              configurePhase
+              buildPhase
+              addonInfo
+              preInstall
+              postInstall
+              ;
 
-      installPhase = ''
-        runHook preInstall
+            installPhase = ''
+              runHook preInstall
 
-        target=$out/${rtpPath}/${path}
-        mkdir -p $out/${rtpPath}
-        cp -r . $target
-        if [ -n "$addonInfo" ]; then
-          echo "$addonInfo" > $target/addon-info.json
-        fi
+              target=$out/${rtpPath}/${path}
+              mkdir -p $out/${rtpPath}
+              cp -r . $target
+              if [ -n "$addonInfo" ]; then
+                echo "$addonInfo" > $target/addon-info.json
+              fi
 
-        runHook postInstall
-      '';
-    }));
+              runHook postInstall
+            '';
+          }
+        )
+      );
 
-in rec {
+in
+rec {
   inherit mkTmuxPlugin;
 
   tmux-select-pane-no-wrap = mkTmuxPlugin rec {