Merge pull request #60146 from peterhoeg/f/packagekit
nixos/packagekit: make it not error out + test
This commit is contained in:
commit
eb6ce1c8a9
@ -7,18 +7,19 @@ let
|
||||
cfg = config.services.packagekit;
|
||||
|
||||
packagekitConf = ''
|
||||
[Daemon]
|
||||
KeepCache=false
|
||||
'';
|
||||
[Daemon]
|
||||
DefaultBackend=${cfg.backend}
|
||||
KeepCache=false
|
||||
'';
|
||||
|
||||
vendorConf = ''
|
||||
[PackagesNotFound]
|
||||
DefaultUrl=https://github.com/NixOS/nixpkgs
|
||||
CodecUrl=https://github.com/NixOS/nixpkgs
|
||||
HardwareUrl=https://github.com/NixOS/nixpkgs
|
||||
FontUrl=https://github.com/NixOS/nixpkgs
|
||||
MimeUrl=https://github.com/NixOS/nixpkgs
|
||||
'';
|
||||
[PackagesNotFound]
|
||||
DefaultUrl=https://github.com/NixOS/nixpkgs
|
||||
CodecUrl=https://github.com/NixOS/nixpkgs
|
||||
HardwareUrl=https://github.com/NixOS/nixpkgs
|
||||
FontUrl=https://github.com/NixOS/nixpkgs
|
||||
MimeUrl=https://github.com/NixOS/nixpkgs
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
@ -33,26 +34,32 @@ in
|
||||
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
|
||||
# where it will require elevated permissions
|
||||
backend = mkOption {
|
||||
type = types.enum [ "test_nop" ];
|
||||
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.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
services.dbus.packages = [ pkgs.packagekit ];
|
||||
services.dbus.packages = with pkgs; [ packagekit ];
|
||||
|
||||
systemd.services.packagekit = {
|
||||
description = "PackageKit Daemon";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.ExecStart = "${pkgs.packagekit}/libexec/packagekitd";
|
||||
serviceConfig.User = "root";
|
||||
serviceConfig.BusName = "org.freedesktop.PackageKit";
|
||||
serviceConfig.Type = "dbus";
|
||||
};
|
||||
systemd.packages = with pkgs; [ packagekit ];
|
||||
|
||||
environment.etc."PackageKit/PackageKit.conf".text = packagekitConf;
|
||||
environment.etc."PackageKit/Vendor.conf".text = vendorConf;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -182,6 +182,7 @@ in
|
||||
osrm-backend = handleTest ./osrm-backend.nix {};
|
||||
ostree = handleTest ./ostree.nix {};
|
||||
overlayfs = handleTest ./overlayfs.nix {};
|
||||
packagekit = handleTest ./packagekit.nix {};
|
||||
pam-oath-login = handleTest ./pam-oath-login.nix {};
|
||||
pam-u2f = handleTest ./pam-u2f.nix {};
|
||||
pantheon = handleTest ./pantheon.nix {};
|
||||
|
24
nixos/tests/packagekit.nix
Normal file
24
nixos/tests/packagekit.nix
Normal file
@ -0,0 +1,24 @@
|
||||
import ./make-test.nix ({ pkgs, ... }: {
|
||||
name = "packagekit";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ peterhoeg ];
|
||||
};
|
||||
|
||||
machine = { ... }: {
|
||||
environment.systemPackages = with pkgs; [ dbus ];
|
||||
services.packagekit = {
|
||||
enable = true;
|
||||
backend = "test_nop";
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
|
||||
# send a dbus message to activate the service
|
||||
$machine->succeed("dbus-send --system --type=method_call --print-reply --dest=org.freedesktop.PackageKit /org/freedesktop/PackageKit org.freedesktop.DBus.Introspectable.Introspect");
|
||||
|
||||
# so now it should be running
|
||||
$machine->succeed("systemctl is-active packagekit.service");
|
||||
'';
|
||||
})
|
Loading…
Reference in New Issue
Block a user