summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2019-04-24 14:16:30 +0800
committerPeter Hoeg <peter@hoeg.com>2019-04-24 22:31:36 +0800
commit1bc408ec3af8ae7244fccd156dc7d4bb61a3638e (patch)
tree4ec96fb6d46966c8c5b92e8bf91cdd01ce0913ba
parentd26027792812fbfad4d0f451b5f47fdabf7fdeb9 (diff)
downloadnixpkgs-1bc408ec3af8ae7244fccd156dc7d4bb61a3638e.tar
nixpkgs-1bc408ec3af8ae7244fccd156dc7d4bb61a3638e.tar.gz
nixpkgs-1bc408ec3af8ae7244fccd156dc7d4bb61a3638e.tar.bz2
nixpkgs-1bc408ec3af8ae7244fccd156dc7d4bb61a3638e.tar.lz
nixpkgs-1bc408ec3af8ae7244fccd156dc7d4bb61a3638e.tar.xz
nixpkgs-1bc408ec3af8ae7244fccd156dc7d4bb61a3638e.tar.zst
nixpkgs-1bc408ec3af8ae7244fccd156dc7d4bb61a3638e.zip
nixos/packagekit: make it not error out and use upstream systemd unit
-rw-r--r--nixos/modules/services/misc/packagekit.nix51
1 files changed, 29 insertions, 22 deletions
diff --git a/nixos/modules/services/misc/packagekit.nix b/nixos/modules/services/misc/packagekit.nix
index bce21e8acff..325c4e84e0d 100644
--- a/nixos/modules/services/misc/packagekit.nix
+++ b/nixos/modules/services/misc/packagekit.nix
@@ -7,18 +7,19 @@ let
   cfg = config.services.packagekit;
 
   packagekitConf = ''
-[Daemon]
-KeepCache=false
-    '';
+    [Daemon]
+    DefaultBackend=${cfg.backend}
+    KeepCache=false
+  '';
 
   vendorConf = ''
-[PackagesNotFound]
-DefaultUrl=https://github.com/NixOS/nixpkgs
-CodecUrl=https://github.com/NixOS/nixpkgs
-HardwareUrl=https://github.com/NixOS/nixpkgs
-FontUrl=https://github.com/NixOS/nixpkgs
-MimeUrl=https://github.com/NixOS/nixpkgs
-      '';
+    [PackagesNotFound]
+    DefaultUrl=https://github.com/NixOS/nixpkgs
+    CodecUrl=https://github.com/NixOS/nixpkgs
+    HardwareUrl=https://github.com/NixOS/nixpkgs
+    FontUrl=https://github.com/NixOS/nixpkgs
+    MimeUrl=https://github.com/NixOS/nixpkgs
+  '';
 
 in
 
@@ -33,26 +34,32 @@ in
           installing software. Software utilizing PackageKit can install
           software regardless of the package manager.
         '';
-    };
 
+      # TODO: integrate with PolicyKit if the nix backend matures to the point
+      # where it will require elevated permissions
+      backend = mkOption {
+        type = types.enum [ "test_nop" ];
+        default = "test_nop";
+        description = ''
+          PackageKit supports multiple different backends and <literal>auto</literal> which
+          should do the right thing.
+          </para>
+          <para>
+          On NixOS however, we do not have a backend compatible with nix 2.0
+          (refer to <link xlink:href="https://github.com/NixOS/nix/issues/233">this issue</link> so we have to force
+          it to <literal>test_nop</literal> for now.
+        '';
+      };
+    };
   };
 
   config = mkIf cfg.enable {
 
-    services.dbus.packages = [ pkgs.packagekit ];
+    services.dbus.packages = with pkgs; [ packagekit ];
 
-    systemd.services.packagekit = {
-      description = "PackageKit Daemon";
-      wantedBy = [ "multi-user.target" ];
-      serviceConfig.ExecStart = "${pkgs.packagekit}/libexec/packagekitd";
-      serviceConfig.User = "root";
-      serviceConfig.BusName = "org.freedesktop.PackageKit";
-      serviceConfig.Type = "dbus";
-    };
+    systemd.packages = with pkgs; [ packagekit ];
 
     environment.etc."PackageKit/PackageKit.conf".text = packagekitConf;
     environment.etc."PackageKit/Vendor.conf".text = vendorConf;
-
   };
-
 }