cleanup pkgs folder

This commit is contained in:
Ingolf Wagner 2024-06-07 20:07:39 +02:00
parent b7b0535b74
commit 0671e6b3c5
Signed by: palo
GPG key ID: 76BF5F1928B9618B
17 changed files with 0 additions and 955 deletions

View file

@ -1,96 +0,0 @@
# NixOs fhs-user script
# ---------------------
#
# this is a script to start Bitwig Studio.
# it is necessary because without it my VSTs won't run.
# function header
# ---------------
{ pkgs ? import <nixpkgs> { } }:
let
# function call
# -------------
in
(pkgs.buildFHSUserEnv {
# name of the programm
# --------------------
name = "bitwig";
# targetSystem packages
# ---------------------
# these are packages which are compiled for the target
# system architecture
targetPkgs = pkgs:
with pkgs; [
bitwig-studio3
liblo
zlib
fftw
minixml
libcxx
alsaLib
glibc
gtk2-x11
atk
mesa_glu
glib
pango
gdk_pixbuf
cairo
freetype
fontconfig
dbus
xorg.libX11
xorg.libxcb
xorg.libXext
xorg.libXinerama
xlibs.libXi
xlibs.libXcursor
xlibs.libXdamage
xlibs.libXcomposite
xlibs.libXfixes
xlibs.libXrender
xlibs.libXtst
xlibs.libXScrnSaver
gnome2.GConf
nss
nspr
expat
eudev
# vsts
zynaddsubfx
distrho
zam-plugins
wolf-shaper
wolf-spectrum
lsp-plugins
];
# multilib packages
# -----------------
# these are packages compiled for multiple system
# architectures (32bit/64bit)
multiPkgs = pkgs: with pkgs; [ ];
# command
# -------
# the script which should be run right after starting this enviornment
#runScript = "/bin/bash";
runScript = "/usr/bin/bitwig-studio";
# environment variables
# ---------------------
profile = ''
export TERM="xterm"
'';
})

View file

@ -1,139 +0,0 @@
{ stdenv
, fetchurl
, alsaLib
, bzip2
, cairo
, dpkg
, freetype
, gdk_pixbuf
, glib
, gtk2
, harfbuzz
, jdk
, lib
, xorg
, libbsd
, libjack2
, libpng
, libxkbcommon
, makeWrapper
, pixman
, xdg_utils
, zenity
, zlib
}:
stdenv.mkDerivation rec {
name = "bitwig-studio-${version}";
version = "1.3.16";
src = fetchurl {
url =
"https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb";
sha256 = "0n0fxh9gnmilwskjcayvjsjfcs3fz9hn00wh7b3gg0cv3qqhich8";
};
nativeBuildInputs = [ dpkg makeWrapper ];
unpackCmd = "mkdir root ; dpkg-deb -x $curSrc root";
dontBuild = true;
dontPatchELF = true;
dontStrip = true;
libPath = with xorg;
lib.makeLibraryPath [
alsaLib
bzip2.out
cairo
freetype
gdk_pixbuf
glib
gtk2
harfbuzz
libX11
libXau
libXcursor
libXdmcp
libXext
libXfixes
libXrender
libbsd
libjack2
libpng
libxcb
libxkbfile
pixman
xcbutil
xcbutilwm
zlib
];
binPath = lib.makeBinPath [ xdg_utils zenity ];
installPhase = ''
mkdir -p $out
cp -r opt/bitwig-studio $out/libexec
# Use NixOS versions of these libs instead of the bundled ones.
(
cd $out/libexec/lib/bitwig-studio
rm libbz2.so* libxkbfile.so* libXcursor.so* libXau.so* \
libXdmcp.so* libpng16.so* libxcb*.so* libharfbuzz.so* \
libcairo.so* libfreetype.so*
ln -s ${bzip2.out}/lib/libbz2.so.1.0.6 libbz2.so.1.0
)
# Use our OpenJDK instead of Bitwigs bundled—and commercial!—one.
rm -rf $out/libexec/lib/jre
ln -s ${jdk.home}/jre $out/libexec/lib/jre
# Bitwigs `libx11-windowing-system.so` has several problems:
#
# • has some old version of libxkbcommon linked statically (ಠ_ಠ),
#
# • hardcodes path to `/usr/share/X11/xkb`,
#
# • even if we redirected it with libredirect (after adding
# `eaccess()` to libredirect!), their version of libxkbcommon
# is unable to parse our xkeyboardconfig. Been there, done that.
#
# However, it suffices to override theirs with our libxkbcommon
# in LD_PRELOAD. :-)
find $out -type f -executable \
-not -name '*.so.*' \
-not -name '*.so' \
-not -path '*/resources/*' | \
while IFS= read -r f ; do
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
$f && \
wrapProgram $f \
--prefix PATH : "${binPath}" \
--prefix LD_LIBRARY_PATH : "${libPath}" \
--set LD_PRELOAD "${libxkbcommon.out}/lib/libxkbcommon.so" || true
done
mkdir -p $out/bin
ln -s $out/libexec/bitwig-studio $out/bin/bitwig-studio
cp -r usr/share $out/share
substitute usr/share/applications/bitwig-studio.desktop \
$out/share/applications/bitwig-studio.desktop \
--replace /usr/bin/bitwig-studio $out/bin/bitwig-studio
'';
meta = with lib; {
description = "A digital audio workstation";
longDescription = ''
Bitwig Studio is a multi-platform music-creation system for
production, performance and DJing, with a focus on flexible
editing tools and a super-fast workflow.
'';
homepage = "http://www.bitwig.com/";
license = licenses.unfree;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ michalrus mrVanDalo ];
};
}

