diff mbox series

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

Message ID DU2P193MB2132AF6AC65D68ED3B3B51F7F3BCA@DU2P193MB2132.EURP193.PROD.OUTLOOK.COM
State New
Headers show
Series [bug#67515,01/91] gnu: Add blueprint-compiler-next. | expand

Commit Message

Sergio Pastor Pérez Nov. 28, 2023, 9:13 p.m. UTC
* 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

Comments

Efraim Flashner Dec. 26, 2023, 11:43 a.m. UTC | #1
I've applied a bunch of the patches to the rust-team branch, but I think
we're going to need to wait for the gnome branch to be merged first.
Plus since I'd really rather not merge really old packages like libc-0.1
I think we should actually package a newer version, once the gnome
branch gets merged.
Sergio Pastor Pérez Dec. 28, 2023, 12:32 p.m. UTC | #2
Hi.

> I've applied a bunch of the patches to the rust-team branch, but I think
> we're going to need to wait for the gnome branch to be merged first.
Thanks for taking your time to look at the patch serie.

> Plus since I'd really rather not merge really old packages like libc-0.1
> I think we should actually package a newer version, once the gnome
> branch gets merged.
That makes sense. Maybe we could consider cutting of the dependency
graph using `#:skip-build? #t` so we avoid packaging this old
dependencies? I think it would be nice to at least have `mission-center`
packaged.

Greetings,
Sergio.
Greg Hogan April 2, 2024, 3:24 p.m. UTC | #3
On Thu, Dec 28, 2023 at 7:33 AM Sergio Pastor Pérez
<sergio.pastorperez@outlook.es> wrote:
>
> Hi.
>
> > I've applied a bunch of the patches to the rust-team branch, but I think
> > we're going to need to wait for the gnome branch to be merged first.
> Thanks for taking your time to look at the patch serie.

The gnome branch has been merged!

> > Plus since I'd really rather not merge really old packages like libc-0.1
> > I think we should actually package a newer version, once the gnome
> > branch gets merged.
> That makes sense. Maybe we could consider cutting of the dependency
> graph using `#:skip-build? #t` so we avoid packaging this old
> dependencies? I think it would be nice to at least have `mission-center`
> packaged.
>
> Greetings,
> Sergio.
diff mbox series

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")