mirror of
https://github.com/nix-community/home-manager
synced 2024-11-13 22:59:44 +01:00
systemd: only set old units directory when available
This commit is contained in:
parent
6b7ce96f34
commit
dfaf0ff2e7
1 changed files with 9 additions and 2 deletions
|
@ -335,7 +335,7 @@ in {
|
||||||
in ''
|
in ''
|
||||||
${pkgs.sd-switch}/bin/sd-switch \
|
${pkgs.sd-switch}/bin/sd-switch \
|
||||||
''${DRY_RUN:+--dry-run} $VERBOSE_ARG ${timeoutArg} \
|
''${DRY_RUN:+--dry-run} $VERBOSE_ARG ${timeoutArg} \
|
||||||
''${oldGenPath:+--old-units $oldGenPath/home-files/.config/systemd/user} \
|
''${oldUnitsDir:+--old-units $oldUnitsDir} \
|
||||||
--new-units "$newUnitsDir"
|
--new-units "$newUnitsDir"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
@ -354,6 +354,13 @@ in {
|
||||||
warnEcho "Attempting to reload services anyway..."
|
warnEcho "Attempting to reload services anyway..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -v oldGenPath ]]; then
|
||||||
|
oldUnitsDir="$oldGenPath/home-files/.config/systemd/user"
|
||||||
|
if [[ ! -e $oldUnitsDir ]]; then
|
||||||
|
oldUnitsDir=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
newUnitsDir="$newGenPath/home-files/.config/systemd/user"
|
newUnitsDir="$newGenPath/home-files/.config/systemd/user"
|
||||||
if [[ ! -e $newUnitsDir ]]; then
|
if [[ ! -e $newUnitsDir ]]; then
|
||||||
newUnitsDir=${pkgs.emptyDirectory}
|
newUnitsDir=${pkgs.emptyDirectory}
|
||||||
|
@ -362,7 +369,7 @@ in {
|
||||||
${ensureRuntimeDir} \
|
${ensureRuntimeDir} \
|
||||||
${getAttr cfg.startServices cmd}
|
${getAttr cfg.startServices cmd}
|
||||||
|
|
||||||
unset newUnitsDir
|
unset newUnitsDir oldUnitsDir
|
||||||
else
|
else
|
||||||
echo "User systemd daemon not running. Skipping reload."
|
echo "User systemd daemon not running. Skipping reload."
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue