nixos-config/nixos/modules/programs/citate.nix

43 lines
1,020 B
Nix
Raw Normal View History

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