Hi, new NixOS user here.

Liking it so far but just hit an issue that I’m having trouble getting past. Pages in firefox cannot access my geolocation, even after I hit allow when the page asks for permission. Same with the default Gnome maps app, it just places me in a central location of my countrys capital (I don’t live in the capital).

I’ve added the following to my configuration.nix file and rebuilt but it made no difference.

 # Geolocation
  services.geoclue2.enable = true;

  environment.sessionVariables = {
    # Allows geolocation in firefox
    MOZ_ENABLE_WAYLAND = "1"; 
  };

What am I missing?

  • balsoft@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    16 days ago

    Do you have some device that provides geolocation capabilities, e.g. a GPS modem, connected to your system? Because otherwise the only way to get your location is via geoip, which can be imprecise enough to place you in a different city, as you can see for yourself.

    • crentist@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      16 days ago

      No gps modem but geolocation works on my other computer running fedora which also doesn’t have gps.

      • balsoft@lemmy.ml
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        15 days ago

        Hm, interesting. The other user said that geoclue tries using beacondb (I didn’t know that :D).

        Can you try running this: $(nix-build '<nixpkgs>' -A geoclue2)/libexec/geoclue-2.0/demos/where-am-i ? It should print out your location according to geoclue, and the source which it has used.

        For me, it looks like this:

        ❯ $(nix-build '<nixpkgs>' -A geoclue2)/libexec/geoclue-2.0/demos/where-am-i
        Client object: /org/freedesktop/GeoClue2/Client/3
        
        New location:
        Latitude:    <REDACTED>?
        Longitude:   <REDACTED>?
        Accuracy:    25000.000000 meters
        Speed:       0.000000 meters/second
        Description: ipf fallback (from GeoIP data)
        Timestamp:   Tue Jul 22 12:02:08 2025 (1753171328 seconds since the Epoch)
        
        • crentist@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          14 days ago

          My output is slightly difference, it seems I’m not getting data from GeoIP, but from Wifi data.

          $(nix-build '<nixpkgs>' -A geoclue2)/libexec/geoclue-2.0/demos/where-am-i
          Client object: /org/freedesktop/GeoClue2/Client/1
          
          New location:
          Latitude:    <LAT from capital>°
          Longitude:   <LONG from capital>°
          Accuracy:    25000,000000 meters
          Description: ipf fallback (from WiFi data)
          Timestamp:   Wed Jul 23 2025 12:51:06 (1753267866 seconds since the Epoch)
          
          • balsoft@lemmy.ml
            link
            fedilink
            English
            arrow-up
            1
            ·
            12 days ago

            Hmm, interesting. So this is probably the case of beacondb having incorrect data for your surrounding WiFi APs. I don’t know why it works on the other laptop, maybe it uses a different location database?

        • crentist@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          13 days ago

          Just noticed that your accuarcy is at 25000 meters as well, are you getting anywhere near your actual location in map applications?