jj, fish, better kanata, etc

This commit is contained in:
Jonathan Dönszelmann 2024-12-30 09:33:16 +01:00
parent 52b1728e2e
commit d030ebe744
No known key found for this signature in database
17 changed files with 1642 additions and 938 deletions

35
programs/fish/scripts.nix Normal file
View file

@ -0,0 +1,35 @@
{ pkgs, ... }:
{
calc = "${pkgs.python313}/bin/python -i ${pkgs.writeText "init.py" ''
from math import *;
# import numpy as np
kilo = 1000
mega = 1000 * kilo
giga = 1000 * mega
tera = 1000 * giga
peta = 1000 * tera
b = 1
kib = 1024
mib = 1024 * kib
gib = 1024 * mib
tib = 1024 * gib
pib = 1024 * tib
''} ";
cp-media =
name: media:
let
s = pkgs.writeScriptBin "cp-${name}" ''
echo "copying to library ${media}"
echo "calculating hash"
find "$1" - type f - print0 | sort - z | xargs - 0 sha1sum | awk '{
print $1}' | sha1sum | awk '{print $1}' > "$1.hash"
rsync -azP "$1" fili:/media/${media}
rsync -azP "$1.hash" fili:/media/${media}
'';
in
"${s}/bin/cp-${name}";
}