From b02719a29c19500e4d93f8394eab0fec6e28708c Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Thu, 5 Nov 2020 02:12:48 +0100 Subject: [PATCH 1/3] nixos-help: Do $PATH lookup in nixos-manual.desktop instead of hardcoding derivation See db236e588de "steam: Do $PATH lookup in steam.desktop [...]". tl;dr: Otherwise widget/panel/desktop icons in DEs like KDE break. --- nixos/modules/misc/documentation.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/misc/documentation.nix b/nixos/modules/misc/documentation.nix index 71a40b4f4d6..906e9f05063 100644 --- a/nixos/modules/misc/documentation.nix +++ b/nixos/modules/misc/documentation.nix @@ -64,7 +64,7 @@ let desktopName = "NixOS Manual"; genericName = "View NixOS documentation in a web browser"; icon = "nix-snowflake"; - exec = "${helpScript}/bin/nixos-help"; + exec = "nixos-help"; categories = "System"; }; From 3560f0d913a1d1b2c6f0a650d3a4f3ab5419baa2 Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Thu, 5 Nov 2020 11:47:14 +0100 Subject: [PATCH 2/3] nixos-help: use writeShellScriptBin and drop custom shebang line --- nixos/modules/misc/documentation.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nixos/modules/misc/documentation.nix b/nixos/modules/misc/documentation.nix index 906e9f05063..0a8b1a313ef 100644 --- a/nixos/modules/misc/documentation.nix +++ b/nixos/modules/misc/documentation.nix @@ -40,9 +40,8 @@ let in scrubbedEval.options; }; - helpScript = pkgs.writeScriptBin "nixos-help" + helpScript = pkgs.writeShellScriptBin "nixos-help" '' - #! ${pkgs.runtimeShell} -e # Finds first executable browser in a colon-separated list. # (see how xdg-open defines BROWSER) browser="$( From 9a01e978244c2d7e20b97533309f02ba93933a8c Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Thu, 5 Nov 2020 11:51:02 +0100 Subject: [PATCH 3/3] nixos-help: bundle the desktop item with the script This is to ensure that whenever we install the desktop item we also have the script installed. Prior to b02719a we always had the reference to the script in the desktop item. Since desktop items are being copied to home directories and thus "bit rod" over time that absolute path was removed. --- nixos/modules/misc/documentation.nix | 33 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/nixos/modules/misc/documentation.nix b/nixos/modules/misc/documentation.nix index 0a8b1a313ef..bc43cc33b5d 100644 --- a/nixos/modules/misc/documentation.nix +++ b/nixos/modules/misc/documentation.nix @@ -40,8 +40,9 @@ let in scrubbedEval.options; }; - helpScript = pkgs.writeShellScriptBin "nixos-help" - '' + + nixos-help = let + helpScript = pkgs.writeShellScriptBin "nixos-help" '' # Finds first executable browser in a colon-separated list. # (see how xdg-open defines BROWSER) browser="$( @@ -58,14 +59,22 @@ let exec "$browser" ${manual.manualHTMLIndex} ''; - desktopItem = pkgs.makeDesktopItem { - name = "nixos-manual"; - desktopName = "NixOS Manual"; - genericName = "View NixOS documentation in a web browser"; - icon = "nix-snowflake"; - exec = "nixos-help"; - categories = "System"; - }; + desktopItem = pkgs.makeDesktopItem { + name = "nixos-manual"; + desktopName = "NixOS Manual"; + genericName = "View NixOS documentation in a web browser"; + icon = "nix-snowflake"; + exec = "nixos-help"; + categories = "System"; + }; + + in pkgs.symlinkJoin { + name = "nixos-help"; + paths = [ + helpScript + desktopItem + ]; + }; in @@ -249,8 +258,8 @@ in environment.systemPackages = [] ++ optional cfg.man.enable manual.manpages - ++ optionals cfg.doc.enable ([ manual.manualHTML helpScript ] - ++ optionals config.services.xserver.enable [ desktopItem pkgs.nixos-icons ]); + ++ optionals cfg.doc.enable ([ manual.manualHTML nixos-help ] + ++ optionals config.services.xserver.enable [ pkgs.nixos-icons ]); services.mingetty.helpLine = mkIf cfg.doc.enable ( "\nRun 'nixos-help' for the NixOS manual."