Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 6ecdb286b0a8
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 25952ac03649
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Nov 27, 2020

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

    This fixes cross-compilation of a NixOS with the manual enabled.
    flokli committed Nov 27, 2020
    Copy the full SHA
    ae57646 View commit details
  2. Merge pull request #105099 from flokli/nixos-cross-manual

    make-desktopitem: desktop-file-utils is a nativeBuildInput
    flokli authored Nov 27, 2020

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    25952ac View commit details
Showing with 12 additions and 9 deletions.
  1. +12 −9 pkgs/build-support/make-desktopitem/default.nix
21 changes: 12 additions & 9 deletions pkgs/build-support/make-desktopitem/default.nix
Original file line number Diff line number Diff line change
@@ -12,16 +12,16 @@
, mimeType ? null
, categories ? null
, startupNotify ? null
, extraDesktopEntries ? {} # Extra key-value pairs to add to the [Desktop Entry] section. This may override other values
, extraDesktopEntries ? { } # Extra key-value pairs to add to the [Desktop Entry] section. This may override other values
, 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
else if builtins.isBool value then lib.boolToString value
else builtins.toString value;
nullableToString = value:
if value == null then null
else if builtins.isBool value then lib.boolToString value
else builtins.toString value;

# The [Desktop entry] section of the desktop file, as attribute set.
mainSection = {
@@ -39,22 +39,25 @@ let

# Map all entries to a list of lines
desktopFileStrings =
["[Desktop Entry]"]
[ "[Desktop Entry]" ]
++ builtins.filter
(v: v != null)
(lib.mapAttrsToList
(name: value: if value != null then "${name}=${value}" else null)
mainSection
)
++ (if extraEntries == "" then [] else ["${extraEntries}"]);
++ (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
${builtins.concatStringsSep "\n" desktopFileStrings}
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"
'')