2019-10-24 02:20:38 +02:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
unstablePkgs = import <nixpkgs-unstable> { };
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
library = import <library> { inherit pkgs lib; };
|
|
|
|
|
2020-03-13 05:01:10 +01:00
|
|
|
allLicenses = let
|
|
|
|
licenses = builtins.map
|
|
|
|
(license: "echo '${license.shortName} : ${license.fullName}'")
|
|
|
|
(builtins.attrValues pkgs.stdenv.lib.licenses);
|
|
|
|
in pkgs.writers.writeBashBin "all-licenses"
|
|
|
|
(lib.concatStringsSep "\n" licenses);
|
|
|
|
|
2021-03-15 08:28:27 +01:00
|
|
|
#joplin = pkgs.joplin-desktop;
|
|
|
|
#joplin = pkgs.joplin-desktop;
|
|
|
|
joplin = pkgs.writers.writeBashBin "joplin" ''
|
|
|
|
if [[ ! -x "$HOME/programs/Joplin.AppImage" ]]
|
|
|
|
then
|
|
|
|
echo "$HOME/programs/Joplin.AppImage does not exist or is not executable";
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
exec ${pkgs.appimage-run}/bin/appimage-run "$HOME/programs/Joplin.AppImage"
|
|
|
|
'';
|
|
|
|
|
2021-03-05 16:01:24 +01:00
|
|
|
zettlr = pkgs.writers.writeBashBin "zettlr" ''
|
|
|
|
if [[ ! -x "$HOME/programs/Zettlr.AppImage" ]]
|
|
|
|
then
|
|
|
|
echo "$HOME/programs/Zettlr.AppImage does not exist or is not executable";
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
exec ${pkgs.appimage-run}/bin/appimage-run "$HOME/programs/Zettlr.AppImage"
|
|
|
|
'';
|
|
|
|
#zettlr = unstablePkgs.zettlr;
|
2021-02-18 04:22:38 +01:00
|
|
|
|
2021-02-20 19:56:32 +01:00
|
|
|
parseUrl = pkgs.writeBashBin "parseUrl" ''
|
|
|
|
echo "$@" | \
|
|
|
|
${pkgs.jq}/bin/jq --raw-input --raw-output '
|
|
|
|
def parseURL: capture( "^((?<scheme>[^:/?#]+):)?(//(?<authority>(?<domain>[^/?#:]*)(:(?<port>[0-9]*))?))?((?<path>[^?#]*)\\?)?((?<query>([^#]*)))?(#(?<fragment>(.*)))?");
|
|
|
|
parseURL
|
|
|
|
'
|
|
|
|
'';
|
|
|
|
|
|
|
|
parseAndCopyLink = pkgs.writeBashBin "parseAndCopyLink" ''
|
|
|
|
${parseUrl}/bin/parseUrl "$@" | \
|
|
|
|
${pkgs.jq}/bin/jq --raw-output '"\(.scheme)://\(.domain)\(.path)"' | \
|
|
|
|
${pkgs.xclip}/bin/xclip
|
|
|
|
'';
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
replaceLinks = pkgs.writers.writeBashBin "replace-link-with-content" # sh
|
|
|
|
''
|
|
|
|
if [ ! -L "$1" ]
|
|
|
|
then
|
|
|
|
echo "$1 does not exist or is not a file"
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
cp -rL "$1" "$1.backup"
|
|
|
|
unlink "$1"
|
|
|
|
mv "$1.backup" "$1"
|
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
pandocScript = inputFormat: outputFormat:
|
|
|
|
pkgs.writers.writeDashBin "pandoc-from-${inputFormat}-to-${outputFormat}" ''
|
|
|
|
${pkgs.pandoc}/bin/pandoc \
|
|
|
|
--from ${inputFormat} \
|
|
|
|
--to ${outputFormat} \
|
|
|
|
--standalone \
|
|
|
|
"$@"
|
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
connectToSpeaker = name: id:
|
|
|
|
pkgs.writeShellScriptBin "connect-to-speaker-${name}" # sh
|
|
|
|
''
|
|
|
|
# hacky script because I have problems with
|
|
|
|
# automatically connecting to trusted bluetooth devices.
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
echo "Connect to Speaker ${name}"
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
bluetoothctl <<EOF
|
|
|
|
power on
|
|
|
|
agent on
|
|
|
|
scan on
|
|
|
|
connect ${id}
|
|
|
|
EOF
|
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
disconnectToSpeaker = name: id:
|
|
|
|
pkgs.writeShellScriptBin "disconnect-from-speaker-${name}" # sh
|
|
|
|
''
|
|
|
|
# hacky script because I have problems with
|
|
|
|
# automatically connecting to trusted bluetooth devices.
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
echo "Disconnect from Speaker ${name}"
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
bluetoothctl <<EOF
|
|
|
|
disconnect ${id}
|
|
|
|
scan off
|
|
|
|
agent off
|
|
|
|
power off
|
|
|
|
EOF
|
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
borrow = pkgs.writers.writeDashBin "borrow" # sh
|
|
|
|
''
|
2021-04-22 08:15:55 +02:00
|
|
|
TERM=xterm-mono ${pkgs.hledger-ui}/bin/hledger-ui --file ~/finance/.hledger-borrow "$@"
|
2019-12-20 05:54:26 +01:00
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2021-04-22 08:32:14 +02:00
|
|
|
bank-report = pkgs.writers.writeDashBin "bank-report" # sh
|
|
|
|
''
|
|
|
|
${pkgs.hledger}/bin/hledger --file ~/finance/hledger/all.journal balance -M -B date:$(date +%Y-%m -d 'last year')..
|
|
|
|
${pkgs.hledger}/bin/hledger --file ~/finance/hledger/all.journal balance -M -B date:$(date +%Y-%m -d 'last year').. --depth 1
|
|
|
|
'';
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
bank = pkgs.writers.writeDashBin "bank" # sh
|
|
|
|
''
|
2021-04-22 08:15:55 +02:00
|
|
|
${pkgs.hledger-ui}/bin/hledger-ui --file ~/finance/hledger/all.journal
|
2021-04-18 09:45:49 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
bank-old = year:
|
|
|
|
pkgs.writers.writeDashBin "bank-${year}" # sh
|
|
|
|
''
|
|
|
|
TERM=xterm-mono ${pkgs.hledger-ui}/bin/hledger-ui --file ~/finance/hledger/${year}.journal "$@"
|
2019-12-20 05:54:26 +01:00
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
irc = pkgs.writers.writeDashBin "irc" # sh
|
|
|
|
''
|
|
|
|
${pkgs.mosh}/bin/mosh workhorse.private -- sudo -u weechat -- screen -rd
|
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
insertCopyq = pkgs.writers.writeDashBin "insertCopyq" # sh
|
|
|
|
''
|
|
|
|
${pkgs.copyq}/bin/copyq read 0 | ${pkgs.xdotool}/bin/xdotool type -f -
|
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
|
|
|
weight = pkgs.writeShellScriptBin "weight" ''
|
|
|
|
if [[ $# -eq 1 ]]
|
|
|
|
then
|
|
|
|
weight=$1
|
|
|
|
echo "weight : $weight"
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
echo -n " weight : "
|
|
|
|
read weight
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
${pkgs.curl}/bin/curl \
|
|
|
|
-H "Content-Type: application/json" \
|
|
|
|
-XPOST "http://workout.private:9200/health/weight" \
|
|
|
|
-d '{ "weight" : '$weight', "date": "'$( ${pkgs.coreutils}/bin/date -Iseconds )'" }'
|
2019-12-20 05:54:26 +01:00
|
|
|
'';
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2021-04-19 07:43:55 +02:00
|
|
|
isoToUtf8 = pkgs.writers.writeBashBin "iso-to-utf8" ''
|
|
|
|
input="$1"
|
|
|
|
TMP=$(mktemp)
|
|
|
|
|
|
|
|
${pkgs.glibc.bin}/bin/iconv -f ISO-8859-1 "$input" -t UTF-8 -o "$TMP"
|
|
|
|
mv "$TMP" "$input"
|
|
|
|
'';
|
|
|
|
|
2019-10-24 02:20:38 +02:00
|
|
|
in {
|
|
|
|
|
2021-03-05 16:01:24 +01:00
|
|
|
# ffmpeg scripts to encode movies
|
2019-10-24 02:20:38 +02:00
|
|
|
programs.custom.ffmpeg.enable = true;
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
# gnupg setup
|
2019-10-24 02:20:38 +02:00
|
|
|
programs.gnupg.agent.enable = true;
|
|
|
|
programs.gnupg.agent.enableSSHSupport = true;
|
|
|
|
programs.gnupg.agent.enableExtraSocket = true;
|
|
|
|
|
|
|
|
environment.systemPackages = with pkgs;
|
2019-12-20 05:54:26 +01:00
|
|
|
let
|
|
|
|
connectToMyPortable = connectToSpeaker "my-portable" "37:F0:17:2F:B6:84";
|
|
|
|
disconnectToMyPortable =
|
|
|
|
disconnectToSpeaker "my-portable" "37:F0:17:2F:B6:84";
|
|
|
|
connectToBrullrohre = connectToSpeaker "brullrohre" "FC:A8:9A:ED:B8:FA";
|
|
|
|
disconnectToBrullrohre =
|
|
|
|
disconnectToSpeaker "brullrohre" "FC:A8:9A:ED:B8:FA";
|
|
|
|
in [
|
|
|
|
|
2021-04-17 16:44:08 +02:00
|
|
|
uget
|
|
|
|
#zettlr
|
|
|
|
#(library.desktopFile zettlr { longName = "Zettlr"; })
|
2021-03-15 08:28:27 +01:00
|
|
|
joplin
|
|
|
|
(library.desktopFile joplin { longName = "Joplin"; })
|
2021-03-10 19:27:43 +01:00
|
|
|
zim
|
2020-03-29 05:26:19 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
weight
|
|
|
|
|
|
|
|
connectToMyPortable
|
|
|
|
(library.desktopFile connectToMyPortable { longName = "Bluetooth"; })
|
|
|
|
disconnectToMyPortable
|
|
|
|
(library.desktopFile disconnectToMyPortable { longName = "Bluetooth"; })
|
|
|
|
connectToBrullrohre
|
|
|
|
(library.desktopFile connectToBrullrohre { longName = "Bluetooth"; })
|
|
|
|
disconnectToBrullrohre
|
|
|
|
(library.desktopFile disconnectToBrullrohre { longName = "Bluetooth"; })
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
#antimony
|
|
|
|
#(library.desktopFile antimony { longName = "CAD Software"; command = "antimony"; })
|
2020-01-24 08:42:02 +01:00
|
|
|
parted
|
2019-12-20 05:54:26 +01:00
|
|
|
|
|
|
|
insertCopyq
|
|
|
|
(library.desktopFile insertCopyq {
|
|
|
|
longName = "type what is on top of the copyq";
|
|
|
|
command = "insertCopyq";
|
|
|
|
})
|
|
|
|
|
2021-04-19 07:43:55 +02:00
|
|
|
isoToUtf8
|
|
|
|
hledger
|
|
|
|
hledger-ui
|
2021-04-22 08:15:55 +02:00
|
|
|
|
|
|
|
borrow
|
2019-12-20 05:54:26 +01:00
|
|
|
bank
|
2021-04-22 08:32:14 +02:00
|
|
|
bank-report
|
2021-04-18 09:45:49 +02:00
|
|
|
(bank-old "2021")
|
|
|
|
(bank-old "2020")
|
2019-10-24 02:20:38 +02:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
irc
|
|
|
|
|
|
|
|
manpages
|
|
|
|
|
|
|
|
emo
|
|
|
|
(library.desktopFile emo {
|
|
|
|
longName = "Emoji Inserter";
|
|
|
|
command = "emoticons";
|
|
|
|
})
|
2019-10-29 16:26:53 +01:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
bat
|
2019-10-29 16:26:53 +01:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
zlib # ???
|
|
|
|
cabal-install
|
|
|
|
ghc
|
|
|
|
cabal2nix
|
|
|
|
|
|
|
|
psmisc # contains killall
|
|
|
|
pmount
|
|
|
|
nix-prefetch-scripts
|
|
|
|
ipcalc
|
|
|
|
nmap
|
|
|
|
|
|
|
|
libreoffice
|
|
|
|
hunspell
|
|
|
|
hunspellDicts.de-de
|
|
|
|
hunspellDicts.en-us
|
|
|
|
aspell
|
|
|
|
aspellDicts.de
|
|
|
|
aspellDicts.en
|
|
|
|
aspellDicts.es
|
|
|
|
translate-shell
|
|
|
|
|
2020-09-04 00:49:35 +02:00
|
|
|
borgbackup
|
2019-12-20 05:54:26 +01:00
|
|
|
gpa
|
|
|
|
gnupg
|
|
|
|
|
|
|
|
sshuttle
|
|
|
|
sshfs
|
|
|
|
mosh
|
|
|
|
|
|
|
|
dosfstools
|
|
|
|
copyq
|
|
|
|
|
2020-03-22 17:16:17 +01:00
|
|
|
# radio-dj
|
2019-12-20 05:54:26 +01:00
|
|
|
|
|
|
|
cups
|
|
|
|
xfe # filemanager
|
|
|
|
evince
|
|
|
|
sxiv
|
|
|
|
(library.desktopFile sxiv {
|
|
|
|
longName = "Image Viewer";
|
|
|
|
command = "sxiv";
|
|
|
|
})
|
|
|
|
|
|
|
|
calibre
|
|
|
|
|
|
|
|
transmission-remote-gtk
|
|
|
|
mpv
|
2020-03-22 17:16:17 +01:00
|
|
|
# cantata
|
2019-12-20 05:54:26 +01:00
|
|
|
ncmpcpp
|
|
|
|
|
2020-03-23 20:13:36 +01:00
|
|
|
(pkgs.dragon-drop.overrideAttrs (old: rec {
|
|
|
|
pname = "dragon-drop";
|
|
|
|
version = "1.1.1";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mwh";
|
|
|
|
repo = "dragon";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0fgzz39007fdjwq72scp0qygp2v3zc5f1xkm0sxaa8zxm25g1bra";
|
|
|
|
};
|
|
|
|
}))
|
|
|
|
|
2020-09-21 23:03:55 +02:00
|
|
|
dino # jabber client
|
2020-03-22 17:16:17 +01:00
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
nixos-generators
|
|
|
|
shellcheck
|
|
|
|
|
|
|
|
bind.dnsutils
|
|
|
|
|
|
|
|
hexyl
|
|
|
|
testssl
|
|
|
|
|
|
|
|
trash-cli
|
|
|
|
|
|
|
|
nix-review
|
2019-12-23 10:17:01 +01:00
|
|
|
units
|
2019-12-20 05:54:26 +01:00
|
|
|
|
|
|
|
(writeShellScriptBin "ingdiba-security" ''
|
|
|
|
first=$1
|
|
|
|
second=$2
|
|
|
|
|
|
|
|
if [[ $# -ne 2 ]]
|
|
|
|
then
|
|
|
|
echo "need 2 arguments"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
pass bank/ingdiba/security_key | cut -c$first,$second
|
|
|
|
'')
|
|
|
|
|
|
|
|
(writeShellScriptBin "ingdiba-tans" ''
|
|
|
|
first=$1
|
|
|
|
|
|
|
|
if [[ $# -ne 1 ]]
|
|
|
|
then
|
|
|
|
echo "need 1 arguments"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
pass bank/ingdiba/tans-01 | cut -f$first -d '
|
|
|
|
'
|
|
|
|
'')
|
|
|
|
|
2020-03-28 11:50:50 +01:00
|
|
|
nix-index
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
nethogs
|
|
|
|
netsniff-ng
|
|
|
|
iftop
|
|
|
|
wireguard
|
|
|
|
|
2020-01-23 21:32:58 +01:00
|
|
|
ffmpeg
|
2019-12-20 05:54:26 +01:00
|
|
|
(writeShellScriptBin "shrink-exports"
|
|
|
|
(fileContents <assets/shrink_exports>))
|
2020-02-23 04:02:24 +01:00
|
|
|
(writeShellScriptBin "music-making"
|
|
|
|
(fileContents <assets/music-making.sh>))
|
2019-12-20 05:54:26 +01:00
|
|
|
|
|
|
|
replaceLinks
|
|
|
|
|
2020-02-14 19:06:43 +01:00
|
|
|
image-generator
|
2020-09-28 06:52:27 +02:00
|
|
|
cairo
|
2019-12-20 05:54:26 +01:00
|
|
|
|
2020-01-28 11:44:11 +01:00
|
|
|
w3m
|
|
|
|
links
|
|
|
|
lynx
|
|
|
|
|
2020-01-29 03:00:12 +01:00
|
|
|
# temperature
|
|
|
|
s-tui
|
|
|
|
(pkgs.writers.writeDashBin "temperature" ''
|
|
|
|
${pkgs.s-tui}/bin/s-tui
|
|
|
|
'')
|
|
|
|
powertop
|
|
|
|
|
2020-01-31 03:15:48 +01:00
|
|
|
(pkgs.writers.writeBashBin "youtube-download-music" ''
|
|
|
|
${pkgs.youtube-dl}/bin/youtube-dl \
|
|
|
|
--extract-audio \
|
|
|
|
--audio-format vorbis \
|
|
|
|
--audio-quality 0 \
|
|
|
|
"$@"
|
|
|
|
'')
|
|
|
|
|
2020-03-13 05:01:10 +01:00
|
|
|
allLicenses
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
memo
|
|
|
|
nixfmt
|
2020-01-28 06:35:21 +01:00
|
|
|
dateutils
|
2021-02-20 19:56:32 +01:00
|
|
|
parseUrl
|
|
|
|
parseAndCopyLink
|
2019-10-29 16:26:53 +01:00
|
|
|
|
2020-10-08 21:09:35 +02:00
|
|
|
# needed for pycairo (in venv)
|
|
|
|
pkgconf
|
|
|
|
cairo
|
|
|
|
|
2019-12-20 05:54:26 +01:00
|
|
|
# etc-info stuff
|
|
|
|
(pkgs.writers.writeDashBin "etc-info-sync" (lib.concatStringsSep "\n"
|
|
|
|
(map (host: "rsync -avLz ${host}.private:/etc/info/ ~/.etc_info")
|
|
|
|
(attrNames config.module.cluster.services.tinc."private".hosts))))
|
|
|
|
|
|
|
|
] ++ (lib.crossLists pandocScript [
|
2020-01-06 09:11:31 +01:00
|
|
|
[ "man" "markdown" "mediawiki" ]
|
2019-12-20 05:54:26 +01:00
|
|
|
[ "mediawiki" "docbook5" "html5" "man" ]
|
2020-03-23 20:13:36 +01:00
|
|
|
]) # ++ (map (search:
|
|
|
|
#pkgs.writers.writeDashBin "reddit-${search}" ''
|
|
|
|
# ${unstablePkgs.tuir}/bin/tuir -s ${search} "$@"
|
|
|
|
#'') [ "nixos" "systemdUltras" "terraform" ])
|
|
|
|
;
|
2019-10-24 02:20:38 +02:00
|
|
|
}
|