1{ pkgs, ... }:
2{
3 name = "intune";
4 meta = {
5 maintainers = with pkgs.lib.maintainers; [ rhysmdnz ];
6 };
7 enableOCR = true;
8
9 nodes.machine =
10 { nodes, ... }:
11 let
12 user = nodes.machine.users.users.alice;
13 in
14 {
15 services.intune.enable = true;
16 services.gnome.gnome-keyring.enable = true;
17 imports = [
18 ./common/user-account.nix
19 ./common/x11.nix
20 ];
21 test-support.displayManager.auto.user = user.name;
22 environment = {
23 variables.DBUS_SESSION_BUS_ADDRESS = "unix:path=/run/user/${builtins.toString user.uid}/bus";
24 };
25 };
26 nodes.pam =
27 { nodes, ... }:
28 let
29 user = nodes.machine.users.users.alice;
30 in
31 {
32 services.intune.enable = true;
33 imports = [ ./common/user-account.nix ];
34 };
35
36 testScript = ''
37 start_all()
38
39 # Check System Daemons successfully start
40 machine.succeed("systemctl start microsoft-identity-device-broker.service")
41 machine.succeed("systemctl start intune-daemon.service")
42
43 # Check User Daemons and intune-portal execurtable works
44 # Going any further than starting it would require internet access and a microsoft account
45 machine.wait_for_x()
46 # TODO: This needs an unlocked user keychain before it will work
47 #machine.succeed("su - alice -c 'systemctl start --user microsoft-identity-broker.service'")
48 machine.succeed("su - alice -c 'systemctl start --user intune-agent.service'")
49 machine.succeed("su - alice -c intune-portal >&2 &")
50 machine.wait_for_text("Intune Agent")
51
52 # Check logging in creates password file
53 def login_as_alice():
54 pam.wait_until_tty_matches("1", "login: ")
55 pam.send_chars("alice\n")
56 pam.wait_until_tty_matches("1", "Password: ")
57 pam.send_chars("foobar\n")
58 pam.wait_until_tty_matches("1", "alice\@pam")
59
60 pam.wait_for_unit("multi-user.target")
61 login_as_alice()
62 pam.wait_for_file("/run/intune/1000/pwquality")
63 '';
64}