···
{ config, lib, pkgs, ... }:
cfg = config.services.packagekit;
11
-
DefaultBackend=${cfg.backend}
7
+
mkEnableOption mkOption mkIf mkRemovedOptionModule types
8
+
listToAttrs recursiveUpdate;
17
-
DefaultUrl=https://github.com/NixOS/nixpkgs
18
-
CodecUrl=https://github.com/NixOS/nixpkgs
19
-
HardwareUrl=https://github.com/NixOS/nixpkgs
20
-
FontUrl=https://github.com/NixOS/nixpkgs
21
-
MimeUrl=https://github.com/NixOS/nixpkgs
10
+
iniFmt = pkgs.formats.ini { };
13
+
(iniFmt.generate "PackageKit.conf" (recursiveUpdate
16
+
DefaultBackend = "test_nop";
22
+
(iniFmt.generate "Vendor.conf" (recursiveUpdate
24
+
PackagesNotFound = rec {
25
+
DefaultUrl = "https://github.com/NixOS/nixpkgs";
26
+
CodecUrl = DefaultUrl;
27
+
HardwareUrl = DefaultUrl;
28
+
FontUrl = DefaultUrl;
29
+
MimeUrl = DefaultUrl;
32
+
cfg.vendorSettings))
38
+
(mkRemovedOptionModule [ "services" "packagekit" "backend" ] "The only backend that doesn't blow up is `test_nop`.")
41
+
options.services.packagekit = {
42
+
enable = mkEnableOption ''
43
+
PackageKit provides a cross-platform D-Bus abstraction layer for
44
+
installing software. Software utilizing PackageKit can install
45
+
software regardless of the package manager.
30
-
services.packagekit = {
31
-
enable = mkEnableOption
33
-
PackageKit provides a cross-platform D-Bus abstraction layer for
34
-
installing software. Software utilizing PackageKit can install
35
-
software regardless of the package manager.
48
+
settings = mkOption {
51
+
description = "Additional settings passed straight through to PackageKit.conf";
38
-
# TODO: integrate with PolicyKit if the nix backend matures to the point
39
-
# where it will require elevated permissions
40
-
backend = mkOption {
41
-
type = types.enum [ "test_nop" ];
42
-
default = "test_nop";
44
-
PackageKit supports multiple different backends and <literal>auto</literal> which
45
-
should do the right thing.
48
-
On NixOS however, we do not have a backend compatible with nix 2.0
49
-
(refer to <link xlink:href="https://github.com/NixOS/nix/issues/233">this issue</link> so we have to force
50
-
it to <literal>test_nop</literal> for now.
54
+
vendorSettings = mkOption {
57
+
description = "Additional settings passed straight through to Vendor.conf";
···
systemd.packages = with pkgs; [ packagekit ];
62
-
environment.etc."PackageKit/PackageKit.conf".text = packagekitConf;
63
-
environment.etc."PackageKit/Vendor.conf".text = vendorConf;
67
+
environment.etc = listToAttrs (map
69
+
lib.nameValuePair "PackageKit/${e.name}" { source = e; })