about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorMichael Peyton Jones <me@michaelpj.com>2019-06-16 12:21:20 +0100
committerMichael Peyton Jones <me@michaelpj.com>2019-06-19 11:07:44 +0100
commit0073c1fb0b4d230a305f703f2e2056b432c64cf6 (patch)
treef177b1ab2c39331a2d19e1d8c3f1302970819e55 /nixos
parent66da10e80f92b7bde048a566e3bf97cc6b349d86 (diff)
downloadnixlib-0073c1fb0b4d230a305f703f2e2056b432c64cf6.tar
nixlib-0073c1fb0b4d230a305f703f2e2056b432c64cf6.tar.gz
nixlib-0073c1fb0b4d230a305f703f2e2056b432c64cf6.tar.bz2
nixlib-0073c1fb0b4d230a305f703f2e2056b432c64cf6.tar.lz
nixlib-0073c1fb0b4d230a305f703f2e2056b432c64cf6.tar.xz
nixlib-0073c1fb0b4d230a305f703f2e2056b432c64cf6.tar.zst
nixlib-0073c1fb0b4d230a305f703f2e2056b432c64cf6.zip
localtime: use upstream unit and fix polkit rule installation
Also don't allocate a user - the upstream unit uses DynamicUser.
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/system/localtime.nix31
1 files changed, 7 insertions, 24 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";
     };
   };
 }