~ruther/guix-local

eb2092db0f22c56c347fca1eff07d1dd9fc2c441 — Ashvith Shetty 1 year, 4 months ago b696658
gnu: Add corectrl.

* gnu/packages/admin.scm (corectrl): New variable.
* gnu/packages/patches/corectrl-polkit-install-dir.patch:
New file.
* gnu/local.mk (dist_patch_DATA): Add reference to it.

Change-Id: I7b0f85c917eb58d7518d7ee7c5b22ef2debde7d9
3 files changed, 103 insertions(+), 0 deletions(-)

M gnu/local.mk
M gnu/packages/admin.scm
A gnu/packages/patches/corectrl-polkit-install-dir.patch
M gnu/local.mk => gnu/local.mk +2 -0
@@ 69,6 69,7 @@
# Copyright © 2024 Fabio Natali <me@fabionatali.com>
# Copyright © 2024 Noé Lopez <noelopez@free.fr>
# Copyright © 2024 Runciter <runciter@whispers-vpn.org>
# Copyright © 2024 Ashvith Shetty <ashvithshetty10@gmail.com>
#
# This file is part of GNU Guix.
#


@@ 1128,6 1129,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/converseen-hide-non-free-pointers.patch	\
  %D%/packages/patches/cool-retro-term-wctype.patch		\
  %D%/packages/patches/coq-autosubst-1.8-remove-deprecated-files.patch		\
  %D%/packages/patches/corectrl-polkit-install-dir.patch	\
  %D%/packages/patches/corefx-mono-5.4.0-patches.patch		\
  %D%/packages/patches/corefx-mono-pre-5.8.0-patches.patch	\
  %D%/packages/patches/coreutils-gnulib-tests.patch		\

M gnu/packages/admin.scm => gnu/packages/admin.scm +78 -0
@@ 71,6 71,7 @@
;;; Copyright © 2024 nathan <nathan_mail@nborghese.com>
;;; Copyright © 2024 Nikita Domnitskii <nikita@domnitskii.me>
;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
;;; Copyright © 2024 Ashvith Shetty <ashvithshetty10@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 138,6 139,7 @@
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages gawk)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages gcc)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gnome)


@@ 158,10 160,12 @@
  #:use-module (gnu packages libunwind)
  #:use-module (gnu packages libusb)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages logging)
  #:use-module (gnu packages lua)
  #:use-module (gnu packages m4)
  #:use-module (gnu packages mail)
  #:use-module (gnu packages man)
  #:use-module (gnu packages maths)
  #:use-module (gnu packages markup)
  #:use-module (gnu packages mcrypt)
  #:use-module (gnu packages mpi)


@@ 196,6 200,7 @@
  #:use-module (gnu packages time)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages vulkan)
  #:use-module (gnu packages web)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages xml)


@@ 3273,6 3278,79 @@ processes and threads of the specified process may optionally share the same
limits.")
    (license license:gpl2+)))

(define-public corectrl
  (package
    (name "corectrl")
    (version "1.4.3")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://gitlab.com/corectrl/corectrl")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32 "0qpc04xxzv4jbqqlraqriipix4ph7bm1hfiry807jjp668i9n25d"))
       (patches (search-patches "corectrl-polkit-install-dir.patch"))))
    (build-system qt-build-system)
    (arguments
     (list
      #:configure-flags #~(list "-DINSTALL_DBUS_FILES_IN_PREFIX=true"
                                (string-append "-DPOLKIT_POLICY_INSTALL_DIR="
                                               #$output
                                               "/share/polkit-1/actions")
                                (string-append "-DWITH_PCI_IDS_PATH="
                                               #$(this-package-input "hwdata")
                                               "/share/hwdata/pci.ids"))
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'embed-absolute-references
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "src/core/info/common/cpuinfolscpu.cpp"
                (("\"lscpu\"")
                 (string-append
                  "\"" (search-input-file inputs "bin/lscpu") "\"")))
              (substitute* "src/core/info/common/gpuinfovulkan.cpp"
                (("\"vulkaninfo\"")
                 (string-append
                  "\"" (search-input-file inputs "bin/vulkaninfo") "\"")))
              (substitute* (list "src/core/info/common/swinfomesa.cpp"
                                 "src/core/info/common/gpuinfoopengl.cpp")
                (("\"glxinfo\"")
                 (string-append
                  "\"" (search-input-file inputs "bin/glxinfo") "\""))))))))
    ;; Text formatting only supported since C++20, which is available in gcc-13.
    ;; https://en.cppreference.com/w/cpp/compiler_support#cpp_lib_format_201907L
    (native-inputs (list catch2-3
                         gcc-13
                         pkg-config
                         qttools-5))
    (inputs (list dbus
                  botan
                  hwdata
                  mesa-utils
                  polkit
                  procps
                  pugixml
                  qtcharts-5
                  qtdeclarative-5
                  qtquickcontrols2-5
                  qtsvg-5
                  qtwayland-5
                  quazip
                  spdlog
                  trompeloeil
                  units
                  util-linux
                  vulkan-tools
                  zlib))
    (home-page "https://gitlab.com/corectrl/corectrl")
    (synopsis "Profile based system control utility")
    (description
     "CoreCtrl allows you to control with ease your computer hardware using
application profiles.")
    (license (list license:gpl3))))

(define-public autojump
  (package
    (name "autojump")

A gnu/packages/patches/corectrl-polkit-install-dir.patch => gnu/packages/patches/corectrl-polkit-install-dir.patch +23 -0
@@ 0,0 1,23 @@
See https://gitlab.com/corectrl/corectrl/-/issues/477

diff --git a/src/helper/CMakeLists.txt b/src/helper/CMakeLists.txt
index c262086..523ea97 100644
--- a/src/helper/CMakeLists.txt
+++ b/src/helper/CMakeLists.txt
@@ -26,15 +26,7 @@ message("D-Bus files will be installed into ${DBUS_DATADIR_PREFIX_DIR}/dbus-1")
 
 # Find polkit
 pkg_check_modules(POLKIT REQUIRED polkit-gobject-1)
-execute_process(
-  COMMAND pkg-config --variable=policydir polkit-gobject-1
-  RESULT_VARIABLE POLKIT_POLICY_INSTALL_DIR_RESULT
-  OUTPUT_VARIABLE POLKIT_POLICY_INSTALL_DIR
-  OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-if(NOT POLKIT_POLICY_INSTALL_DIR_RESULT EQUAL "0")
-  message(FATAL_ERROR "Failed to retrieve Polkit `policydir` variable using pkg-config")
-endif()
+option(POLKIT_POLICY_INSTALL_DIR "Polkit policy directory")
 
 list(APPEND HELPER_COMPILE_DEFINITIONS
   SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE