···
1
-
import ./make-test-python.nix (
3
+
sqlcipher-signal = pkgs.writeShellScriptBin "sqlcipher" ''
5
-
sqlcipher-signal = pkgs.writeShellScriptBin "sqlcipher" ''
6
+
readonly CFG=~/.config/Signal/config.json
7
+
readonly KEY="$(${pkgs.jq}/bin/jq --raw-output '.key' $CFG)"
9
+
readonly SQL="SELECT * FROM sqlite_master where type='table'"
10
+
${pkgs.sqlcipher}/bin/sqlcipher "$DB" "PRAGMA key = \"x'$KEY'\"; $SQL"
14
+
name = "signal-desktop";
15
+
meta = with pkgs.lib.maintainers; {
8
-
readonly CFG=~/.config/Signal/config.json
9
-
readonly KEY="$(${pkgs.jq}/bin/jq --raw-output '.key' $CFG)"
11
-
readonly SQL="SELECT * FROM sqlite_master where type='table'"
12
-
${pkgs.sqlcipher}/bin/sqlcipher "$DB" "PRAGMA key = \"x'$KEY'\"; $SQL"
16
-
name = "signal-desktop";
17
-
meta = with pkgs.lib.maintainers; {
27
+
./common/user-account.nix
31
+
services.xserver.enable = true;
32
+
test-support.displayManager.auto.user = "alice";
33
+
environment.systemPackages = with pkgs; [
29
-
./common/user-account.nix
46
+
user = nodes.machine.config.users.users.alice;
50
+
machine.wait_for_x()
33
-
services.xserver.enable = true;
34
-
test-support.displayManager.auto.user = "alice";
35
-
environment.systemPackages = with pkgs; [
52
+
# start signal desktop
53
+
machine.execute("su - alice -c signal-desktop >&2 &")
55
+
# Wait for the Signal window to appear. Since usually the tests
56
+
# are run sandboxed and therefore with no internet, we can not wait
57
+
# for the message "Link your phone ...". Nor should we wait for
58
+
# the "Failed to connect to server" message, because when manually
59
+
# running this test it will be not sandboxed.
60
+
machine.wait_for_text("Signal")
61
+
machine.wait_for_text("File Edit View Window Help")
62
+
machine.screenshot("signal_desktop")
48
-
user = nodes.machine.config.users.users.alice;
52
-
machine.wait_for_x()
54
-
# start signal desktop
55
-
machine.execute("su - alice -c signal-desktop >&2 &")
57
-
# Wait for the Signal window to appear. Since usually the tests
58
-
# are run sandboxed and therefore with no internet, we can not wait
59
-
# for the message "Link your phone ...". Nor should we wait for
60
-
# the "Failed to connect to server" message, because when manually
61
-
# running this test it will be not sandboxed.
62
-
machine.wait_for_text("Signal")
63
-
machine.wait_for_text("File Edit View Window Help")
64
-
machine.screenshot("signal_desktop")
66
-
# Test if the database is encrypted to prevent these issues:
67
-
# - https://github.com/NixOS/nixpkgs/issues/108772
68
-
# - https://github.com/NixOS/nixpkgs/pull/117555
69
-
print(machine.succeed("su - alice -c 'file ~/.config/Signal/sql/db.sqlite'"))
71
-
"su - alice -c 'file ~/.config/Signal/sql/db.sqlite' | grep -e SQLite -e database"
73
-
# Only SQLCipher should be able to read the encrypted DB:
75
-
"su - alice -c 'sqlite3 ~/.config/Signal/sql/db.sqlite .tables'"
77
-
print(machine.succeed(
78
-
"su - alice -c 'sqlcipher ~/.config/Signal/sql/db.sqlite'"
64
+
# Test if the database is encrypted to prevent these issues:
65
+
# - https://github.com/NixOS/nixpkgs/issues/108772
66
+
# - https://github.com/NixOS/nixpkgs/pull/117555
67
+
print(machine.succeed("su - alice -c 'file ~/.config/Signal/sql/db.sqlite'"))
69
+
"su - alice -c 'file ~/.config/Signal/sql/db.sqlite' | grep -e SQLite -e database"
71
+
# Only SQLCipher should be able to read the encrypted DB:
73
+
"su - alice -c 'sqlite3 ~/.config/Signal/sql/db.sqlite .tables'"
75
+
print(machine.succeed(
76
+
"su - alice -c 'sqlcipher ~/.config/Signal/sql/db.sqlite'"