nixos-config/modules/programs/curl-scripts.nix

32 lines
651 B
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ config, pkgs, lib, ... }:
with lib;
let
weatherScript = pkgs.writeShellScriptBin "weather" ''
${pkgs.curl}/bin/curl wttr.in/Berlin
'';
qrCodeScript = pkgs.writeShellScriptBin "qrCode" ''
2021-05-18 08:46:24 +02:00
${pkgs.qrencode}/bin/qrencode -t ANSI -o - "$@"
2019-10-24 02:20:38 +02:00
'';
2019-12-20 05:54:26 +01:00
cheatSheetScript = pkgs.writeShellScriptBin "cheatsheet" ''
2019-10-24 02:20:38 +02:00
${pkgs.curl}/bin/curl "cheat.sh/$1"
'';
cfg = config.programs.custom.curlScripts;
in {
2019-12-20 05:54:26 +01:00
options.programs.custom.curlScripts.enable =
mkEnableOption "enable curl scripts";
2019-10-24 02:20:38 +02:00
config = mkIf cfg.enable {
2019-12-20 05:54:26 +01:00
environment.systemPackages =
2021-05-18 08:46:24 +02:00
[ weatherScript qrCodeScript cheatSheetScript pkgs.qrencode ];
2019-10-24 02:20:38 +02:00
};
}