summary refs log tree commit diff
path: root/pkgs/build-support/make-desktopitem/default.nix
blob: f5b4e5af93a0dfdd324dedc71191e5c007c901f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{stdenv}:
{ name
, type ? "Application"
, exec
, icon ? ""
, comment ? ""
, terminal ? "false"
, desktopName
, genericName
, mimeType ? ""
, categories ? "Application;Other;"
, startupNotify ? null
, extraEntries ? ""
}:

stdenv.mkDerivation {
  name = "${name}.desktop";
  buildCommand = ''
    mkdir -p $out/share/applications
    cat > $out/share/applications/${name}.desktop <<EOF
    [Desktop Entry]
    Type=${type}
    Exec=${exec}
    Icon=${icon}
    Comment=${comment}
    Terminal=${terminal}
    Name=${desktopName}
    GenericName=${genericName}
    MimeType=${mimeType}
    Categories=${categories}
    ${extraEntries}
    ${if startupNotify == null then ''EOF'' else ''
    StartupNotify=${startupNotify}
    EOF''}
  '';
}