{ config, lib, pkgs, ... }: with lib; let cfg = config.programs.custom.citate; library = import { inherit pkgs lib; }; xdotool = "${pkgs.xdotool}/bin/xdotool"; dmenu = "${pkgs.dmenu}/bin/dmenu"; citateScript = file: suffix: pkgs.writeShellScriptBin "citate-${suffix}" '' ${xdotool} - <<<"type -- $( cat ${file} | ${dmenu} -l 10 -i | sed -e "s/\(.*\)/'\1'/" )" ''; scriptAxel = citateScript (toString ) "axel"; scriptSiw = citateScript (toString ) "siw"; in { options.programs.custom.citate = { enable = mkEnableOption "enable programs.custom.citate"; }; config = mkIf cfg.enable { environment.systemPackages = [ scriptAxel (library.desktopFile scriptAxel { longName = "Citate Axel"; command = "citate-axel"; }) scriptSiw (library.desktopFile scriptSiw { longName = "Citate Sinnlos im Weltall"; command = "citate-siw"; }) ]; }; }