From be8868e936a7ebf2951301fd77c5fd9fe584352b Mon Sep 17 00:00:00 2001 From: R-VdP <141248+R-VdP@users.noreply.github.com> Date: Thu, 23 Feb 2023 14:40:12 +0100 Subject: [PATCH 1/2] coreboot-configurator: 2022-08-22 -> 2023-01-17, use pkexec instead of sudo. Using pkexec, as the upstream application does, makes it possible to launch the application using its .desktop file, instead of needing to run it from the terminal. --- .../misc/coreboot-configurator/default.nix | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/tools/misc/coreboot-configurator/default.nix b/pkgs/tools/misc/coreboot-configurator/default.nix index 7e0a6d0c706e..4f036d526aca 100644 --- a/pkgs/tools/misc/coreboot-configurator/default.nix +++ b/pkgs/tools/misc/coreboot-configurator/default.nix @@ -3,24 +3,27 @@ , fetchFromGitHub , inkscape , meson +, mkDerivation , ninja , pkg-config +, pkexecPath ? "/run/wrappers/bin/pkexec" , yaml-cpp , nvramtool +, systemd , qtbase , qtsvg , wrapQtAppsHook }: -stdenv.mkDerivation { +mkDerivation { pname = "coreboot-configurator"; - version = "unstable-2022-08-22"; + version = "unstable-2023-01-17"; src = fetchFromGitHub { owner = "StarLabsLtd"; repo = "coreboot-configurator"; - rev = "37c93e7e101a20f85be309904177b9404875cfd8"; - sha256 = "2pk+uJk1EnVNO2vO1zF9Q6TLpij69iRdr5DFiNcZlM0="; + rev = "944b575dc873c78627c352f9c1a1493981431a58"; + sha256 = "sha256-ReWQNzeoyTF66hVnevf6Kkrnt0/PqRHd3oyyPYtx+0M="; }; nativeBuildInputs = [ inkscape meson ninja pkg-config wrapQtAppsHook ]; @@ -28,9 +31,15 @@ stdenv.mkDerivation { postPatch = '' substituteInPlace src/application/*.cpp \ - --replace '/usr/bin/pkexec' 'sudo' \ - --replace '/usr/bin/systemctl' 'systemctl' \ - --replace '/usr/sbin/nvramtool' '${nvramtool}/bin/nvramtool' + --replace '/usr/bin/pkexec' '${pkexecPath}' \ + --replace '/usr/bin/systemctl' '${lib.getBin systemd}/systemctl' \ + --replace '/usr/sbin/nvramtool' '${lib.getExe nvramtool}' + + substituteInPlace src/resources/org.coreboot.nvramtool.policy \ + --replace '/usr/sbin/nvramtool' '${lib.getExe nvramtool}' + + substituteInPlace src/resources/org.coreboot.reboot.policy \ + --replace '/usr/sbin/reboot' '${lib.getBin systemd}/reboot' ''; postFixup = '' From 4a622549c7f8235ff182ea0f6ea97b273685d303 Mon Sep 17 00:00:00 2001 From: R-VdP <141248+R-VdP@users.noreply.github.com> Date: Sun, 26 Feb 2023 16:11:12 +0100 Subject: [PATCH 2/2] Resolve pkexec from PATH by default. --- pkgs/tools/misc/coreboot-configurator/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/misc/coreboot-configurator/default.nix b/pkgs/tools/misc/coreboot-configurator/default.nix index 4f036d526aca..87c4573e95eb 100644 --- a/pkgs/tools/misc/coreboot-configurator/default.nix +++ b/pkgs/tools/misc/coreboot-configurator/default.nix @@ -5,8 +5,12 @@ , meson , mkDerivation , ninja + # We will resolve pkexec from the path because it has a setuid wrapper on + # NixOS meaning that we cannot just use the path from the nix store. + # Using the path to the wrapper here would make the package incompatible + # with non-NixOS systems. +, pkexecPath ? "pkexec" , pkg-config -, pkexecPath ? "/run/wrappers/bin/pkexec" , yaml-cpp , nvramtool , systemd