2020-04-10 16:18:20 +02:00
|
|
|
{ pkgs, lib, ... }:
|
2020-04-09 16:56:47 +02:00
|
|
|
let
|
2020-06-10 17:37:25 +02:00
|
|
|
kpaste = pkgs.callPackage <stockholm/krebs/5pkgs/simple/kpaste> { };
|
|
|
|
|
wrapScript = { packages ? [ ], name, script }:
|
|
|
|
|
pkgs.writers.writeDashBin name ''
|
|
|
|
|
PATH=$PATH:${
|
|
|
|
|
lib.makeBinPath (packages ++ [ pkgs.coreutils pkgs.findutils ])
|
|
|
|
|
}
|
|
|
|
|
${script} "$@"
|
|
|
|
|
'';
|
2020-04-15 20:39:37 +02:00
|
|
|
voidrice = pkgs.fetchFromGitHub {
|
|
|
|
|
owner = "LukeSmithxyz";
|
|
|
|
|
repo = "voidrice";
|
2020-08-28 15:21:34 +02:00
|
|
|
rev = "0582b495937117d899ce8ef715a89c6cc25a36cf";
|
|
|
|
|
sha256 = "0c4hkny4zkknlimc9yi9ljss2cws4zn8lzd8ip9b8mfsm094dlfl";
|
2020-04-15 20:39:37 +02:00
|
|
|
};
|
2020-07-11 20:43:19 +02:00
|
|
|
in rec {
|
2020-04-15 00:10:30 +02:00
|
|
|
instaget = wrapScript {
|
|
|
|
|
packages = [ pkgs.jq pkgs.curl pkgs.gnugrep ];
|
|
|
|
|
script = ./instaget.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "instaget";
|
|
|
|
|
};
|
|
|
|
|
|
2021-02-14 11:21:30 +01:00
|
|
|
infschmv = pkgs.writers.writeDashBin "InfSchMV" ''
|
|
|
|
|
${pkgs.curl}/bin/curl -sSL https://www.berlin.de/corona/massnahmen/verordnung/ \
|
|
|
|
|
| ${pkgs.pup}/bin/pup .textile \
|
|
|
|
|
| ${pkgs.pandoc}/bin/pandoc -f html -t man -s \
|
|
|
|
|
| ${pkgs.man}/bin/man -l -
|
|
|
|
|
'';
|
|
|
|
|
|
2021-02-08 08:16:04 +01:00
|
|
|
trans =
|
|
|
|
|
let
|
|
|
|
|
script = pkgs.fetchurl {
|
|
|
|
|
url = "https://raw.githubusercontent.com/soimort/translate-shell/gh-pages/trans.awk";
|
|
|
|
|
sha256 = "178r8d27bry1mzd1g8x2svp4w469hwv7nnxnmnsinx974skjx0jb";
|
|
|
|
|
};
|
|
|
|
|
in pkgs.writers.writeDashBin "trans" ''
|
|
|
|
|
${pkgs.gawk}/bin/gawk -f ${script} -- "$@"
|
|
|
|
|
'';
|
|
|
|
|
|
2020-11-02 21:43:38 +01:00
|
|
|
dns-sledgehammer = pkgs.writers.writeDashBin "dns-sledgehammer" ''
|
|
|
|
|
${pkgs.coreutils}/bin/printf '%s\n' 'nameserver 1.1.1.1' 'options edns0' > /etc/resolv.conf
|
|
|
|
|
'';
|
|
|
|
|
|
2021-03-03 19:03:59 +01:00
|
|
|
much-scripts = let
|
|
|
|
|
much-current-query = wrapScript {
|
|
|
|
|
packages = [ pkgs.curl ];
|
|
|
|
|
name = "much-current-query";
|
|
|
|
|
script = ./much-current-query.sh;
|
|
|
|
|
};
|
|
|
|
|
mail-send = wrapScript {
|
|
|
|
|
packages = [ pkgs.notmuch pkgs.msmtp pkgs.jq ];
|
|
|
|
|
name = "mail-send";
|
|
|
|
|
script = ./mail-send.sh;
|
|
|
|
|
};
|
|
|
|
|
mail-reply = wrapScript {
|
|
|
|
|
packages = [ much-current-query pkgs.notmuch pkgs.gnused pkgs.jq ];
|
|
|
|
|
name = "mail-reply";
|
|
|
|
|
script = ./mail-reply.sh;
|
|
|
|
|
};
|
|
|
|
|
mail-kill = wrapScript {
|
|
|
|
|
name = "mail-kill";
|
|
|
|
|
script = ./mail-kill.sh;
|
|
|
|
|
packages = [ pkgs.notmuch ];
|
|
|
|
|
};
|
|
|
|
|
in pkgs.symlinkJoin {
|
2020-11-02 21:43:38 +01:00
|
|
|
name = "much-scripts";
|
2021-03-03 19:03:59 +01:00
|
|
|
paths = [ mail-send much-current-query mail-reply mail-kill ];
|
2020-11-02 21:43:38 +01:00
|
|
|
};
|
|
|
|
|
|
2020-10-27 12:02:45 +01:00
|
|
|
showkeys-toggle = pkgs.writers.writeDashBin "showkeys-toggle" ''
|
|
|
|
|
if ${pkgs.procps}/bin/pgrep screenkey; then
|
|
|
|
|
exec ${pkgs.procps}/bin/pkill screenkey
|
|
|
|
|
else
|
|
|
|
|
exec ${pkgs.screenkey}/bin/screenkey
|
|
|
|
|
fi
|
|
|
|
|
'';
|
|
|
|
|
|
2020-10-28 20:27:05 +01:00
|
|
|
interdimensional-cable =
|
|
|
|
|
let nimaid-github-io = pkgs.fetchFromGitHub {
|
|
|
|
|
owner = "nimaid";
|
|
|
|
|
repo = "nimaid.github.io";
|
|
|
|
|
rev = "9cb4ede215be6bb01bd2df1ef3e9689cc8c4eb9e";
|
|
|
|
|
sha256 = "1g47cj5an7xgmhpc09m7qim5j9rspqxvnzfy90cnlvz4pg8hil96";
|
|
|
|
|
};
|
2020-10-28 21:43:33 +01:00
|
|
|
in pkgs.writeShellScriptBin "interdimensional-cable" ''
|
2020-10-28 20:27:05 +01:00
|
|
|
export PATH=${lib.makeBinPath [ pkgs.mpv pkgs.jq pkgs.gnused ]}
|
|
|
|
|
mpv --shuffle --playlist=<(jq -r '.videos[]' ${nimaid-github-io}/tv/interdimensional_database.json | sed 's#^#https://youtu.be/#')
|
|
|
|
|
'';
|
|
|
|
|
|
2020-07-11 20:43:19 +02:00
|
|
|
tag = wrapScript {
|
|
|
|
|
packages = [ pkgs.vorbisTools pkgs.python3Packages.eyeD3 pkgs.nur.repos.kmein.opustags ];
|
|
|
|
|
script = "${voidrice}/.local/bin/tag";
|
|
|
|
|
name = "tag";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
booksplit = wrapScript {
|
|
|
|
|
packages = [ pkgs.ffmpeg tag ];
|
|
|
|
|
script = "${voidrice}/.local/bin/booksplit";
|
|
|
|
|
name = "booksplit";
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
n = wrapScript {
|
|
|
|
|
script = ./n.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "n";
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
dirmir = wrapScript {
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "dirmir";
|
2020-04-15 00:10:30 +02:00
|
|
|
script = ./dirmir.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
};
|
|
|
|
|
|
2021-02-04 18:40:11 +01:00
|
|
|
liddel-scott-jones = wrapScript {
|
|
|
|
|
name = "lsj";
|
|
|
|
|
script = ./liddel-scott-jones.sh;
|
|
|
|
|
packages = [ pkgs.curl pkgs.pup betacode pkgs.gnused pkgs.pandoc pkgs.man ];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
boetlingk = wrapScript {
|
|
|
|
|
name = "boet";
|
|
|
|
|
script = ./boetlingk.sh;
|
|
|
|
|
packages = [ pkgs.curl pkgs.gnused pkgs.pandoc pkgs.man ];
|
|
|
|
|
};
|
|
|
|
|
|
2021-01-26 23:01:31 +01:00
|
|
|
playlist = wrapScript {
|
|
|
|
|
name = "pls";
|
|
|
|
|
script = ./playlist.sh;
|
|
|
|
|
packages = [ pkgs.curl pkgs.jq ];
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
favicon = wrapScript {
|
|
|
|
|
packages = [ pkgs.imagemagick ];
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "favicon";
|
2020-04-15 00:10:30 +02:00
|
|
|
script = ./favicon.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
genius = wrapScript {
|
|
|
|
|
packages = [ pkgs.curl pkgs.gnused pkgs.pandoc ];
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "genius";
|
2020-04-15 00:10:30 +02:00
|
|
|
script = ./genius.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
literature-quote = wrapScript {
|
|
|
|
|
packages = [ pkgs.xsv pkgs.curl pkgs.gnused ];
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "literature-quote";
|
2020-04-15 00:10:30 +02:00
|
|
|
script = ./literature-quote.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
man-pdf = wrapScript {
|
|
|
|
|
packages = [ pkgs.man pkgs.ghostscript ];
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "man-pdf";
|
2020-04-15 00:10:30 +02:00
|
|
|
script = ./man-pdf.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
odyssey = wrapScript {
|
|
|
|
|
packages = [ pkgs.curl pkgs.xmlstarlet ];
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "odyssey";
|
2020-04-15 00:10:30 +02:00
|
|
|
script = ./odyssey.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
tolino-screensaver = wrapScript {
|
|
|
|
|
packages = [ pkgs.imagemagick ];
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "tolino-screensaver";
|
2020-04-15 00:10:30 +02:00
|
|
|
script = ./tolino-screensaver.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
wttr = wrapScript {
|
|
|
|
|
packages = [ pkgs.curl ];
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "wttr";
|
2020-04-15 00:10:30 +02:00
|
|
|
script = ./wttr.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
vg = wrapScript {
|
|
|
|
|
packages = [ pkgs.ripgrep pkgs.fzf pkgs.gawk ];
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "vg";
|
2020-04-15 00:10:30 +02:00
|
|
|
script = ./vg.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
};
|
|
|
|
|
|
2020-09-09 09:35:50 +02:00
|
|
|
dmenurandr = wrapScript {
|
|
|
|
|
packages = [ pkgs.dmenu pkgs.gnugrep pkgs.gnused pkgs.xorg.xrandr pkgs.gawk pkgs.libnotify pkgs.arandr ];
|
|
|
|
|
name = "dmenurandr";
|
|
|
|
|
script = ./dmenurandr.sh;
|
|
|
|
|
};
|
|
|
|
|
|
2020-09-14 18:25:51 +02:00
|
|
|
dmenubluetooth = wrapScript {
|
|
|
|
|
packages = [ pkgs.bluez5 pkgs.dmenu pkgs.libnotify ];
|
|
|
|
|
name = "dmenubluetooth";
|
|
|
|
|
script = ./dmenubluetooth.sh;
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
fkill = wrapScript {
|
|
|
|
|
packages = [ pkgs.procps pkgs.gawk pkgs.gnused pkgs.fzf pkgs.bash ];
|
|
|
|
|
script = ./fkill.sh;
|
2020-04-09 16:56:47 +02:00
|
|
|
name = "fkill";
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
nix-git = wrapScript {
|
|
|
|
|
packages = [ pkgs.nix-prefetch-git pkgs.jq ];
|
|
|
|
|
script = ./nix-git.sh;
|
2020-04-09 18:15:41 +02:00
|
|
|
name = "nix-git";
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-15 20:39:37 +02:00
|
|
|
linkhandler = wrapScript {
|
2020-06-10 17:37:25 +02:00
|
|
|
packages =
|
|
|
|
|
[ pkgs.utillinux pkgs.mpv pkgs.curl pkgs.gnused pkgs.sxiv pkgs.ts ];
|
2020-04-15 20:39:37 +02:00
|
|
|
script = "${voidrice}/.local/bin/linkhandler";
|
|
|
|
|
name = "linkhandler";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
mansplain = wrapScript {
|
|
|
|
|
packages = [ pkgs.man pkgs.zathura pkgs.dmenu pkgs.gnused ];
|
|
|
|
|
script = ./mansplain.sh;
|
|
|
|
|
name = "mansplain";
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
notetags = wrapScript {
|
|
|
|
|
script = ./notetags.sh;
|
2020-04-09 19:30:35 +02:00
|
|
|
name = "notetags";
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-15 00:10:30 +02:00
|
|
|
fzfmenu = wrapScript {
|
|
|
|
|
script = ./fzfmenu.sh;
|
2020-04-10 14:53:16 +02:00
|
|
|
name = "fzfmenu";
|
2020-04-15 14:58:23 +02:00
|
|
|
packages = [ pkgs.st pkgs.fzf pkgs.dash pkgs.bash ];
|
2020-04-10 14:53:16 +02:00
|
|
|
};
|
|
|
|
|
|
2020-06-22 08:44:09 +02:00
|
|
|
swallow = wrapScript {
|
|
|
|
|
script = ./swallow.sh;
|
|
|
|
|
name = "swallow";
|
|
|
|
|
packages = [ pkgs.xdo ];
|
|
|
|
|
};
|
|
|
|
|
|
2020-05-15 08:04:18 +02:00
|
|
|
ipa = wrapScript {
|
|
|
|
|
script = ./ipa.py;
|
|
|
|
|
name = "ipa";
|
|
|
|
|
packages = [ pkgs.python3 ];
|
|
|
|
|
};
|
|
|
|
|
|
2020-08-26 11:32:53 +02:00
|
|
|
default-gateway = pkgs.writers.writeDashBin "default-gateway" ''
|
|
|
|
|
${pkgs.iproute}/bin/ip -json route | ${pkgs.jq}/bin/jq --raw-output '.[0].gateway'
|
|
|
|
|
'';
|
|
|
|
|
|
2020-06-22 08:44:09 +02:00
|
|
|
betacode = pkgs.writers.writePython3Bin "betacode" {
|
|
|
|
|
libraries = [ pkgs.nur.repos.kmein.python3Packages.betacode ];
|
|
|
|
|
} ''
|
|
|
|
|
import betacode.conv
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
sys.stdout.write(betacode.conv.beta_to_uni(sys.stdin.read()))
|
|
|
|
|
'';
|
|
|
|
|
|
2020-12-16 22:25:04 +01:00
|
|
|
devanagari = pkgs.writers.writePython3Bin "devanagari" {
|
|
|
|
|
libraries = [ pkgs.nur.repos.kmein.python3Packages.indic-transliteration ];
|
|
|
|
|
} ''
|
|
|
|
|
from indic_transliteration import sanscript
|
|
|
|
|
from indic_transliteration.sanscript import transliterate
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
# Harvard Kyoto -> Devanagari
|
|
|
|
|
sys.stdout.write(transliterate(
|
|
|
|
|
sys.stdin.read(),
|
|
|
|
|
sanscript.HK,
|
|
|
|
|
sanscript.DEVANAGARI
|
|
|
|
|
))
|
|
|
|
|
'';
|
|
|
|
|
|
2020-07-11 20:43:19 +02:00
|
|
|
manual-sort = pkgs.writers.writeHaskellBin "manual-sort" {} ''
|
|
|
|
|
{-# LANGUAGE LambdaCase #-}
|
|
|
|
|
import Data.Char (toLower)
|
|
|
|
|
import System.Environment (getArgs)
|
|
|
|
|
import System.IO (BufferMode(NoBuffering), hSetBuffering, stdout)
|
|
|
|
|
|
|
|
|
|
insertionSortM :: Monad f => (a -> a -> f Ordering) -> [a] -> f [a]
|
|
|
|
|
insertionSortM cmp = foldr ((=<<) . insertByM cmp) (pure [])
|
|
|
|
|
where
|
|
|
|
|
insertByM cmp x = \case
|
|
|
|
|
[] -> pure [x]
|
|
|
|
|
yys@(y : ys) -> cmp x y >>= \case
|
|
|
|
|
GT -> (y :) <$> insertByM cmp x ys
|
|
|
|
|
_ -> pure (x : yys)
|
|
|
|
|
|
|
|
|
|
ask :: Show a => a -> a -> IO Ordering
|
|
|
|
|
ask a b = do
|
|
|
|
|
putStr (show a ++ " > " ++ show b ++ "? (y/n) ")
|
|
|
|
|
map toLower <$> getLine >>= \case
|
|
|
|
|
'y' : _ -> return GT
|
|
|
|
|
_ -> return LT
|
|
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
|
main = do
|
|
|
|
|
hSetBuffering stdout NoBuffering
|
|
|
|
|
argv <- getArgs
|
|
|
|
|
sorted <- insertionSortM ask argv
|
|
|
|
|
mapM_ (\(place, thing) -> putStrLn (show place ++ ". " ++ show thing)) $ zip [1 ..] (reverse sorted)
|
|
|
|
|
'';
|
|
|
|
|
|
2020-05-24 10:08:13 +02:00
|
|
|
scrot-dmenu = wrapScript {
|
|
|
|
|
script = ./scrot-dmenu.sh;
|
|
|
|
|
name = "dmenu-scrot";
|
|
|
|
|
packages = [ pkgs.xclip pkgs.scrot kpaste pkgs.libnotify pkgs.dmenu ];
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-04 18:54:48 +01:00
|
|
|
unicodmenu = pkgs.callPackage ./unicodmenu.nix { };
|
|
|
|
|
|
|
|
|
|
|
2020-06-10 17:37:25 +02:00
|
|
|
bvg = pkgs.callPackage ./bvg.nix { };
|
|
|
|
|
nav = pkgs.callPackage ./nav.nix { };
|
2020-12-13 20:08:26 +01:00
|
|
|
k-lock = pkgs.callPackage ./k-lock.nix { };
|
2019-11-09 16:33:59 +01:00
|
|
|
}
|