1import ./make-test-python.nix (
2 { lib, ... }:
3 {
4 name = "dconf";
5
6 meta.maintainers = with lib.maintainers; [
7 linsui
8 ];
9
10 nodes.machine =
11 {
12 config,
13 pkgs,
14 lib,
15 ...
16 }:
17 {
18 users.extraUsers.alice = {
19 isNormalUser = true;
20 };
21 programs.dconf = with lib.gvariant; {
22 enable = true;
23 profiles.user.databases = [
24 {
25 settings = {
26 "test/not".locked = mkInt32 1;
27 "test/is".locked = "locked";
28 };
29 locks = [
30 "/test/is/locked"
31 ];
32 }
33 ];
34 };
35 };
36
37 testScript = ''
38 machine.succeed("test $(dconf read -d /test/not/locked) == 1")
39 machine.succeed("test $(dconf read -d /test/is/locked) == \"'locked'\"")
40 machine.fail("sudo -u alice dbus-run-session -- dconf write /test/is/locked \"@s 'unlocked'\"")
41 machine.succeed("sudo -u alice dbus-run-session -- dconf write /test/not/locked \"@i 2\"")
42 '';
43 }
44)