diff options
author | worldofpeace <worldofpeace@protonmail.ch> | 2019-12-15 19:04:10 -0500 |
---|---|---|
committer | worldofpeace <worldofpeace@protonmail.ch> | 2019-12-15 19:04:10 -0500 |
commit | 9665977f4cca4333add0a061db78daa2b650f0b0 (patch) | |
tree | 8452285546a079ca1fe1b467e935bb0ed9aa0a3a /pkgs/build-support/make-desktopitem/default.nix | |
parent | be13df6c76cb2480640d1622f691d6298852a43a (diff) | |
download | nixpkgs-9665977f4cca4333add0a061db78daa2b650f0b0.tar nixpkgs-9665977f4cca4333add0a061db78daa2b650f0b0.tar.gz nixpkgs-9665977f4cca4333add0a061db78daa2b650f0b0.tar.bz2 nixpkgs-9665977f4cca4333add0a061db78daa2b650f0b0.tar.lz nixpkgs-9665977f4cca4333add0a061db78daa2b650f0b0.tar.xz nixpkgs-9665977f4cca4333add0a061db78daa2b650f0b0.tar.zst nixpkgs-9665977f4cca4333add0a061db78daa2b650f0b0.zip |
makeDesktopItem: add desktop file validation
This uses desktop-file-validate in desktop-file-utils. It can be turned off if wanted.
Diffstat (limited to 'pkgs/build-support/make-desktopitem/default.nix')
-rw-r--r-- | pkgs/build-support/make-desktopitem/default.nix | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pkgs/build-support/make-desktopitem/default.nix b/pkgs/build-support/make-desktopitem/default.nix index 67b82fd66db..127243c6f2f 100644 --- a/pkgs/build-support/make-desktopitem/default.nix +++ b/pkgs/build-support/make-desktopitem/default.nix @@ -1,4 +1,5 @@ -{ lib, runCommandLocal }: +{ lib, runCommandLocal, desktop-file-utils }: + { name , type ? "Application" , exec @@ -11,6 +12,7 @@ , categories ? "Application;Other;" , startupNotify ? null , extraEntries ? null +, fileValidation ? true # whether to validate resulting desktop file. }: let @@ -28,8 +30,8 @@ let in runCommandLocal "${name}.desktop" {} '' - mkdir -p $out/share/applications - cat > $out/share/applications/${name}.desktop <<EOF + mkdir -p "$out/share/applications" + cat > "$out/share/applications/${name}.desktop" <<EOF [Desktop Entry] Type=${type} Exec=${exec} @@ -40,4 +42,9 @@ runCommandLocal "${name}.desktop" {} ${if extraEntries == null then ''EOF'' else '' ${extraEntries} EOF''} + + ${lib.optionalString fileValidation '' + echo "Running desktop-file validation" + ${desktop-file-utils}/bin/desktop-file-validate "$out/share/applications/${name}.desktop" + ''} '' |