From 82135b6c81342f02b4c6f71cda5d0465d29a70a3 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Sun, 19 May 2019 18:53:18 -0400 Subject: [PATCH] nixos/geoclue2: don't run as root --- nixos/modules/services/desktops/geoclue2.nix | 13 +++++++++++++ pkgs/development/libraries/geoclue/default.nix | 1 + 2 files changed, 14 insertions(+) diff --git a/nixos/modules/services/desktops/geoclue2.nix b/nixos/modules/services/desktops/geoclue2.nix index a16dbc04a5f..040fe157d52 100644 --- a/nixos/modules/services/desktops/geoclue2.nix +++ b/nixos/modules/services/desktops/geoclue2.nix @@ -188,6 +188,19 @@ in systemd.packages = [ package ]; + users.users.geoclue = { + isSystemUser = true; + home = "/var/lib/geoclue"; + group = "geoclue"; + description = "Geoinformation service"; + }; + + users.groups.geoclue = {}; + + systemd.tmpfiles.rules = [ + "d /var/lib/geoclue 0755 geoclue geoclue" + ]; + # restart geoclue service when the configuration changes systemd.services."geoclue".restartTriggers = [ config.environment.etc."geoclue/geoclue.conf".source diff --git a/pkgs/development/libraries/geoclue/default.nix b/pkgs/development/libraries/geoclue/default.nix index 70319c9151f..6a44f01d011 100644 --- a/pkgs/development/libraries/geoclue/default.nix +++ b/pkgs/development/libraries/geoclue/default.nix @@ -42,6 +42,7 @@ stdenv.mkDerivation rec { "-Ddemo-agent=${if withDemoAgent then "true" else "false"}" "--sysconfdir=/etc" "-Dsysconfdir_install=${placeholder "out"}/etc" + "-Ddbus-srv-user=geoclue" ] ++ optionals stdenv.isDarwin [ "-D3g-source=false" "-Dcdma-source=false"