42 lines
869 B
Nix
42 lines
869 B
Nix
{ pkgs, lib, config, ... }: {
|
|
|
|
options = {
|
|
scripts.output = lib.mkOption {
|
|
type = lib.types.package;
|
|
};
|
|
|
|
requestParams = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
};
|
|
};
|
|
|
|
config = {
|
|
scripts.output = pkgs.writeShellApplication {
|
|
name = "map";
|
|
runtimeInputs = with pkgs; [ curl feh ];
|
|
text = ''
|
|
${./map.sh} ${lib.concatStringsSep " "
|
|
config.requestParams} | feh -
|
|
'';
|
|
};
|
|
|
|
requestParams = [
|
|
"size=640x640"
|
|
"scale=2"
|
|
(lib.mkIf (config.map.zoom != null)
|
|
"zoom=${toString config.map.zoom}")
|
|
];
|
|
|
|
map = {
|
|
zoom = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.int;
|
|
default = 10;
|
|
};
|
|
|
|
center = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.str;
|
|
default = "switzerland";
|
|
};
|
|
};
|
|
};
|
|
} |