nixos-config/system/desktop/packages.nix

312 lines
7 KiB
Nix
Raw Normal View History

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; };
#seafileClient = unstablePkgs.seafile-client.override{
# seafile-shared = unstablePkgs.seafile-shared;
#};
2019-12-20 05:54:26 +01:00
seafileClient =
pkgs.seafile-client.override { seafile-shared = pkgs.seafile-shared; };
2019-10-24 02:20:38 +02:00
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
# show keyboard input on desktop for screencasts
screenKey = pkgs.symlinkJoin {
name = "screen-keys";
2019-12-20 05:54:26 +01:00
paths = let
screenKeyScript = { position ? "bottom", size ? "small", ... }:
pkgs.writeShellScriptBin "screenkeys-${position}-${size}" # sh
''
${pkgs.screenkey}/bin/screenkey \
--no-detach \
--bg-color '#fdf6e3' \
--font-color '#073642' \
-p ${position} \
-s ${size} \
"$@"
'';
in lib.flatten (lib.flip map [ "large" "small" "medium" ] (size:
lib.flip map [ "top" "center" "bottom" ]
(position: screenKeyScript { inherit size position; })));
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
''
${pkgs.hledger-ui}/bin/hledger-ui -f ~/finance/hledger-borrow "$@"
'';
2019-10-24 02:20:38 +02:00
2019-12-20 05:54:26 +01:00
bank = pkgs.writers.writeDashBin "bank" # sh
''
${pkgs.hledger-ui}/bin/hledger-ui -f ~/finance/hledger-bank "$@"
'';
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
in {
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 [
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";
})
bank
borrow
2019-10-24 02:20:38 +02:00
2019-12-20 05:54:26 +01:00
seafileClient
irc
2020-01-23 21:32:58 +01:00
#fzf
#rofi
#dmenu
2019-10-28 17:54:53 +01:00
2019-12-20 05:54:26 +01:00
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
terranix
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
restic
gpa
gnupg
sshuttle
sshfs
mosh
dosfstools
copyq
radio-dj
cups
xfe # filemanager
evince
sxiv
(library.desktopFile sxiv {
longName = "Image Viewer";
command = "sxiv";
})
calibre
transmission-remote-gtk
mpv
cantata
ncmpcpp
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 '
'
'')
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>))
screenKey
replaceLinks
haskellPackages.image-generator
memo
nixfmt
2019-10-29 16:26:53 +01:00
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))))
(pkgs.writers.writeBashBin "etc-info-restic"
(lib.fileContents <assets/etc-info/restic.sh>))
2019-10-29 16:26:53 +01:00
2019-12-20 05:54:26 +01:00
] ++ (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" ]
]);
2019-10-24 02:20:38 +02:00
}