From 49b51a01b6b4db8d6e350357cdfabe386d55dd8b Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Mon, 19 Apr 2021 07:43:55 +0200 Subject: [PATCH] add some scripts --- system/all/packages.nix | 41 +++++++++++++++++++++---------------- system/desktop/packages.nix | 11 ++++++++++ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/system/all/packages.nix b/system/all/packages.nix index 219dddd..2f077eb 100644 --- a/system/all/packages.nix +++ b/system/all/packages.nix @@ -2,25 +2,22 @@ let - pastebin = pkgs.writers.writeDashBin "pastebin" # sh - '' - exec ${pkgs.bepasty-client-cli}/bin/bepasty-cli \ - --lifetime 1m \ - --url http://workhorse.private:8000 \ - --pass ${lib.fileContents } \ - "$@" | sed -e s/workhorse.private:8000/paste.ingolf-wagner.de/ - ''; + pastebin = pkgs.writers.writeDashBin "pastebin" '' + exec ${pkgs.bepasty-client-cli}/bin/bepasty-cli \ + --lifetime 1m \ + --url http://workhorse.private:8000 \ + --pass ${lib.fileContents } \ + "$@" | sed -e s/workhorse.private:8000/paste.ingolf-wagner.de/ + ''; - memoryUsage = pkgs.writers.writeDashBin "memory-total-usage" # sh - '' - echo " %CPU %MEM MEM : PROCESS" - echo "------- ------- ------------- -------" - ps aux | awk '{mem[$11]+=int($6/1024)}; {cpuper[$11]+=$3};{memper[$11]+=$4}; END {for (i in mem) {printf "%6.2f%% %6.2f%% %10.2f MB : %s\n", cpuper[i],memper[i],mem[i],i}}' | sort -k3nr | head -n 5 - ''; + memoryUsage = pkgs.writers.writeDashBin "memory-total-usage" '' + echo " %CPU %MEM MEM : PROCESS" + echo "------- ------- ------------- -------" + ps aux | awk '{mem[$11]+=int($6/1024)}; {cpuper[$11]+=$3};{memper[$11]+=$4}; END {for (i in mem) {printf "%6.2f%% %6.2f%% %10.2f MB : %s\n", cpuper[i],memper[i],mem[i],i}}' | sort -k3nr | head -n 5 + ''; prefetch-git-rendered = - pkgs.writeShellScriptBin "nix-prefetch-git-rendered" # sh - '' + pkgs.writeShellScriptBin "nix-prefetch-git-rendered" '' ${pkgs.nix-prefetch-scripts}/bin/nix-prefetch-git "$@" \ | ${pkgs.jq}/bin/jq --raw-output '"pkgs.fetchgit{ url = \"\(.url)\"; @@ -30,8 +27,7 @@ let ''; prefetch-url-rendered = - pkgs.writeShellScriptBin "nix-prefetch-url-rendered" # sh - '' + pkgs.writeShellScriptBin "nix-prefetch-url-rendered" '' HASH=$( ${pkgs.nix}/bin/nix-prefetch-url "$1" ) cat <