{ pkgs, config, lib, ... }: with lib; let unstablePkgs = import { }; library = import { inherit pkgs lib; }; 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); 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; parseUrl = pkgs.writeBashBin "parseUrl" '' echo "$@" | \ ${pkgs.jq}/bin/jq --raw-input --raw-output ' def parseURL: capture( "^((?[^:/?#]+):)?(//(?(?[^/?#:]*)(:(?[0-9]*))?))?((?[^?#]*)\\?)?((?([^#]*)))?(#(?(.*)))?"); parseURL ' ''; parseAndCopyLink = pkgs.writeBashBin "parseAndCopyLink" '' ${parseUrl}/bin/parseUrl "$@" | \ ${pkgs.jq}/bin/jq --raw-output '"\(.scheme)://\(.domain)\(.path)"' | \ ${pkgs.xclip}/bin/xclip ''; 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 \ "$@" ''; 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 )) replaceLinks image-generator cairo 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 \ "$@" '') allLicenses memo nixfmt dateutils parseUrl parseAndCopyLink # needed for pycairo (in venv) pkgconf cairo # 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 [ [ "man" "markdown" "mediawiki" ] [ "mediawiki" "docbook5" "html5" "man" ] ]) # ++ (map (search: #pkgs.writers.writeDashBin "reddit-${search}" '' # ${unstablePkgs.tuir}/bin/tuir -s ${search} "$@" #'') [ "nixos" "systemdUltras" "terraform" ]) ; }