1 # shellcheck shell=bash
3 # Setup hook that installs specified desktop items.
5 # Example usage in a derivation:
7 # { …, makeDesktopItem, copyDesktopItems, … }:
9 # let desktopItem = makeDesktopItem { … }; in
10 # stdenv.mkDerivation {
12 # nativeBuildInputs = [ copyDesktopItems ];
14 # desktopItems = [ desktopItem ];
18 # This hook will copy files which are either given by full path
19 # or all '*.desktop' files placed inside the 'share/applications'
20 # folder of each `desktopItems` argument.
22 postInstallHooks
+=(copyDesktopItems
)
25 if [ "${dontCopyDesktopItems-}" = 1 ]; then return; fi
27 if [ -z "$desktopItems" ]; then
31 applications
="${!outputBin}/share/applications"
32 for desktopItem
in $desktopItems; do
33 if [[ -f "$desktopItem" ]]; then
34 echo "Copying '$desktopItem' into '${applications}'"
35 install -D -m 444 -t "${applications}" "$desktopItem"
37 for f
in "$desktopItem"/share
/applications
/*.desktop
; do
38 echo "Copying '$f' into '${applications}'"
39 install -D -m 444 -t "${applications}" "$f"