{ pkgs, config, lib, ... }: with lib; let unstablePkgs = import { }; library = import { inherit pkgs lib; }; #seafileClient = unstablePkgs.seafile-client.override{ # seafile-shared = unstablePkgs.seafile-shared; #}; seafileClient = pkgs.seafile-client.override { seafile-shared = pkgs.seafile-shared; }; 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 cp -rL "$1" "$1.backup" unlink "$1" mv "$1.backup" "$1" ''; pandocScript = inputFormat: outputFormat: pkgs.writers.writeDashBin "pandoc-from-${inputFormat}-to-${outputFormat}" '' ${pkgs.pandoc}/bin/pandoc \ --from ${inputFormat} \ --to ${outputFormat} \ --standalone \ "$@" ''; # show keyboard input on desktop for screencasts screenKey = pkgs.symlinkJoin { name = "screen-keys"; 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; }))); }; connectToSpeaker = name: id: pkgs.writeShellScriptBin "connect-to-speaker-${name}" # sh '' # hacky script because I have problems with # automatically connecting to trusted bluetooth devices. echo "Connect to Speaker ${name}" bluetoothctl <)) (writeShellScriptBin "music-making" (fileContents )) screenKey replaceLinks image-generator w3m links lynx # temperature s-tui (pkgs.writers.writeDashBin "temperature" '' ${pkgs.s-tui}/bin/s-tui '') powertop (pkgs.writers.writeBashBin "youtube-download-music" '' ${pkgs.youtube-dl}/bin/youtube-dl \ --extract-audio \ --audio-format vorbis \ --audio-quality 0 \ "$@" '') memo nixfmt dateutils # 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 )) (pkgs.writers.writeDashBin "reddit" '' ${unstablePkgs.tuir}/bin/tuir "$@" '') ] ++ (lib.crossLists pandocScript [ [ "man" "markdown" "mediawiki" ] [ "mediawiki" "docbook5" "html5" "man" ] ]) ++ (map (search: pkgs.writers.writeDashBin "reddit-${search}" '' ${unstablePkgs.tuir}/bin/tuir -s ${search} "$@" '') [ "nixos" "systemdUltras" "terraform" ]); }