Skip to content

Commit

Permalink
fix(tests): work around home-manager now using a oneshot unit
Browse files Browse the repository at this point in the history
  • Loading branch information
getchoo committed Dec 11, 2024
1 parent 6951ab6 commit 114efeb
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions tests/nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,24 @@ testers.runNixOSTest {
};
};

testScript = _: ''
machine.start()
machine.wait_for_unit("home-manager-test.service")
machine.wait_until_succeeds("systemctl status home-manager-test.service")
machine.succeed("echo \"system started!\"")
'';
testScript =
{ nodes, ... }:
let
user = nodes.machine.users.users.test;
in
''
start_all()
with subtest("Wait for user login"):
machine.wait_for_unit("multi-user.target")
machine.wait_for_unit("user@${user.uid}.service")
with subtest("Activate home-manager environment"):
# HACK: Re-run home-manager activation
#
# As of 24.11, home-manager is activated via a oneshot unit
# `wait_for_unit()` can't handle this, so we run here again with `systemctl`
# https://github.com/NixOS/nixpkgs/issues/62155
machine.systemctl("start home-manager-${user.name}.service")
'';
}

0 comments on commit 114efeb

Please sign in to comment.