nixos-config/nixos/modules/programs/curl-scripts.nix
2021-11-01 09:20:42 +01:00

32 lines
651 B
Nix

{ config, pkgs, lib, ... }:
with lib;
let
weatherScript = pkgs.writeShellScriptBin "weather" ''
${pkgs.curl}/bin/curl wttr.in/Berlin
'';
qrCodeScript = pkgs.writeShellScriptBin "qrCode" ''
${pkgs.qrencode}/bin/qrencode -t ANSI -o - "$@"
'';
cheatSheetScript = pkgs.writeShellScriptBin "cheatsheet" ''
${pkgs.curl}/bin/curl "cheat.sh/$1"
'';
cfg = config.programs.custom.curlScripts;
in
{
options.programs.custom.curlScripts.enable =
mkEnableOption "enable curl scripts";
config = mkIf cfg.enable {
environment.systemPackages =
[ weatherScript qrCodeScript cheatSheetScript pkgs.qrencode ];
};
}