unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#51193] Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4.
@ 2021-10-13 22:07 phodina via Guix-patches via
  2021-10-13 22:10 ` [bug#51193] Subject: [PATCH 2/4] gnu: Add rust-libpulse-sys-1 phodina via Guix-patches via
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: phodina via Guix-patches via @ 2021-10-13 22:07 UTC (permalink / raw)
  To: 51193

Hi,

these patches add tool similar to i3status, polybar, etc which is used in WM like i3 or sway to display the contents of the bars.

This one is written in Rust and can be used under Wayland and X11. Therefore I placed it into the rust-apps.scm rather than wm.scm. But I'm open to critical review :-)

Petr

--8<---------------cut here---------------start------------->8---
* gnu/packages/crates-io.scm (rust-cpuprofiler-0.0.4): New variable.

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 089b9f456c..5fb7bd9e69 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -46,6 +46,7 @@
   #:use-module (gnu packages admin)
   #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages cpp)
   #:use-module (gnu packages crates-graphics)
   #:use-module (gnu packages crates-gtk)
   #:use-module (gnu packages crypto)
@@ -10461,6 +10462,32 @@ to the @code{is_x86_feature_detected!} macro.")
 to @code{is_x86_feature_detected}.")
     (license (list license:expat license:asl2.0))))

+(define-public rust-cpuprofiler-0.0.4
+  (package
+    (name "rust-cpuprofiler")
+    (version "0.0.4")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "cpuprofiler" version))
+       (file-name
+        (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0az588yyl9r13w4k7xfdh5ckfaq52fwpjry2q2hblazxpjflgy23"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-error-chain" ,rust-error-chain-0.12)
+        ("rust-lazy-static" ,rust-lazy-static-1)
+        ("rust-pkg-config" ,rust-pkg-config-0.3))))
+    (inputs `(("gperftools" ,gperftools)))
+    (home-page
+     "https://github.com/AtheMathmo/cpuprofiler")
+    (synopsis "Bindings to google's cpu profiler")
+    (description "Bindings to google's cpu profiler")
+    (license license:bsd-2)))
+
 (define-public rust-crates-index-0.13
   (package
     (name "rust-crates-index")
--
2.33.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#51193] Subject: [PATCH 2/4] gnu: Add rust-libpulse-sys-1.
  2021-10-13 22:07 [bug#51193] Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4 phodina via Guix-patches via
@ 2021-10-13 22:10 ` phodina via Guix-patches via
  2021-10-13 22:11 ` [bug#51193] Subject: [PATCH 3/4] gnu: Add rust-libpulse-binding-2 phodina via Guix-patches via
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: phodina via Guix-patches via @ 2021-10-13 22:10 UTC (permalink / raw)
  To: 51193@debbugs.gnu.org

* gnu/packages/crates-io.scm (rust-libpulse-sys-1): New variable.

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 5fb7bd9e69..c5703804df 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -64,6 +64,7 @@
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
   #:use-module (gnu packages rust)
   #:use-module (gnu packages rust-apps)
@@ -25284,6 +25285,40 @@ file.
 @end itemize")
     (license license:gpl2+)))

+
+(define-public rust-libpulse-sys-1
+  (package
+    (name "rust-libpulse-sys")
+    (version "1.18.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "libpulse-sys" version))
+       (file-name
+        (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "10msfr8f951v86ag0fl2bsm4a3siq2r7hz9bqhhg7i234s1yj5yg"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:skip-build? #t
+       #:cargo-inputs
+       (("rust-libc" ,rust-libc-0.2)
+        ("rust-num-derive" ,rust-num-derive-0.3)
+        ("rust-num-traits" ,rust-num-traits-0.2)
+        ("rust-pkg-config" ,rust-pkg-config-0.3)
+        ("rust-winapi" ,rust-winapi-0.3))))
+    (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs `(("pulseaudio" ,pulseaudio)))
+    (home-page
+     "https://github.com/jnqnfe/pulse-binding-rust")
+    (synopsis
+     "FFI bindings for the PulseAudio")
+    (description
+     "This package provides FFI bindings for the PulseAudio libpulse system
+library.")
+    (license (list license:expat license:asl2.0))))
+
 (define-public rust-libsqlite3-sys-0.22
   (package
     (name "rust-libsqlite3-sys")
--
2.33.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#51193] Subject: [PATCH 3/4] gnu: Add rust-libpulse-binding-2.
  2021-10-13 22:07 [bug#51193] Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4 phodina via Guix-patches via
  2021-10-13 22:10 ` [bug#51193] Subject: [PATCH 2/4] gnu: Add rust-libpulse-sys-1 phodina via Guix-patches via
@ 2021-10-13 22:11 ` phodina via Guix-patches via
  2021-10-13 22:11 ` [bug#51193] Subject: [PATCH 4/4] gnu: Add i3status-rust phodina via Guix-patches via
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: phodina via Guix-patches via @ 2021-10-13 22:11 UTC (permalink / raw)
  To: 51193

* gnu/packages/crates-io.scm (rust-libpulse-binding-2): New variable.

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index c5703804df..67aa8f04da 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -25285,6 +25285,44 @@ file.
 @end itemize")
     (license license:gpl2+)))

+;; https://github.com/jnqnfe/pulse-binding-rust/blob/c788a8069f455f864d2ba5f0aa5f62e6648dfd26/pulse-sys/build.rs
+;; fix location of pulseaudio
+(define-public rust-libpulse-binding-2
+  (package
+    (name "rust-libpulse-binding")
+    (version "2.23.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "libpulse-binding" version))
+       (file-name
+        (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "1qx85j489mmad9cvw5k71271l3qy4s8a5qq8a9wac6cfi4viz5fv"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-bitflags" ,rust-bitflags-1)
+        ("rust-libc" ,rust-libc-0.2)
+        ("rust-libpulse-sys" ,rust-libpulse-sys-1)
+        ("rust-num-derive" ,rust-num-derive-0.3)
+        ("rust-num-traits" ,rust-num-traits-0.2)
+        ("rust-winapi" ,rust-winapi-0.3))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'set-HOME
+           (lambda _ (setenv "HOME" "/tmp") #t)))))
+    (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs `(("pulseaudio" ,pulseaudio)))
+    (home-page
+     "https://github.com/jnqnfe/pulse-binding-rust")
+    (synopsis
+     "Binding for the PulseAudio libpulse library")
+    (description
+     "This package provides a Rust language binding for the PulseAudio libpulse
+library.")
+    (license (list license:expat license:asl2.0))))

 (define-public rust-libpulse-sys-1
   (package
--
2.33.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#51193] Subject: [PATCH 4/4] gnu: Add i3status-rust.
  2021-10-13 22:07 [bug#51193] Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4 phodina via Guix-patches via
  2021-10-13 22:10 ` [bug#51193] Subject: [PATCH 2/4] gnu: Add rust-libpulse-sys-1 phodina via Guix-patches via
  2021-10-13 22:11 ` [bug#51193] Subject: [PATCH 3/4] gnu: Add rust-libpulse-binding-2 phodina via Guix-patches via
@ 2021-10-13 22:11 ` phodina via Guix-patches via
  2021-11-08  8:55 ` bug#51193: Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4 Efraim Flashner
  2021-11-08 17:34 ` [bug#51193] [PATCH] gnu: Update i3status-rust phodina via Guix-patches via
  4 siblings, 0 replies; 6+ messages in thread
From: phodina via Guix-patches via @ 2021-10-13 22:11 UTC (permalink / raw)
  To: 51193

* gnu/packages/rust-apps.scm (i3status-rust): New variable.
* gnu/packages/patches/i3status-rust-enable-unstable-features.patch: New file.

diff --git a/gnu/packages/patches/i3status-rust-enable-unstable-features.patch b/gnu/packages/patches/i3status-rust-enable-unstable-features.patch
new file mode 100644
index 0000000000..edbbef7534
--- /dev/null
+++ b/gnu/packages/patches/i3status-rust-enable-unstable-features.patch
@@ -0,0 +1,20 @@
+From 3006390c0058f06c255d9850327163aebcdc3b40 Mon Sep 17 00:00:00 2001
+From: Petr Hodina <phodina@protonmail.com>
+Date: Mon, 11 Oct 2021 22:35:39 +0200
+Subject: [PATCH] Enable unstable features.
+
+
+diff --git a/src/main.rs b/src/main.rs
+index d9e964b..820e22e 100644
+--- a/src/main.rs
++++ b/src/main.rs
+@@ -1,3 +1,6 @@
++#![feature(bool_to_option)]
++#![feature(clamp)]
++
+ #[macro_use]
+ mod de;
+ #[macro_use]
+--
+2.33.0
+
diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index 27cd57de8b..39bfc9fba2 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2021 Zheng Junjie <873216071@qq.com>
 ;;; Copyright © 2021 Alexandru-Sergiu Marton <brown121407@posteo.ro>
 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -34,6 +35,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crates-io)
@@ -41,12 +43,14 @@
   #:use-module (gnu packages curl)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages fontutils)
+  #:use-module (gnu packages glib)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages jemalloc)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages ssh)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages rust)
   #:use-module (gnu packages tls)
@@ -440,6 +444,73 @@ characters, ASCII whitespace characters, other ASCII characters and non-ASCII.")
      "This package provides a command-line benchmarking tool.")
     (license (list license:expat license:asl2.0))))

+(define-public i3status-rust
+  (package
+    (name "i3status-rust")
+    (version "0.20.1")
+    (source (origin
+              (method git-fetch)
+              (uri
+               (git-reference
+                (url "https://github.com/greshake/i3status-rust")
+                (commit (string-append "v" version))))
+              (file-name (string-append name "-" version))
+              (patches (search-patches "i3status-rust-enable-unstable-features.patch"))
+              (sha256
+               (base32
+                "00gzm3g297s9bfp13vnb623p7dfac3g6cdhz2b3lc6l0kmnnqs1s"))))
+    (build-system cargo-build-system)
+    (native-inputs `(("pkg-config" ,pkg-config)))
+    (inputs `(("dbus" ,dbus)
+              ("pulseaudio" ,pulseaudio)
+              ("zlib" ,zlib)
+              ("openssl" ,openssl)
+              ("curl" ,curl)))
+    (arguments
+     `(#:features '("pulseaudio" "libpulse-binding")
+       #:cargo-inputs
+       (("rust-chrono" ,rust-chrono-0.4)
+        ("rust-chrono-tz" ,rust-chrono-tz-0.5)
+        ("rust-crossbeam-channel" ,rust-crossbeam-channel-0.5)
+        ("rust-curl" ,rust-curl-0.4) ("rust-dbus" ,rust-dbus-0.9)
+        ("rust-dbus-tree" ,rust-dbus-tree-0.9)
+        ("rust-lazy-static" ,rust-lazy-static-1)
+        ("rust-nix" ,rust-nix-0.20)
+        ("rust-nl80211" ,rust-nl80211-0.0.2)
+        ("rust-serde" ,rust-serde-1)
+        ("rust-serde-derive" ,rust-serde-derive-1)
+        ("rust-serde-json" ,rust-serde-json-1)
+        ("rust-signal-hook" ,rust-signal-hook-0.3)
+        ("rust-swayipc" ,rust-swayipc-2)
+        ("rust-toml" ,rust-toml-0.5)
+        ("rust-cpuprofiler" ,rust-cpuprofiler-0.0.4)
+        ("rust-inotify" ,rust-inotify-0.9)
+        ("rust-libpulse-binding" ,rust-libpulse-binding-2)
+        ("rust-maildir" ,rust-maildir-0.5)
+        ("rust-notmuch" ,rust-notmuch-0.6)
+        ("rust-progress" ,rust-progress-0.2)
+        ("rust-assert-fs" ,rust-assert-fs-1))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-resources-path
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((resources (string-append %output "/share")))
+               (substitute* "src/util.rs" (("/usr/share/i3status-rust") resources)))))
+         (add-after 'install 'install-resources
+           (lambda* (#:key outputs #:allow-other-keys)
+             (copy-recursively "files" (string-append %output "/share"))#t))
+         (add-after 'unpack 'enable-unstable-features
+           (lambda _
+             (setenv "RUSTC_BOOTSTRAP" "1")
+             #t)))))
+    (synopsis "i3status, written in pure Rust")
+    (description "i3status-rs is a feature-rich and resource-friendly replacement
+for i3status, written in pure Rust. It provides a way to display 'blocks' of
+system information (time, battery status, volume, etc) on the i3 bar. It is also
+compatible with sway.")
+    (home-page "https://github.com/greshake/i3status-rust")
+    (license license:gpl3)))
+
 (define-public ripgrep
   (package
     (name "ripgrep")
--
2.33.0




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#51193: Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4.
  2021-10-13 22:07 [bug#51193] Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4 phodina via Guix-patches via
                   ` (2 preceding siblings ...)
  2021-10-13 22:11 ` [bug#51193] Subject: [PATCH 4/4] gnu: Add i3status-rust phodina via Guix-patches via
@ 2021-11-08  8:55 ` Efraim Flashner
  2021-11-08 17:34 ` [bug#51193] [PATCH] gnu: Update i3status-rust phodina via Guix-patches via
  4 siblings, 0 replies; 6+ messages in thread
From: Efraim Flashner @ 2021-11-08  8:55 UTC (permalink / raw)
  To: 51193-done

[-- Attachment #1: Type: text/plain, Size: 282 bytes --]

I pushed these patches and forgot to close the bug. Patches pushed!

-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#51193] [PATCH] gnu: Update i3status-rust.
  2021-10-13 22:07 [bug#51193] Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4 phodina via Guix-patches via
                   ` (3 preceding siblings ...)
  2021-11-08  8:55 ` bug#51193: Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4 Efraim Flashner
@ 2021-11-08 17:34 ` phodina via Guix-patches via
  4 siblings, 0 replies; 6+ messages in thread
From: phodina via Guix-patches via @ 2021-11-08 17:34 UTC (permalink / raw)
  To: 51193

Hi Efraim,

Thanks for upstreaming.

Unfortunately I discovered some missing inputs when using full config file, not just dummy (only time and disks).

Also checked the source code and the Rust code invokes commands. This looks like it would need also wrap-program, right?

Here's a list:
https://github.com/greshake/i3status-rust/blob/38dfb061dcd37655c273110fd70f6b4e3ffb7a01/src/blocks/taskwarrior.rs#L145
https://github.com/greshake/i3status-rust/blob/629f9d90961c1a9815eb0f0ee60773e39dbca7a2/src/blocks/nvidia_gpu.rs#L190
https://github.com/greshake/i3status-rust/blob/38dfb061dcd37655c273110fd70f6b4e3ffb7a01/src/blocks/taskwarrior.rs#L145
https://github.com/greshake/i3status-rust/blob/38dfb061dcd37655c273110fd70f6b4e3ffb7a01/src/blocks/xrandr.rs#L104
https://github.com/greshake/i3status-rust/blob/38dfb061dcd37655c273110fd70f6b4e3ffb7a01/src/blocks/speedtest.rs#L53
https://github.com/greshake/i3status-rust/blob/974212179519feeaadd3fd7a9672d7475694e306/src/blocks/net.rs#L85
https://github.com/greshake/i3status-rust/blob/4d3e12d1adc1dfaa43a54cc3448b13fc9de93a89/src/blocks/dnf.rs#L112
https://github.com/greshake/i3status-rust/blob/27f8bf5519dbb50ac2311e1379f005d48e5005df/src/blocks/temperature.rs#L178
https://github.com/greshake/i3status-rust/blob/5a5f9218d82a4e884975d53a49b34541f108451e/src/blocks/kdeconnect.rs#L144
https://github.com/greshake/i3status-rust/blob/38dfb061dcd37655c273110fd70f6b4e3ffb7a01/src/blocks/keyboard_layout.rs#L63
https://github.com/greshake/i3status-rust/blob/febdcd51a6eaaa6070667b4ec1db3a6e01ed909b/src/blocks/sound.rs#L106
https://github.com/greshake/i3status-rust/blob/38dfb061dcd37655c273110fd70f6b4e3ffb7a01/src/blocks/ibus.rs#L297
https://github.com/greshake/i3status-rust/blob/master/src/blocks/sound.rs#L106

* gnu/packages/rust-apps (i3status-rust)[inputs]: Add alsa-utils and setxkbmap.

----8<----------cut here--------->8---
diff --git a/gnu/packages/rust-apps.scm b/gnu/packages/rust-apps.scm
index be60f3f376..2f05b313d6 100644
--- a/gnu/packages/rust-apps.scm
+++ b/gnu/packages/rust-apps.scm
@@ -55,7 +55,8 @@ (define-module (gnu packages rust-apps)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages rust)
   #:use-module (gnu packages tls)
-  #:use-module (gnu packages version-control))
+  #:use-module (gnu packages version-control)
+  #:use-module (gnu packages xorg))

 (define-public agate
   (package
@@ -450,23 +451,25 @@ (define-public i3status-rust
     (name "i3status-rust")
     (version "0.20.1")
     (source
-      (origin
-        (method git-fetch)
-        (uri (git-reference
-              (url "https://github.com/greshake/i3status-rust")
-              (commit (string-append "v" version))))
-        (file-name (git-file-name name version))
-        (patches (search-patches "i3status-rust-enable-unstable-features.patch"))
-        (sha256
-         (base32 "00gzm3g297s9bfp13vnb623p7dfac3g6cdhz2b3lc6l0kmnnqs1s"))))
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/greshake/i3status-rust")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (patches (search-patches "i3status-rust-enable-unstable-features.patch"))
+       (sha256
+        (base32 "00gzm3g297s9bfp13vnb623p7dfac3g6cdhz2b3lc6l0kmnnqs1s"))))
     (build-system cargo-build-system)
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (inputs
      `(("curl" ,curl)
+       ("alsa-utils" ,alsa-utils)
        ("dbus" ,dbus)
        ("pulseaudio" ,pulseaudio)
        ("openssl" ,openssl)
+       ("setxkbmap" ,setxkbmap)
        ("zlib" ,zlib)))
     (arguments
      `(#:features '("pulseaudio" "libpulse-binding")
--
2.33.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-08 17:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-13 22:07 [bug#51193] Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4 phodina via Guix-patches via
2021-10-13 22:10 ` [bug#51193] Subject: [PATCH 2/4] gnu: Add rust-libpulse-sys-1 phodina via Guix-patches via
2021-10-13 22:11 ` [bug#51193] Subject: [PATCH 3/4] gnu: Add rust-libpulse-binding-2 phodina via Guix-patches via
2021-10-13 22:11 ` [bug#51193] Subject: [PATCH 4/4] gnu: Add i3status-rust phodina via Guix-patches via
2021-11-08  8:55 ` bug#51193: Subject: [PATCH 1/4] gnu: Add rust-cpuprofiler-0.0.4 Efraim Flashner
2021-11-08 17:34 ` [bug#51193] [PATCH] gnu: Update i3status-rust phodina via Guix-patches via

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).