mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 07:34:11 +00:00
fbc5093649
This hook moves systemd user service file from `lib/systemd/user` to `share/systemd/user`. This is to allow systemd to find the user services when installed into a user profile. The `lib/systemd/user` path does not work since `lib` is not in `XDG_DATA_DIRS`.
26 lines
731 B
Bash
Executable File
26 lines
731 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This setup hook, for each output, moves everything in
|
|
# $output/lib/systemd/user to $output/share/systemd/user, and replaces
|
|
# $output/lib/systemd/user with a symlink to
|
|
# $output/share/systemd/user.
|
|
|
|
fixupOutputHooks+=(_moveSystemdUserUnits)
|
|
|
|
_moveSystemdUserUnits() {
|
|
if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then return; fi
|
|
if [ ! -e "${prefix:?}/lib/systemd/user" ]; then return; fi
|
|
local source="$prefix/lib/systemd/user"
|
|
local target="$prefix/share/systemd/user"
|
|
echo "moving $source/* to $target"
|
|
mkdir -p "$target"
|
|
(
|
|
shopt -s dotglob
|
|
for i in "$source"/*; do
|
|
mv "$i" "$target"
|
|
done
|
|
)
|
|
rmdir "$source"
|
|
ln -s "$target" "$source"
|
|
}
|