nixos/packagekit: RFC42 support and drop pointless setting

This commit is contained in:
Peter Hoeg 2021-03-22 10:21:56 +08:00
parent 6256634d7f
commit aa22be179a

View File

@ -1,55 +1,60 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
with lib;
let let
cfg = config.services.packagekit; cfg = config.services.packagekit;
packagekitConf = '' inherit (lib)
[Daemon] mkEnableOption mkOption mkIf mkRemovedOptionModule types
DefaultBackend=${cfg.backend} listToAttrs recursiveUpdate;
KeepCache=false
'';
vendorConf = '' iniFmt = pkgs.formats.ini { };
[PackagesNotFound]
DefaultUrl=https://github.com/NixOS/nixpkgs confFiles = [
CodecUrl=https://github.com/NixOS/nixpkgs (iniFmt.generate "PackageKit.conf" (recursiveUpdate
HardwareUrl=https://github.com/NixOS/nixpkgs {
FontUrl=https://github.com/NixOS/nixpkgs Daemon = {
MimeUrl=https://github.com/NixOS/nixpkgs DefaultBackend = "test_nop";
''; KeepCache = false;
};
}
cfg.settings))
(iniFmt.generate "Vendor.conf" (recursiveUpdate
{
PackagesNotFound = rec {
DefaultUrl = "https://github.com/NixOS/nixpkgs";
CodecUrl = DefaultUrl;
HardwareUrl = DefaultUrl;
FontUrl = DefaultUrl;
MimeUrl = DefaultUrl;
};
}
cfg.vendorSettings))
];
in in
{ {
imports = [
(mkRemovedOptionModule [ "services" "packagekit" "backend" ] "The only backend that doesn't blow up is `test_nop`.")
];
options = { 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.
'';
services.packagekit = { settings = mkOption {
enable = mkEnableOption type = iniFmt.type;
'' default = { };
PackageKit provides a cross-platform D-Bus abstraction layer for description = "Additional settings passed straight through to PackageKit.conf";
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 vendorSettings = mkOption {
# where it will require elevated permissions type = iniFmt.type;
backend = mkOption { default = { };
type = types.enum [ "test_nop" ]; description = "Additional settings passed straight through to Vendor.conf";
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.
'';
};
}; };
}; };
@ -59,7 +64,9 @@ in
systemd.packages = with pkgs; [ packagekit ]; systemd.packages = with pkgs; [ packagekit ];
environment.etc."PackageKit/PackageKit.conf".text = packagekitConf; environment.etc = listToAttrs (map
environment.etc."PackageKit/Vendor.conf".text = vendorConf; (e:
lib.nameValuePair "PackageKit/${e.name}" { source = e; })
confFiles);
}; };
} }