View file

@ -1,16 +0,0 @@
{ lib, fetchurl, bitwig-studio1, xdg_utils, zenity, ffmpeg }:
bitwig-studio1.overrideAttrs (oldAttrs: rec {
name = "bitwig-studio-${version}";
version = "2.2.2";
src = fetchurl {
url =
"https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb";
sha256 = "1x4wka32xlygmhdh9rb15s37zh5qjrgap2qk35y34c52lf5aak22";
};
buildInputs = bitwig-studio1.buildInputs ++ [ ffmpeg ];
binPath = lib.makeBinPath [ ffmpeg xdg_utils zenity ];
})

View file

@ -1,23 +0,0 @@
{ stdenv, fetchurl, bitwig-studio2, xorg, ... }:
bitwig-studio2.overrideAttrs (oldAttrs: rec {
name = "bitwig-studio-${version}";
version = "3.2.8";
src = fetchurl {
url =
"https://downloads.bitwig.com/stable/${version}/bitwig-studio-${version}.deb";
sha256 = "18ldgmnv7bigb4mch888kjpf4abalpiwmlhwd7rjb9qf6p72fhpj";
};
buildInputs = bitwig-studio2.buildInputs ++ [ xorg.libXtst ];
installPhase = ''
${oldAttrs.installPhase}
# recover commercial jre
rm -f $out/libexec/lib/jre
cp -r opt/bitwig-studio/lib/jre $out/libexec/lib
'';
})

View file

@ -6,13 +6,9 @@ let callPackage = super.pkgs.callPackage;
in {
#bitwig-studio3 = callPackage ./bitwig-studio/bitwig-studio3.nix { };
emo = callPackage ./emoji { };
light-control = callPackage ./light-control { };
otpmenu = callPackage ./otpmenu { };
#sononym = callPackage ./sononym { };
#sononym-crawler = callPackage ./sononym-crawler { };
taskwarrior-hooks = callPackage ./taskwarrior-hooks { };
terminal-tools = callPackage ./terminal-tools { };
}

View file

