guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#67515] [PATCH 91/91] gnu: Add mission-center.


From: Sergio Pastor Pérez
Subject: [bug#67515] [PATCH 91/91] gnu: Add mission-center.
Date: Tue, 28 Nov 2023 22:13:09 +0100

* gnu/packages/patches/mission-center-gatherer.patch (mission-center): New 
variable.

Change-Id: Iebd1423d98da2d6d7951e2e87f435f5049566e39
---
 .../patches/mission-center-gatherer.patch     |  21 +++
 gnu/packages/rust-apps.scm                    | 173 ++++++++++++++++++
 2 files changed, 194 insertions(+)
 create mode 100644 gnu/packages/patches/mission-center-gatherer.patch

diff --git a/gnu/packages/patches/mission-center-gatherer.patch 
b/gnu/packages/patches/mission-center-gatherer.patch
new file mode 100644
index 0000000000..1d37ad2863
--- /dev/null
+++ b/gnu/packages/patches/mission-center-gatherer.patch
@@ -0,0 +1,21 @@
+This patch makes the `gatherer` component of `mission-center' use the nvtop
+sources provided as a `gexp` artifact instead of fetching the sources at
+build-time.
+
+diff --git a/src/sys_info_v2/gatherer/build/build.rs 
b/src/sys_info_v2/gatherer/build/build.rs
+index 3c287ee..f0af0ff 100644
+--- a/src/sys_info_v2/gatherer/build/build.rs
++++ b/src/sys_info_v2/gatherer/build/build.rs
+@@ -60,11 +60,7 @@ fn prepare_third_party_sources() -> 
Result<Vec<std::path::PathBuf>, Box<dyn std:
+                     break;
+                 }
+ 
+-                let output_path = util::download_file(
+-                    &package.source_url,
+-                    &format!("{}", out_dir.display()),
+-                    Some(&package.source_hash),
+-                )?;
++                let output_path = std::env::var("CARGO_MANIFEST_DIR")? + 
"/../../../../nvtop.tar.gz";
+ 
+                 let mut archive = std::fs::File::open(&output_path)?;
+                 let tar = flate2::read::GzDecoder::new(&mut archive);
diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index eb5214f534..29dd369ec6 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -43,6 +43,7 @@
 
 (define-module (gnu packages rust-apps)
   #:use-module (guix build-system cargo)
+  #:use-module (guix build-system meson)
   #:use-module (guix build-system pyproject)
   #:use-module (guix deprecation)
   #:use-module (guix download)
@@ -55,15 +56,21 @@ (define-module (gnu packages rust-apps)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages build-tools)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crates-io)
   #:use-module (gnu packages crates-graphics)
+  #:use-module (gnu packages crates-gtk)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages haskell-xyz)
+  #:use-module (gnu packages gettext)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages gnome)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages ibus)
   #:use-module (gnu packages icu4c)
@@ -72,6 +79,7 @@ (define-module (gnu packages rust-apps)
   #:use-module (gnu packages kde)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages networking)
+  #:use-module (gnu packages ninja)
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
@@ -83,7 +91,9 @@ (define-module (gnu packages rust-apps)
   #:use-module (gnu packages rust)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages version-control)
+  #:use-module (gnu packages vulkan)
   #:use-module (gnu packages webkit)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg))
 
 (define-public agate
@@ -997,6 +1007,169 @@ (define-public maturin
 @code{cffi} bindings as well as rust binaries as python packages.")
     (license (list license:expat license:asl2.0))))
 
+(define-public mission-center
+  (define nvtop-src
+    (let ((url-hash "be47f8c560487efc6e6a419d59c69bfbdb819324"))
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/Syllo/nvtop/archive/"; url-hash
+                            ".tar.gz"))
+        (file-name (string-append "nvtop-" url-hash))
+        (sha256
+         (base32 "0pq3959a83d8wqdxbsbhvakcylhm3v6pzk525klpab6jn7g67ja7")))))
+
+  (define pathfinder-src
+    (let ((commit "21ec6fa933547636bc6c5ee8f0dd4a0ea3fcd062"))
+      (origin
+        (method git-fetch)
+        (uri (git-reference (url "https://github.com/servo/pathfinder";)
+                            (commit commit)))
+        (file-name (git-file-name "pathfinder" commit))
+        (sha256
+         (base32 "1ky5f7k6w0wpi8k7hpwfidaa032cnnhxbzgv8lrla0snv3ms6r4k")))))
+
+  (package
+    (name "mission-center")
+    (version "0.3.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/mission-center-devs/mission-center.git";)
+             (commit "4fc7268f5dd314580e721825a63d3e34421e8317")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1nql8mij04kb862j6s7ls5qxl6bsa088zrmynlq52ppk577idb7q"))
+       (patches (list (search-patch "mission-center-gatherer.patch")))))
+    (build-system cargo-build-system)
+    (arguments
+     (list
+      #:cargo-inputs
+      `(("rust-anyhow" ,rust-anyhow-1)
+        ("rust-drm" ,rust-drm-0.9)
+        ("rust-egl" ,rust-egl-0.2)
+        ("rust-gbm" ,rust-gbm-0.12)
+        ("rust-interprocess" ,rust-interprocess-1)
+        ("rust-minidl" ,rust-minidl-0.1)
+        ("rust-raw-cpuid" ,rust-raw-cpuid-11)
+        ("rust-rust-ini" ,rust-rust-ini-0.19)
+        ("rust-rustbus" ,rust-rustbus-0.19)
+        ("rust-shared-memory-extended" ,rust-shared-memory-extended-0.13)
+        ("rust-cargo-util" ,rust-cargo-util-0.2)
+        ("rust-sha2" ,rust-sha2-0.10)
+        ("rust-tar" ,rust-tar-0.4)
+        ("rust-ureq" ,rust-ureq-2)
+        ("rust-libadwaita" ,rust-libadwaita-0.5)
+        ("rust-errno-sys" ,rust-errno-sys-0.1)
+        ("rust-gettext-rs" ,rust-gettext-rs-0.7)
+        ("rust-gl-loader" ,rust-gl-loader-0.1)
+        ("rust-libudev-sys" ,rust-libudev-sys-0.1)
+        ("rust-rusqlite" ,rust-rusqlite-0.29)
+        ("rust-sysinfo" ,rust-sysinfo-0.29)
+        ("rust-textdistance" ,rust-textdistance-1)
+
+        ;; Required for pathfinder
+        ("rust-byte-slice-cast" ,rust-byte-slice-cast-0.3)
+        ("rust-crossbeam-channel" ,rust-crossbeam-channel-0.4)
+        ("rust-hashbrown" ,rust-hashbrown-0.7))
+      #:imported-modules
+      `(,@%meson-build-system-modules
+        (guix build cargo-build-system)
+        (guix build json)
+        (guix build cargo-utils)
+        (guix build utils))
+      #:modules
+      `((guix build cargo-build-system)
+        ((guix build meson-build-system)
+         #:prefix meson:)
+        (guix build utils))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'remove-cargo-locks
+            (lambda _
+              (with-directory-excursion "src/sys_info_v2/gatherer"
+                (delete-file "Cargo.lock")
+                (substitute* "meson.build"
+                  (("cargo_env.*")
+                   "")))
+              (substitute* "src/meson.build"
+                (("cargo_env \\+= \\[ 'CARGO_HOME='.*")
+                 ""))))
+          (add-after 'unpack 'fix-dlopen-calls
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute*
+                  
"src/sys_info_v2/gatherer/src/platform/linux/gpu_info/vulkan_info.rs"
+                (("libvulkan.so.1")
+                 (search-input-file inputs "/lib/libvulkan.so.1")))))
+          (add-after 'unpack 'setup-nvtop
+            (lambda _
+              (begin
+                (use-modules (guix build utils))
+                (copy-file #$nvtop-src "../nvtop.tar.gz"))))
+          (add-after 'unpack 'setup-pathfinder
+            (lambda _
+              (begin
+                (use-modules (guix build utils))
+                (copy-recursively #$pathfinder-src "../pathfinder")
+                (substitute* "Cargo.toml"
+                  (("^pathfinder_([a-z]+).*$" _ module)
+                   (string-append "pathfinder_"
+                                  module
+                                  " = { path = \"../pathfinder/"
+                                  module
+                                  "\" }"
+                                  "\n"))))))
+          (add-before 'build 'meson-configure
+            (lambda args
+              (apply (assoc-ref meson:%standard-phases
+                                'configure)
+                     ;; NOTE: flags for the configure phase. This
+                     ;; keyword argument does not exist on the
+                     ;; `cargo-build-system'. This is why we need to
+                     ;; pass it manually.
+                     #:configure-flags '()
+                     #:build-type "debugoptimized"
+                     args)))
+          (replace 'build
+            (assoc-ref meson:%standard-phases
+                       'build))
+          (delete 'package)
+          (delete 'check)
+          (replace 'install
+            (assoc-ref meson:%standard-phases 'install)))))
+    ;; NOTE: since `gtk' and `libadwaita' are core packages, many have them as
+    ;; propagated inputs. Therefore its not enough with just bumping their
+    ;; version here. Input rewritting is required, eg:
+    ;; guix build mission-center --with-input=gtk=gtk@4.10.3
+    ;; --with-input=libadwaita=libadwaita@1.3.0
+    (native-inputs
+     (list blueprint-compiler-next
+           cmake
+           gettext-minimal
+           meson
+           ninja
+           perl
+           pkg-config))
+    (inputs
+     (list (list glib "bin")
+           (list gtk "bin") ; must be gtk >= 4.10.0
+           appstream-glib
+           desktop-file-utils
+           libadwaita ; must be libadwaita >= 1.3.0
+           libglvnd
+           libgudev
+           libxml2
+           openssl
+           python
+           python-pygobject
+           python-wrapper
+           vulkan-loader))
+    (synopsis "System resource usage monitor")
+    (description "System monitor that displays your CPU, Memory, Disk, Network
+and GPU usage.")
+    (home-page "https://missioncenter.io/";)
+    (license license:gpl3)))
+
 (define-public ripgrep
   (package
     (name "ripgrep")
-- 
2.41.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]