2024-04-25 12:00:00 +00:00
|
|
|
{ pkgs, lib, config, ... }:
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
scripts.output = lib.mkOption {
|
|
|
|
type = lib.types.package;
|
|
|
|
};
|
|
|
|
|
2024-04-26 05:40:24 +00:00
|
|
|
map = {
|
|
|
|
zoom = lib.mkOption {
|
|
|
|
type = lib.types.nullOr lib.types.int;
|
|
|
|
default = 2;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-04-25 12:00:00 +00:00
|
|
|
requestParams = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
scripts.output = pkgs.writeShellApplication {
|
|
|
|
name = "map";
|
2024-04-26 05:40:24 +00:00
|
|
|
|
2024-04-25 12:00:00 +00:00
|
|
|
runtimeInputs = with pkgs; [
|
|
|
|
curl
|
|
|
|
imagemagick
|
|
|
|
];
|
|
|
|
|
|
|
|
text = ''
|
|
|
|
convert <(${./map} ${lib.concatStringsSep " " config.requestParams}) sixel:-
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
requestParams = [
|
|
|
|
"size=640x300"
|
|
|
|
"scale=2"
|
2024-04-26 05:40:24 +00:00
|
|
|
(lib.mkIf (config.map.zoom != null)
|
|
|
|
"zoom=${toString config.map.zoom}")
|
2024-04-25 12:00:00 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|