From 9294d2fd25d429a5005664751d2b372841c4630d Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Tue, 28 Jul 2026 13:38:49 +1000 Subject: [PATCH] fix(ipa): skip home-manager-wayne service when home dir absent On first enrollment /home/wayne doesn't exist until the IPA user's first login (pam_mkhomedir creates it). home-manager-.service cd's into the home dir immediately and fails with ENOENT, causing the whole rebuild activation to return exit code 4. Add ConditionPathExists so systemd skips the service (condition not met, no failure) instead. After first login the dir exists and subsequent rebuilds activate Home Manager normally. Co-Authored-By: Claude Sonnet 4.6 --- modules/ipa/client.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/ipa/client.nix b/modules/ipa/client.nix index 88f7fea..16a10c9 100644 --- a/modules/ipa/client.nix +++ b/modules/ipa/client.nix @@ -153,6 +153,14 @@ lib.mkIf enabled { createHome = false; }; + # home-manager-.service fails on first enrollment because /home/wayne + # doesn't exist until the user's first login (pam_mkhomedir creates it then). + # ConditionPathExists makes systemd skip the service (exit 0, condition not + # met) instead of failing. After first login the dir exists and subsequent + # rebuilds activate HM normally. + systemd.services."home-manager-${vars.ipaUser}".unitConfig.ConditionPathExists = + "/home/${vars.ipaUser}"; + security.sudo.extraRules = [{ users = [ vars.ipaUser ]; commands = [{ command = "ALL"; options = [ "NOPASSWD" ]; }];