diff options
Diffstat (limited to 'px/packages/activitywatch.scm')
-rw-r--r-- | px/packages/activitywatch.scm | 256 |
1 files changed, 144 insertions, 112 deletions
diff --git a/px/packages/activitywatch.scm b/px/packages/activitywatch.scm index a4228b0..8f54e37 100644 --- a/px/packages/activitywatch.scm +++ b/px/packages/activitywatch.scm @@ -1,5 +1,6 @@ (define-module (px packages activitywatch) - #:use-module ((guix licenses) #:prefix license:) + #:use-module ((guix licenses) + #:prefix license:) #:use-module (guix download) #:use-module (guix packages) #:use-module (guix utils) @@ -24,123 +25,154 @@ (define* (make-aw-release-asset version asset hash) (origin (method url-fetch) - (uri - (string-append - "https://github.com/ActivityWatch/activitywatch/releases/download/v" - version "/" asset "-v" version "-" - (match (or (%current-system) (%current-target-system)) - ("x86_64-linux" "linux-x86_64") - ("i686-linux" "linux-ia32") - ("aarch64-linux" "linux-arm64") - ("armhf-linux" "linux-armv7l")) - ".zip")) - (sha256 - (base32 hash)))) + (uri (string-append + "https://github.com/ActivityWatch/activitywatch/releases/download/v" + version + "/" + asset + "-v" + version + "-" + (match (or (%current-system) + (%current-target-system)) + ("x86_64-linux" "linux-x86_64") + ("i686-linux" "linux-ia32") + ("aarch64-linux" "linux-arm64") + ("armhf-linux" "linux-armv7l")) + ".zip")) + (sha256 (base32 hash)))) (define-public activitywatch (package (name "activitywatch") (version "0.11.0") - (source #f) + (source + #f) (build-system binary-build-system) (arguments - `(#:patchelf-plan - `(("opt/activitywatch/aw-qt" - ("libxkbcommon" "xkeyboard-config" "libxcb" "glibc" "gcc:lib")) - ("opt/activitywatch/aw-server/aw-server" ("glibc")) - ("opt/activitywatch/aw-server-rust/aw-server-rust" ("glibc")) - ("opt/activitywatch/aw-watcher-afk/aw-watcher-afk" ("glibc")) - ("opt/activitywatch/aw-watcher-window/aw-watcher-window" ("glibc"))) - #:phases - (modify-phases %standard-phases - (replace 'unpack - (lambda* (#:key inputs outputs #:allow-other-keys) - (invoke "unzip" (assoc-ref inputs "activitywatch")) - (mkdir "opt") - (invoke "mv" "activitywatch" "opt/") - (substitute* '("opt/activitywatch/aw-qt.desktop") - (("aw-qt") (string-append %output "/bin/aw-qt"))) - ;; remove for conflicting issue with libpng - (invoke "rm" "opt/activitywatch/libz.so.1") - ;; mv desktop file - (mkdir-p "share/applications/") - (invoke "mv" "opt/activitywatch/aw-qt.desktop" "share/applications/") - ;; - (mkdir-p "share/icons/hicolor/512x512/apps/") - (invoke "cp" "opt/activitywatch/aw-server/aw_server/static/static/logo.png" "share/icons/hicolor/512x512/apps/activitywatch.png") - #t)) - (add-after 'install 'symlink-binary-file-and-cleanup - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (realexecpath (string-append %output "/opt/activitywatch/aw-qt ")) - (sh_path (string-append %output "/bin/aw-qt")) - (sh_content (string-append "#!" (assoc-ref inputs "bash") "/bin/bash\n" - "export ROCKET_ENV=production\n" - "if [ $# -eq 0 ]; then " - realexecpath "--autostart-modules aw-server-rust,aw-watcher-afk,aw-watcher-window;" - "else " - realexecpath "$@;" - "fi"))) - (invoke "rm" (string-append %output "/environment-variables")) - (mkdir-p (string-append %output "/bin")) - (with-output-to-file sh_path - (lambda _ (format #t sh_content))) - (chmod sh_path #o555)) - #t)) - (add-after 'install 'wrap-where-patchelf-does-not-work - (lambda* (#:key inputs outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out"))) - (wrap-program (string-append out "/opt/activitywatch/aw-qt") - `("QT_XKB_CONFIG_ROOT" ":" - prefix - (,(string-join - (list - (string-append (assoc-ref inputs "xkeyboard-config") "/share/X11/") - out) - ":")))) - (wrap-program (string-append out "/opt/activitywatch/aw-qt") - `("FONTCONFIG_PATH" ":" - prefix - (,(string-join - (list - (string-append (assoc-ref inputs "fontconfig") "/etc/fonts") - out) - ":")))) - (wrap-program (string-append out "/opt/activitywatch/aw-qt") - `("LD_LIBRARY_PATH" ":" - prefix - (,(string-join - (list - (string-append (assoc-ref inputs "mesa") "/lib") - (string-append (assoc-ref inputs "fontconfig") "/lib") - (string-append (assoc-ref inputs "zlib") "/lib") - (string-append (assoc-ref inputs "libxcb") "/lib") - (string-append (assoc-ref inputs "glibc") "/lib") - (string-append (assoc-ref inputs "gcc") "/lib") - (string-append (assoc-ref inputs "freetype") "/lib") - (string-append out "/opt/activitywatch") - out) - ":"))))) - #t))))) - (native-inputs - `(("unzip" ,unzip))) - (inputs - `(("activitywatch" - ,(make-aw-release-asset - version "activitywatch" - "1w62s9y8z6yn2mv55npsg1rfi2az4lim62v4awxwq1xzx4249pi0")) - ("gcc:lib" ,gcc "lib") - ("gcc" ,gcc "lib") - ("glibc" ,glibc) - ("fontconfig" ,fontconfig) - ("freetype" ,freetype) - ("libxcb" ,libxcb) - ("libxkbcommon" ,libxkbcommon) - ("mesa" ,mesa) - ("xkeyboard-config" ,xkeyboard-config) - ("zlib" ,zlib) - ("bash-minimal" ,bash-minimal))) + `(#:patchelf-plan `(("opt/activitywatch/aw-qt" ("libxkbcommon" + "xkeyboard-config" + "libxcb" "glibc" + "gcc:lib")) + ("opt/activitywatch/aw-server/aw-server" ("glibc")) + ("opt/activitywatch/aw-server-rust/aw-server-rust" ("glibc")) + ("opt/activitywatch/aw-watcher-afk/aw-watcher-afk" ("glibc")) + ("opt/activitywatch/aw-watcher-window/aw-watcher-window" + ("glibc"))) + #:phases (modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key inputs outputs #:allow-other-keys) + (invoke "unzip" + (assoc-ref inputs "activitywatch")) + (mkdir "opt") + (invoke "mv" "activitywatch" "opt/") + (substitute* '("opt/activitywatch/aw-qt.desktop") + (("aw-qt") + (string-append %output "/bin/aw-qt"))) + ;; remove for conflicting issue with libpng + (invoke "rm" "opt/activitywatch/libz.so.1") + ;; mv desktop file + (mkdir-p "share/applications/") + (invoke "mv" "opt/activitywatch/aw-qt.desktop" + "share/applications/") + ;; + (mkdir-p "share/icons/hicolor/512x512/apps/") + (invoke "cp" + "opt/activitywatch/aw-server/aw_server/static/static/logo.png" + "share/icons/hicolor/512x512/apps/activitywatch.png") + #t)) + (add-after 'install 'symlink-binary-file-and-cleanup + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (realexecpath (string-append %output + "/opt/activitywatch/aw-qt ")) + (sh_path (string-append %output "/bin/aw-qt")) + (sh_content (string-append "#!" + (assoc-ref inputs "bash") + "/bin/bash\n" + "export ROCKET_ENV=production\n" + "if [ $# -eq 0 ]; then " + realexecpath + "--autostart-modules aw-server-rust,aw-watcher-afk,aw-watcher-window;" + "else " + realexecpath + "$@;" + "fi"))) + (invoke "rm" + (string-append %output + "/environment-variables")) + (mkdir-p (string-append %output "/bin")) + (with-output-to-file sh_path + (lambda _ + (format #t sh_content))) + (chmod sh_path #o555)) #t)) + (add-after 'install 'wrap-where-patchelf-does-not-work + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (wrap-program (string-append out + "/opt/activitywatch/aw-qt") + `("QT_XKB_CONFIG_ROOT" ":" prefix + (,(string-join (list (string-append (assoc-ref + inputs + "xkeyboard-config") + "/share/X11/") + out) ":")))) + (wrap-program (string-append out + "/opt/activitywatch/aw-qt") + `("FONTCONFIG_PATH" ":" prefix + (,(string-join (list (string-append (assoc-ref + inputs + "fontconfig") + "/etc/fonts") + out) ":")))) + (wrap-program (string-append out + "/opt/activitywatch/aw-qt") + `("LD_LIBRARY_PATH" ":" prefix + (,(string-join (list (string-append (assoc-ref + inputs "mesa") + "/lib") + (string-append (assoc-ref + inputs + "fontconfig") + "/lib") + (string-append (assoc-ref + inputs "zlib") + "/lib") + (string-append (assoc-ref + inputs + "libxcb") + "/lib") + (string-append (assoc-ref + inputs + "glibc") + "/lib") + (string-append (assoc-ref + inputs "gcc") + "/lib") + (string-append (assoc-ref + inputs + "freetype") + "/lib") + (string-append out + "/opt/activitywatch") + out) ":"))))) #t))))) + (native-inputs `(("unzip" ,unzip))) + (inputs `(("activitywatch" ,(make-aw-release-asset version "activitywatch" + "1w62s9y8z6yn2mv55npsg1rfi2az4lim62v4awxwq1xzx4249pi0")) + ("gcc:lib" ,gcc "lib") + ("gcc" ,gcc "lib") + ("glibc" ,glibc) + ("fontconfig" ,fontconfig) + ("freetype" ,freetype) + ("libxcb" ,libxcb) + ("libxkbcommon" ,libxkbcommon) + ("mesa" ,mesa) + ("xkeyboard-config" ,xkeyboard-config) + ("zlib" ,zlib) + ("bash-minimal" ,bash-minimal))) (home-page "https://activitywatch.net/") - (synopsis "ActivityWatch is an automatic time-tracking software which helps you keep track of what you do.") - (description "ActivityWatch is about recording our digital lives, an evergrowing part of our lives in general, and the new opportunities enabled by such a record.") + (synopsis + "ActivityWatch is an automatic time-tracking software which helps you keep track of what you do.") + (description + "ActivityWatch is about recording our digital lives, an evergrowing part of our lives in general, and the new opportunities enabled by such a record.") (license license:mpl2.0))) |