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 = {
|
2020-07-28 05:53:02 +01:00
|
|
|
DefaultBackend = "nix";
|
2021-03-22 02:21:56 +00:00
|
|
|
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 = [
|
2020-07-28 05:53:02 +01:00
|
|
|
(mkRemovedOptionModule [ "services" "packagekit" "backend" ] "Always set to Nix.")
|
2021-03-22 02:21:56 +00:00
|
|
|
];
|
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
|
|
|
|
2020-07-28 05:53:02 +01:00
|
|
|
environment.systemPackages = with pkgs; [ packagekit ];
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|