Files
nix-tutorial/modules/deep-dive/default.nix
2026-02-26 10:49:48 -05:00

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";
};
};
};
}