nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1# shellcheck shell=bash
2
3# This setup hook, for each output, moves everything in
4# $output/lib/systemd/user to $output/share/systemd/user, and replaces
5# $output/lib/systemd/user with a symlink to
6# $output/share/systemd/user.
7
8fixupOutputHooks+=(_moveSystemdUserUnits)
9
10_moveSystemdUserUnits() {
11 if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then return; fi
12 if [ ! -e "${prefix:?}/lib/systemd/user" ]; then return; fi
13 local source="$prefix/lib/systemd/user"
14 local target="$prefix/share/systemd/user"
15 echo "moving $source/* to $target"
16 mkdir -p "$target"
17 (
18 shopt -s dotglob
19 for i in "$source"/*; do
20 mv "$i" "$target"
21 done
22 )
23 rmdir "$source"
24 ln -s "$target" "$source"
25}