From 0073c1fb0b4d230a305f703f2e2056b432c64cf6 Mon Sep 17 00:00:00 2001 From: Michael Peyton Jones Date: Sun, 16 Jun 2019 12:21:20 +0100 Subject: [PATCH] localtime: use upstream unit and fix polkit rule installation Also don't allocate a user - the upstream unit uses DynamicUser. --- nixos/modules/services/system/localtime.nix | 31 +++++---------------- pkgs/tools/system/localtime/default.nix | 5 +++- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/nixos/modules/services/system/localtime.nix b/nixos/modules/services/system/localtime.nix index c7e897c96448..266b3121c132 100644 --- a/nixos/modules/services/system/localtime.nix +++ b/nixos/modules/services/system/localtime.nix @@ -22,33 +22,16 @@ in { config = mkIf cfg.enable { services.geoclue2.enable = true; - # so polkit will pick up the rules - environment.systemPackages = [ pkgs.localtime ]; - - users.users = [{ - name = "localtimed"; - description = "Taskserver user"; - }]; + # We use the 'out' output, since localtime has its 'bin' output + # first, so that is what we get if we use the derivation bare. + # Install the polkit rules. + environment.systemPackages = [ pkgs.localtime.out ]; + # Install the systemd unit. + systemd.packages = [ pkgs.localtime.out ]; systemd.services.localtime = { - description = "localtime service"; wantedBy = [ "multi-user.target" ]; - partOf = [ "geoclue.service "]; - - serviceConfig = { - Restart = "on-failure"; - # TODO: make it work with dbus - #DynamicUser = true; - Nice = 10; - User = "localtimed"; - PrivateTmp = "yes"; - PrivateDevices = true; - PrivateNetwork = "yes"; - NoNewPrivileges = "yes"; - ProtectSystem = "strict"; - ProtectHome = true; - ExecStart = "${pkgs.localtime}/bin/localtimed"; - }; + serviceConfig.Restart = "on-failure"; }; }; } diff --git a/pkgs/tools/system/localtime/default.nix b/pkgs/tools/system/localtime/default.nix index 56346548f005..39e1bc7b6e7d 100644 --- a/pkgs/tools/system/localtime/default.nix +++ b/pkgs/tools/system/localtime/default.nix @@ -13,7 +13,10 @@ buildGoPackage rec { buildInputs = [ m4 ]; - makeFlags = [ "PREFIX=$(out)" "BINDIR=$(bin)/bin" ]; + makeFlags = [ + "PREFIX=${placeholder "out"}" + "BINDIR=${placeholder "bin"}/bin" + ]; buildPhase = '' cd go/src/${goPackagePath}