@ -1,53 +0,0 @@
{ coreutils, dmenu, gnused, writeShellScriptBin, writeText, xdotool, ... }:
let
# from http://asciimoji.com/
emoticons = writeText "emoticons" ''
¯\(°_o)/¯ | dunno lol shrug dlol
¯\_()_/¯ | dunno lol shrug dlol
( ͡° ͜ʖ ͡°) | lenny
¯\_( ͡° ͜ʖ ͡°)_/¯ | lenny shrug dlol
( д) | aaah sad noo
(^o^)丿 | hi yay yey hello
(^o^; | ups hehe
(^^) | yay yey
(´) | angry argh
(^_^) byebye!! | bye
<(^.^<) <(^.^)> (>^.^)> (7^.^)7 (>^.^<) | dance
(-.-)Zzz... | sleep
() | oh noes woot
| tm
ζ | zeta
(°° | table flip
() | why woot
(= ФФ=) | cat
() | cute
() | you
xx | dead
| derp
(҂_) | endure
(*)*: | glitter
(_) | nerd
WHΣИ $HΛLL WΣ MΣΣ ΛGΛ|И? | when shall we meet again
| check
(ʋ) | dog
()*: | excited
(ʋ) | jake dog
L(° O °L) | lol
o()xxxx[{::::::::::::::::::> | sword
(ÒДÓױ) | what wat
Y Oˡʸ L O | yolo
(ʟ) | zen
@}-,-`- | rose
'';
in
writeShellScriptBin "emoticons" ''
set -efu
data=$(${coreutils}/bin/cat ${emoticons})
emoticon=$(echo "$data" | ${dmenu}/bin/dmenu -l 10 | ${gnused}/bin/sed 's/ | .*//')
${xdotool}/bin/xdotool type -- "$emoticon"
exit 0
''

View file

@ -1,11 +0,0 @@
{ pkgs, lib, ... }:
pkgs.writers.writePython3Bin "gitlog2json"
{
libraries = [
pkgs.python3Packages.GitPython
pkgs.python3Packages.click
pkgs.python3Packages.elasticsearch
];
}
(lib.fileContents ./gitlog2json.py)

View file

@ -1,73 +0,0 @@
import datetime
from git import Repo
import os
import json
import click
from elasticsearch import Elasticsearch
class GitLogger:
"""to provide a log as dict of commits which are json printable"""
def __init__(self, path):
"""Create a GitStepper with the path to the git repository (not a bare repository)"""
self.repo = Repo(path)
def log(self):
"""return a dict of commits"""
commits = (self.repo.commit(logEntry) for logEntry in self.repo.iter_commits())
return (self.to_dict(x) for x in commits)
def to_dict(self, commit):
"""create a dict out of a commit that is easy to json serialize"""
time_difference = commit.authored_datetime - commit.committed_datetime
return {
"author_email": commit.author.email,
"author_name": commit.author.name,
"authored_date": commit.authored_datetime.isoformat(),
"files": [
{"file": file, "changes": changes}
for file, changes in commit.stats.files.items()
],
"committed_date": commit.committed_datetime.isoformat(),
"committer_email": commit.committer.email,
"committer_name": commit.committer.name,
"date_difference_in_seconds": abs(time_difference.total_seconds()),
"encoding": commit.encoding,
"hash": commit.hexsha,
"message": commit.message,
"summary": commit.summary,
"size": commit.size,
"stats_total": commit.stats.total,
"parents": [parent.hexsha for parent in commit.parents],
}
@click.command()
@click.argument("path", type=click.Path(exists=True), envvar="PWD")
@click.option("--host")
@click.option("--index")
@click.option("--port", default=9200)
def main(path, host, index, port):
if host:
if not index:
print("--index need to be set")
exit(1)
print("Sending commits from %s to %s on index %s" % (path, host, index))
es = Elasticsearch([{"host": host, "port": port}])
for entry in GitLogger(path).log():
try:
es.index(index=index, doc_type="commit", id=entry["hash"], body=entry)
except Exception as e:
print(json.dumps(entry))
print(e.info)
exit(1)
else:
for entry in GitLogger(path).log():
print(json.dumps(entry))
if __name__ == "__main__":
main()

View file

@ -1,25 +0,0 @@
from git import Repo
import os
repo = Repo("/home/palo/dev/nixpkgs")
a = repo.head.log()[0]
current_hash = a.newhexsha
commit = repo.commit(current_hash)
commit.author
commit.committed_date
import json
json.dumps(
{
"commit_name": commit.author.name,
"message": commit.message,
"changes": commit.stats.files,
}
)
commit.committed_date
commit.committer.email
commit.parents
commit.encoding
commit.authored_datetime
commit.size
commit.stats.total

View file

@ -1,17 +0,0 @@
{ pkgs ? import <nixpkgs> { } }:
pkgs.mkShell {
buildInputs = with pkgs; [
pkgs.python3Packages.GitPython
pkgs.python3Packages.ipython
pkgs.python3Packages.elasticsearch
pkgs.python3Packages.click
(pkgs.callPackage ./default.nix { })
];
shellHook = ''
HISTFILE=${toString ./.}/.history
'';
}

View file

@ -1,26 +0,0 @@
{ rustPlatform, fetchgit, lib, mosquitto, cmake, openssl, ... }:
rustPlatform.buildRustPackage rec {
name = "light-${version}";
version = "2.1.0";
src = fetchgit {
url = "https://git.ingolf-wagner.de/palo/light-control.git";
rev = "6cce678572815aac8d6f78be2ee5177f07e133bd";
sha256 = "1bnxvgaa58hga20ywgk728aj4wll2rhxgrdp477d2d8isifvij4v";
};
cargoSha256 = "1hhgk3mpmd143d3kfhxsaz2y5aksnwiz1bh4396hh0j7j4kqbgrw";
#cargoSha256 = "05mm82hdbs36p6mr4qdpip16phg28r44lbni09x48qni81dbw3wx";
#verifyCargoDeps = true;
nativeBuildInputs = [ cmake ];
buildInputs = [ mosquitto openssl ];
meta = with lib; {
description = "light control over mqtt, with scenes and room tracking";
homepage = "https://github.com/mrVanDalo/light-control";
license = licenses.gpl3;
maintainers = [ maintainers.mrVanDalo ];
platforms = platforms.all;
};
}

View file

@ -1,7 +0,0 @@
{ writers, fileContents, ... }:
pkgs.writers.writePython3Bin "nginx-show-config"
{
flakeIgnore = [ "E265" "E225" "W292" ];
libraries = [ nginx-config-formatter ];
}
(lib.fileContents ./nginx-show-config.py)

View file

@ -1,40 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -p nginx-config-formatter python3 -i python3
import os
import re
import shutil
import subprocess
import sys
from tempfile import TemporaryDirectory
def nginx_config() -> str:
reload_config = "/etc/nginx/nginx.conf"
if os.path.exists(reload_config):
return reload_config
out = subprocess.check_output(["systemctl", "cat", "nginx"])
match = re.search(r"-c '(\S+-nginx\.conf)", out.decode("utf-8"))
if not match:
print("Could not find nginx.conf in nginx.service", file=sys.stderr)
sys.exit(1)
return match.group(1)
def main():
config_path = nginx_config()
with TemporaryDirectory() as temp_dir:
temp_path = os.path.join(temp_dir, "nginx.conf")
with open(temp_path, "wb+") as temp_file, open(
config_path, "rb"
) as config_file:
shutil.copyfileobj(config_file, temp_file)
temp_file.flush()
subprocess.check_call(["nginxfmt", temp_file.name])
editor = os.environ.get("EDITOR", "cat")
subprocess.check_call([editor, temp_file.name] + sys.argv[1:])
if __name__ == "__main__":
main()

View file

@ -1,31 +0,0 @@
{ lib, fetchgit, libevent, glew, glfw, ... }:
stdenv.mkDerivation rec {
version = "2019-05-19";
name = "pixelnuke-${version}";
src = fetchgit {
url = "https://github.com/defnull/pixelflut.git";
rev = "3458157a242ba1789de7ce308480f4e1cbacc916";
sha256 = "03dp0p00chy00njl4w02ahxqiwqpjsrvwg8j4yi4dgckkc3gbh40";
};
buildInputs = [ libevent glew glfw ];
buildPhase = ''
cd pixelnuke
make
'';
installPhase = ''
mkdir -p $out/bin
cp ./pixelnuke $out/bin/
'';
meta = with lib; {
description = "Multiplayer canvas";
homepage = "https://cccgoe.de/wiki/Pixelflut";
license = licenses.unknown;
platforms = platforms.linux;
maintainers = with maintainers; [ mrVanDalo ];
};
}

View file

@ -1,5 +0,0 @@
# how to build and test
```
nix-build -E 'with import <nixpkgs> { overlays = [ (import "${<nix-writers>}/pkgs" )];} ; callPackage ./default.nix {}';
```

View file

@ -1,362 +0,0 @@
{ pkgs
, lib
# tzselect is your frind do find timezones
, timeZones ? [ ]
, timeColor ? 9
, timeZoneColor ? 10
, calBackgroundColor ? 10
, calWeekColor ? 13
, calDayColor ? 9
, enableIntelBacklight ? true
, userHighlight ? [ "palo" ]
, enableBattery ? true
, ...
}:
let
hrule = "${pkgs.terminal-tools}/bin/hrule";
q-cal =
let
# Maximum width of cal's output.
calwidth = 23;
# Number of space characters between two calendars.
hspace = 2;
# Return number of columns required to print n calenders side by side.
need_width = n: assert n >= 1; n * calwidth + (n - 1) * hspace;
lpad = n: c: s: if lib.stringLength s < n then lpad n c (c + s) else s;
pad = ''
{
${pkgs.gnused}/bin/sed '
# rtrim
s/ *$//
# delete last empty line
''${/^$/d}
' \
| ${pkgs.gawk}/bin/awk '{printf "%-${
toString calwidth
}s\n", $0}' \
| ${pkgs.gnused}/bin/sed "
# colorize header
1,2s/.*/[38;5;${toString calBackgroundColor}m&/
# highlight current week
s/^$(${pkgs.coreutils}/bin/date +%W)/[38;5;${
toString calWeekColor
}m&/
# colorize week number
s/^[ 1-9][0-9]/[38;5;${
toString calBackgroundColor
}m&/
"
}'';
in
''
cols=$(${pkgs.ncurses}/bin/tput cols)
${pkgs.coreutils}/bin/paste \
<(if test $cols -ge ${toString (need_width 3)}; then
${pkgs.utillinux}/bin/cal -mw \
$(${pkgs.coreutils}/bin/date +'%m %Y' -d 'last month') \
| ${pad}
fi) \
<(if test $cols -ge ${toString (need_width 1)}; then
${pkgs.utillinux}/bin/cal -mw \
| ${pkgs.gnused}/bin/sed '
# colorize day of month
s/\(^\| \)'"$(${pkgs.coreutils}/bin/date +%e)"'\>/[38;5;${
toString calDayColor
}m&/
' \
| ${pad}
fi) \
<(if test $cols -ge ${toString (need_width 2)}; then
${pkgs.utillinux}/bin/cal -mw \
$(${pkgs.coreutils}/bin/date +'%m %Y' -d 'next month') \
| ${pad}
fi) \
| ${pkgs.gnused}/bin/sed '
s/^\t//
s/\t$//
s/\t/${lpad hspace " " ""}/g
'
'';
q-timeZoneDate = size: zone:
let
dateString = comment:
"'+%Y-%m-%dT[;38;5;${
toString timeColor
}m%H:%M:%S[;38;5;${toString timeZoneColor}m%:z ${comment}' ";
timeZoneVariable = lib.optionalString (zone != null) "TZ=${zone}";
comment = lib.optionalString (zone != null)
" : ${lib.fixedWidthString size " " zone}";
# sh
in
''
${timeZoneVariable} ${pkgs.coreutils}/bin/date ${
dateString comment
} | ${pkgs.terminal-tools}/bin/center
'';
q-timeZoneDates =
if timeZones == [ ] then
q-timeZoneDate 0 null
else
let size = lib.foldr lib.max 0 (map builtins.stringLength timeZones);
in lib.concatMapStringsSep "\n" (q-timeZoneDate size) timeZones;
q-intel_backlight = ''
cd /sys/class/backlight/intel_backlight
</dev/null exec ${pkgs.gawk}/bin/awk '
END {
getline actual_brightness < "actual_brightness"
getline max_brightness < "max_brightness"
getline brightness < "brightness"
printf "%20s %d%% %d/%d\n" \
, "intel_backlight" \
, actual_brightness / max_brightness * 100 \
, actual_brightness \
, max_brightness
}
'
'';
q-power_supply =
let
power_supply = pkgs.writers.writeBash "power_supply" ''
set -efu
uevent=$1
eval "$(${pkgs.gnused}/bin/sed -n '
s/^\([A-Z_]\+=[0-9A-Za-z_-]*\)$/export \1/p
' $uevent)"
case $POWER_SUPPLY_NAME in
AC)
exit # not battery
;;
esac
exec </dev/null
exec ${pkgs.gawk}/bin/awk '
function die(s) {
printf "%20s %s\n", name, s
exit 1
}
function print_hm(h, m) {
m = (h - int(h)) * 60
return sprintf("%dh%dm", h, m)
}
function print_bar(bar_size, charge, full_bars, empty_bars, full_color) {
full_bars = int(charge * bar_size)
empty_bars = bar_size - full_bars
if (charge >= .42) full_color = "2"
else if (charge >= .23) full_color = "3"
else full_color = "1"
left_arrow = 1
middle_arrow = 1
right_arrow = 1
if (full_bars == 0) {
left_arrow = 0
middle_arrow = 0
}
if (empty_bars == 0) {
middle_arrow = 0
right_arrow = 0
}
empty_color = "0";
return sgr("38;5;" 8) sgr("48;5;" full_color) strdup("",left_arrow) strdup(" ", full_bars) sgr("48;5;" empty_color) sgr("38;5;" full_color) strdup("",middle_arrow) strdup(" ", empty_bars) sgr() sgr("38;5;" empty_color) strdup("",right_arrow) sgr()
}
function sgr(p) {
return "\x1b[" p "m"
}
function strdup(s,n,t) {
t = sprintf("%"n"s","")
gsub(/ /,s,t)
return t
}
END {
name = ENVIRON["POWER_SUPPLY_NAME"]
charge_unit = "Ah"
charge_now = ENVIRON["POWER_SUPPLY_CHARGE_NOW"] / 10^6
charge_full = ENVIRON["POWER_SUPPLY_CHARGE_FULL"] / 10^6
current_unit = "A"
current_now = ENVIRON["POWER_SUPPLY_CURRENT_NOW"] / 10^6
energy_unit = "Wh"
energy_now = ENVIRON["POWER_SUPPLY_ENERGY_NOW"] / 10^6
energy_full = ENVIRON["POWER_SUPPLY_ENERGY_FULL"] / 10^6
power_unit = "W"
power_now = ENVIRON["POWER_SUPPLY_POWER_NOW"] / 10^6
voltage_unit = "V"
voltage_now = ENVIRON["POWER_SUPPLY_VOLTAGE_NOW"] / 10^6
voltage_min_design = ENVIRON["POWER_SUPPLY_VOLTAGE_MIN_DESIGN"] / 10^6
#printf "charge_now: %s\n", charge_now
#printf "charge_full: %s\n", charge_full
#printf "current_now: %s\n", current_now
#printf "energy_now: %s\n", energy_now
#printf "energy_full: %s\n", energy_full
#printf "energy_full: %s\n", ENVIRON["POWER_SUPPLY_ENERGY_FULL"]
#printf "energy_full: %s\n", ENVIRON["POWER_SUPPLY_ENERGY_FULL"] / 10^6
#printf "power_now: %s\n", power_now
#printf "voltage_now: %s\n", voltage_now
if (current_now == 0 && voltage_now != 0) {
current_now = power_now / voltage_now
}
if (power_now == 0) {
power_now = current_now * voltage_now
}
if (charge_now == 0 && voltage_min_design != 0) {
charge_now = energy_now / voltage_min_design
}
if (energy_now == 0) {
energy_now = charge_now * voltage_min_design
}
if (charge_full == 0 && voltage_min_design != 0) {
charge_full = energy_full / voltage_min_design
}
if (energy_full == 0) {
energy_full = charge_full * voltage_min_design
}
if (charge_now == 0 || charge_full == 0) {
die("unknown charge")
}
charge_ratio = charge_now / charge_full
out = out sprintf("%20s ", name)
out = out sprintf(" %s", print_bar(10, charge_ratio))
out = out sprintf(" %d%", charge_ratio * 100)
out = out sprintf(" %.2f%s", charge_now, charge_unit)
if (current_now != 0) {
out = out sprintf("/%.1f%s", current_now, current_unit)
}
out = out sprintf(" %d%s", energy_full, energy_unit)
if (power_now != 0) {
out = out sprintf("/%.1f%s", power_now, power_unit)
}
if (current_now != 0) {
out = out sprintf(" %s", print_hm(charge_now / current_now))
}
print out
}
'
'';
in
''
for uevent in /sys/class/power_supply/*/uevent; do
${power_supply} "$uevent" || :
done
'';
q-virtualization = ''
printf '%20s %s\n' "VT" \
$(${pkgs.systemd}/bin/systemd-detect-virt)
'';
q-wireless = ''
for dev in $(
${pkgs.iw}/bin/iw dev \
| ${pkgs.gnused}/bin/sed -n 's/^\s*Interface\s\+\([0-9a-z]\+\)$/\1/p'
); do
inet=$(${pkgs.iproute}/bin/ip addr show $dev \
| ${pkgs.gnused}/bin/sed -n '
s/.*inet \([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p
') \
|| unset inet
ssid=$(${pkgs.iw}/bin/iw dev $dev link \
| ${pkgs.gnused}/bin/sed -n '
s/.*\tSSID: \(.*\)/\1/p
') \
|| unset ssid
printf '%20s %s %s\n' $dev ''${inet+ $inet} ''${ssid+ $ssid}
done
'';
q-online = ''
if ${pkgs.curl}/bin/curl -s google.com >/dev/null; then
echo ' status online'
else
echo ' status offline '
fi
'';
q-thermal_zone = ''
for i in /sys/class/thermal/thermal_zone*; do
type=$(${pkgs.coreutils}/bin/cat $i/type)
temp=$(${pkgs.coreutils}/bin/cat $i/temp)
printf '%20s %s°C\n' $type $(echo $temp / 1000 | ${pkgs.bc}/bin/bc)
done
'';
q-show-users = ''
${pkgs.procps}/bin/ps -eo user \
| ${pkgs.gnused}/bin/sed '1 d' \
| ${pkgs.coreutils}/bin/sort \
| ${pkgs.coreutils}/bin/uniq \
| ${pkgs.gnugrep}/bin/egrep --color=always '(${
lib.concatStringsSep "|" userHighlight
})|$' \
| ${pkgs.utillinux}/bin/column
'';
q-task-checklist = ''
${pkgs.taskwarrior}/bin/task export +checklist status:pending +READY | \
${pkgs.jq}/bin/jq \
--raw-output '
sort_by(.description) | reverse |
.[] |
"[ \( .id ) ] \( .description )"
'
'';
q-task-active = ''
${pkgs.taskwarrior}/bin/task export \
+ACTIVE status:pending \
| ${pkgs.jq}/bin/jq --raw-output '.[] | " \(.id) \(.description)"'
'';
# bash needed for <(...)
in
pkgs.writers.writeBashBin "q" ''
set -eu
export PATH=/var/empty
${hrule}
${q-cal}
${hrule}
${q-timeZoneDates}
${hrule}
${lib.optionalString enableIntelBacklight "(${q-intel_backlight}) &"}
${lib.optionalString enableBattery "(${q-power_supply}) &"}
(${q-virtualization}) &
(${q-wireless}) &
(${q-online}) &
(${q-thermal_zone}) & wait
${hrule}
${q-task-active}
${hrule}
${q-task-checklist}
${hrule}
${q-show-users}
''

View file

@ -1,27 +0,0 @@
{ rustPlatform, fetchgit, lib, ... }:
rustPlatform.buildRustPackage rec {
name = "terminal-tools-${version}";
version = "0.1.0";
#src = ./.;
src = fetchgit {
url = "https://git.ingolf-wagner.de/palo/terminal-tools";
rev = "816cfd8eae8f8136437e4076116e0267c6a6eb0d";
sha256 = "07zf716wy0rqpzwj580haw935lj5ih0wzhfn26dq83kf9nm09iyg";
};
cargoSha256 = "0dgbw6idlzzpgljv0lxavimh1h8qlib0qrcn92f5imy6a12phrmm";
verifyCargoDeps = true;
meta = with lib; {
description = "tools I use in my shell scripts which should be fast";
homepage = "https://git.ingolf-wagner.de/palo/terminal-tools";
license = licenses.gpl3;
maintainers = [ maintainers.mrVanDalo ];
platforms = platforms.all;
};
}