2016-06-16 19:18:09 +00: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 19:18:09 +00:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
iniFmt = pkgs.formats.ini { };
|
2016-06-16 19:18:09 +00:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
confFiles = [
|
|
|
|
(iniFmt.generate "PackageKit.conf" (recursiveUpdate
|
|
|
|
{
|
|
|
|
Daemon = {
|
2020-07-28 04:53:02 +00:00
|
|
|
DefaultBackend = "nix";
|
2021-03-22 02:21:56 +00:00
|
|
|
KeepCache = false;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
cfg.settings))
|
2016-06-16 19:18:09 +00: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 19:18:09 +00:00
|
|
|
{
|
2021-03-22 02:21:56 +00:00
|
|
|
imports = [
|
2020-07-28 04:53:02 +00:00
|
|
|
(mkRemovedOptionModule [ "services" "packagekit" "backend" ] "Always set to Nix.")
|
2021-03-22 02:21:56 +00:00
|
|
|
];
|
2016-06-16 19:18:09 +00:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
options.services.packagekit = {
|
2022-08-28 19:18:44 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc ''
|
2021-03-22 02:21:56 +00:00
|
|
|
PackageKit provides a cross-platform D-Bus abstraction layer for
|
|
|
|
installing software. Software utilizing PackageKit can install
|
|
|
|
software regardless of the package manager.
|
2022-08-28 19:18:44 +00:00
|
|
|
'');
|
2016-06-16 19:18:09 +00:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
settings = mkOption {
|
|
|
|
type = iniFmt.type;
|
|
|
|
default = { };
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc "Additional settings passed straight through to PackageKit.conf";
|
2021-03-22 02:21:56 +00:00
|
|
|
};
|
2016-06-16 19:18:09 +00:00
|
|
|
|
2021-03-22 02:21:56 +00:00
|
|
|
vendorSettings = mkOption {
|
|
|
|
type = iniFmt.type;
|
|
|
|
default = { };
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc "Additional settings passed straight through to Vendor.conf";
|
2019-04-24 06:16:30 +00:00
|
|
|
};
|
2016-06-16 19:18:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
2019-04-24 06:16:30 +00:00
|
|
|
services.dbus.packages = with pkgs; [ packagekit ];
|
2016-06-16 19:18:09 +00:00
|
|
|
|
2020-07-28 04:53:02 +00:00
|
|
|
environment.systemPackages = with pkgs; [ packagekit ];
|
|
|
|
|
2019-04-24 06:16:30 +00:00
|
|
|
systemd.packages = with pkgs; [ packagekit ];
|
2016-06-16 19:18:09 +00: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 19:18:09 +00:00
|
|
|
};
|
|
|
|
}
|