From b071f6c695ef16a8a5b7dee444a17748a0bc41d2 Mon Sep 17 00:00:00 2001 From: Erwin Boskma Date: Tue, 1 Mar 2022 20:06:19 +0100 Subject: [PATCH] Add wireshark, cleanup on fish functions --- home-manager/modules/fish/default.nix | 2 +- home-manager/modules/fish/functions.nix | 33 +++++++++++++------------ modules/desktop/default.nix | 1 + 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/home-manager/modules/fish/default.nix b/home-manager/modules/fish/default.nix index df80322..61ea9cb 100644 --- a/home-manager/modules/fish/default.nix +++ b/home-manager/modules/fish/default.nix @@ -11,7 +11,7 @@ in config = mkIf (cfg.enable) { programs.fish = { enable = true; - functions = (import ./functions.nix); + functions = (import ./functions.nix { inherit (pkgs) git; }); plugins = [ { diff --git a/home-manager/modules/fish/functions.nix b/home-manager/modules/fish/functions.nix index b40dc27..7a8af37 100644 --- a/home-manager/modules/fish/functions.nix +++ b/home-manager/modules/fish/functions.nix @@ -1,3 +1,4 @@ +{ git }: { reload = { body = '' @@ -18,25 +19,25 @@ }; clangfmt = { body = '' - set source_exts "h" "hpp" "c" "cpp" "cc" "cp" "c++" "cxx" "cu" "proto" - set files (git diff --diff-filter=ACMR --name-only $argv[1]) - set repo_path (realpath --relative-to=$PWD (git rev-parse --show-toplevel)) - set clangformat (git config --get clangFormat.binary) - echo "Formatting files in $repo_path with $clangformat" + set source_exts "h" "hpp" "c" "cpp" "cc" "cp" "c++" "cxx" "cu" "proto" + set files (${git}/bin/git diff --diff-filter=ACMR --name-only $argv[1]) + set repo_path (realpath --relative-to=$PWD (${git}/bin/git rev-parse --show-toplevel)) + set clangformat (${git}/bin/git config --get clangFormat.binary) + echo "Formatting files in $repo_path with $clangformat" - for f in $files - set file (realpath $repo_path/$f) - echo "Processing $file" - - set ext (string match -r ".*\.([^\.]+)\$" $file)[2] + for f in $files + set file (realpath $repo_path/$f) + echo "Processing $file" + + set ext (string match -r ".*\.([^\.]+)\$" $file)[2] - if contains $ext $source_exts - echo "Formatting $file" - $clangformat -i -style=file $file - else - echo "Extension $ext not found in $source_exts" - end + if contains $ext $source_exts + echo "Formatting $file" + $clangformat -i -style=file $file + else + echo "Extension $ext not found in $source_exts" end + end ''; description = "Use clang-format to format all changed and added files"; }; diff --git a/modules/desktop/default.nix b/modules/desktop/default.nix index 8b84f2c..5eaeac0 100644 --- a/modules/desktop/default.nix +++ b/modules/desktop/default.nix @@ -107,6 +107,7 @@ in tdesktop unzip xdg-utils + wireshark wl-clipboard ] ++ (with gst_all_1; [ gstreamer gstreamer.dev gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav gst-vaapi ]);