at master 1.0 kB view raw
1{ config, lib, ... }: 2{ 3 name = "geoclue2"; 4 meta = { 5 maintainers = with lib.maintainers; [ rhendric ]; 6 }; 7 8 nodes.machine = { 9 imports = [ common/user-account.nix ]; 10 11 location = { 12 latitude = 12.345; 13 longitude = -67.890; 14 }; 15 16 services.geoclue2 = { 17 enable = true; 18 enableDemoAgent = true; 19 enableStatic = true; 20 staticAltitude = 123.45; 21 staticAccuracy = 1000; 22 }; 23 }; 24 25 testScript = 26 let 27 inherit (config.node) pkgs; 28 in 29 '' 30 whereAmI = machine.succeed('machinectl shell alice@.host ${pkgs.geoclue2}/libexec/geoclue-2.0/demos/where-am-i -t 5') 31 assert ("Latitude: 12.345000°" in whereAmI), f"Incorrect latitude in:\n{whereAmI}" 32 assert ("Longitude: -67.890000°" in whereAmI), f"Incorrect longitude in:\n{whereAmI}" 33 assert ("Altitude: 123.450000 meters" in whereAmI), f"Incorrect altitude in:\n{whereAmI}" 34 assert ("Accuracy: 1000.000000 meters" in whereAmI), f"Incorrect accuracy in:\n{whereAmI}" 35 ''; 36}