3
0
Fork 0
forked from mirrors/nixpkgs

make-desktopitem: desktop-file-utils is a nativeBuildInput

This fixes cross-compilation of a NixOS with the manual enabled.
This commit is contained in:
Florian Klink 2020-11-27 01:16:24 +01:00
parent bd1de18f6c
commit ae5764621d

View file

@ -16,10 +16,10 @@
, extraEntries ? "" # Extra configuration. Will be appended to the end of the file and may thus contain extra sections
, fileValidation ? true # whether to validate resulting desktop file.
}:
let
# like builtins.toString, but null -> null instead of null -> ""
nullableToString = value: if value == null then null
nullableToString = value:
if value == null then null
else if builtins.isBool value then lib.boolToString value
else builtins.toString value;
@ -48,7 +48,10 @@ let
)
++ (if extraEntries == "" then [ ] else [ "${extraEntries}" ]);
in
runCommandLocal "${name}.desktop" {}
runCommandLocal "${name}.desktop"
{
nativeBuildInputs = [ desktop-file-utils ];
}
(''
mkdir -p "$out/share/applications"
cat > "$out/share/applications/${name}.desktop" <<EOF
@ -56,5 +59,5 @@ runCommandLocal "${name}.desktop" {}
EOF
'' + lib.optionalString fileValidation ''
echo "Running desktop-file validation"
${desktop-file-utils}/bin/desktop-file-validate "$out/share/applications/${name}.desktop"
desktop-file-validate "$out/share/applications/${name}.desktop"
'')