summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2024-03-19 00:02:39 +0000
committerGitHub <noreply@github.com>2024-03-19 00:02:39 +0000
commitb727e4cb210367459e4299f8521d9c781fe70fc5 (patch)
treef460a448c282dbb70c1fce34320965ae8ac1c600 /doc
parent871a7b4f289bc83ab456f8915a9fe6af5d603da1 (diff)
parent7c0bd382c72689b24a726b03b3436963e911c787 (diff)
Merge staging-next into staging
Diffstat (limited to 'doc')
-rw-r--r--doc/build-helpers/trivial-build-helpers.chapter.md101
-rw-r--r--doc/languages-frameworks/javascript.section.md4
2 files changed, 103 insertions, 2 deletions
diff --git a/doc/build-helpers/trivial-build-helpers.chapter.md b/doc/build-helpers/trivial-build-helpers.chapter.md
index 02d0a8682bf7..8354ee23b2db 100644
--- a/doc/build-helpers/trivial-build-helpers.chapter.md
+++ b/doc/build-helpers/trivial-build-helpers.chapter.md
@@ -94,6 +94,107 @@ writeShellScript "evaluate-my-file.sh" ''
```
::::
+### `makeDesktopItem` {#trivial-builder-makeDesktopItem}
+
+Write an [XDG desktop file](https://specifications.freedesktop.org/desktop-entry-spec/1.4/) to the Nix store.
+
+This function is usually used to add desktop items to a package through the `copyDesktopItems` hook.
+
+`makeDesktopItem` adheres to version 1.4 of the specification.
+
+#### Inputs {#trivial-builder-makeDesktopItem-inputs}
+
+`makeDesktopItem` takes an attribute set that accepts most values from the [XDG specification](https://specifications.freedesktop.org/desktop-entry-spec/1.4/ar01s06.html).
+
+All recognised keys from the specification are supported with the exception of the "Hidden" field. The keys are converted into camelCase format, but correspond 1:1 to their equivalent in the specification: `genericName`, `noDisplay`, `comment`, `icon`, `onlyShowIn`, `notShowIn`, `dbusActivatable`, `tryExec`, `exec`, `path`, `terminal`, `mimeTypes`, `categories`, `implements`, `keywords`, `startupNotify`, `startupWMClass`, `url`, `prefersNonDefaultGPU`.
+
+The "Version" field is hardcoded to the version `makeDesktopItem` currently adheres to.
+
+The following fields are either required, are of a different type than in the specification, carry specific default values, or are additional fields supported by `makeDesktopItem`:
+
+`name` (String)
+
+: The name of the desktop file in the Nix store.
+
+`type` (String; _optional_)
+
+: Default value: `"Application"`
+
+`desktopName` (String)
+
+: Corresponds to the "Name" field of the specification.
+
+`actions` (List of Attribute set; _optional_)
+
+: A list of attribute sets {name, exec?, icon?}
+
+`extraConfig` (Attribute set; _optional_)
+
+: Additional key/value pairs to be added verbatim to the desktop file. Attributes need to be prefixed with 'X-'.
+
+#### Examples {#trivial-builder-makeDesktopItem-examples}
+
+::: {.example #ex-makeDesktopItem}
+# Usage 1 of `makeDesktopItem`
+
+Write a desktop file `/nix/store/<store path>/my-program.desktop` to the Nix store.
+
+```nix
+{makeDesktopItem}:
+makeDesktopItem {
+ name = "my-program";
+ desktopName = "My Program";
+ genericName = "Video Player";
+ noDisplay = false;
+ comment = "Cool video player";
+ icon = "/path/to/icon";
+ onlyShowIn = [ "KDE" ];
+ dbusActivatable = true;
+ tryExec = "my-program";
+ exec = "my-program --someflag";
+ path = "/some/working/path";
+ terminal = false;
+ actions.example = {
+ name = "New Window";
+ exec = "my-program --new-window";
+ icon = "/some/icon";
+ };
+ mimeTypes = [ "video/mp4" ];
+ categories = [ "Utility" ];
+ implements = [ "org.my-program" ];
+ keywords = [ "Video" "Player" ];
+ startupNotify = false;
+ startupWMClass = "MyProgram";
+ prefersNonDefaultGPU = false;
+ extraConfig.X-SomeExtension = "somevalue";
+}
+```
+
+:::
+
+::: {.example #ex2-makeDesktopItem}
+# Usage 2 of `makeDesktopItem`
+
+Override the `hello` package to add a desktop item.
+
+```nix
+{ copyDesktopItems
+, hello
+, makeDesktopItem }:
+
+hello.overrideAttrs {
+ nativeBuildInputs = [ copyDesktopItems ];
+
+ desktopItems = [(makeDesktopItem {
+ name = "hello";
+ desktopName = "Hello";
+ exec = "hello";
+ })];
+}
+```
+
+:::
+
### `writeTextFile` {#trivial-builder-writeTextFile}
Write a text file to the Nix store.
diff --git a/doc/languages-frameworks/javascript.section.md b/doc/languages-frameworks/javascript.section.md
index c148070ad244..7a1b9d9f8de3 100644
--- a/doc/languages-frameworks/javascript.section.md
+++ b/doc/languages-frameworks/javascript.section.md
@@ -315,10 +315,10 @@ buildPhase = ''
'';
```
-The dist phase is also trying to build a binary, the only way to override it is with:
+The `distPhase` is packing the package's dependencies in a tarball using `yarn pack`. You can disable it using:
```nix
-distPhase = "true";
+doDist = false;
```
The configure phase can sometimes fail because it makes many assumptions which may not always apply. One common override is: