2016-06-16 20:18:09 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.packagekit;
|
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
inherit (lib)
|
|
|
|
mkEnableOption mkOption mkIf mkRemovedOptionModule types
|
|
|
|
listToAttrs recursiveUpdate;
|
2016-06-16 20:18:09 +01:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
iniFmt = pkgs.formats.ini { };
|
2016-06-16 20:18:09 +01:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
confFiles = [
|
|
|
|
(iniFmt.generate "PackageKit.conf" (recursiveUpdate
|
|
|
|
{
|
|
|
|
Daemon = {
|
|
|
|
DefaultBackend = "test_nop";
|
|
|
|
KeepCache = false;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
cfg.settings))
|
2016-06-16 20:18:09 +01:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
(iniFmt.generate "Vendor.conf" (recursiveUpdate
|
|
|
|
{
|
|
|
|
PackagesNotFound = rec {
|
|
|
|
DefaultUrl = "https://github.com/NixOS/nixpkgs";
|
|
|
|
CodecUrl = DefaultUrl;
|
|
|
|
HardwareUrl = DefaultUrl;
|
|
|
|
FontUrl = DefaultUrl;
|
|
|
|
MimeUrl = DefaultUrl;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
cfg.vendorSettings))
|
|
|
|
];
|
|
|
|
|
|
|
|
in
|
2016-06-16 20:18:09 +01:00
|
|
|
{
|
2021-03-22 02:21:56 +00:00
|
|
|
imports = [
|
|
|
|
(mkRemovedOptionModule [ "services" "packagekit" "backend" ] "The only backend that doesn't blow up is `test_nop`.")
|
|
|
|
];
|
2016-06-16 20:18:09 +01:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
options.services.packagekit = {
|
|
|
|
enable = mkEnableOption ''
|
|
|
|
PackageKit provides a cross-platform D-Bus abstraction layer for
|
|
|
|
installing software. Software utilizing PackageKit can install
|
|
|
|
software regardless of the package manager.
|
|
|
|
'';
|
2016-06-16 20:18:09 +01:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
settings = mkOption {
|
|
|
|
type = iniFmt.type;
|
|
|
|
default = { };
|
|
|
|
description = "Additional settings passed straight through to PackageKit.conf";
|
|
|
|
};
|
2016-06-16 20:18:09 +01:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
vendorSettings = mkOption {
|
|
|
|
type = iniFmt.type;
|
|
|
|
default = { };
|
|
|
|
description = "Additional settings passed straight through to Vendor.conf";
|
2019-04-24 07:16:30 +01:00
|
|
|
};
|
2016-06-16 20:18:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2019-04-24 07:16:30 +01:00
|
|
|
services.dbus.packages = with pkgs; [ packagekit ];
|
2016-06-16 20:18:09 +01:00
|
|
|
|
2019-04-24 07:16:30 +01:00
|
|
|
systemd.packages = with pkgs; [ packagekit ];
|
2016-06-16 20:18:09 +01:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
environment.etc = listToAttrs (map
|
|
|
|
(e:
|
|
|
|
lib.nameValuePair "PackageKit/${e.name}" { source = e; })
|
|
|
|
confFiles);
|
2016-06-16 20:18:09 +01:00
|
|
|
};
|
|
|
|
}
|