From 4e2021adcd41e19b67f57bbb3eca9087127fd477 Mon Sep 17 00:00:00 2001 From: qby <5731587-qby@users.noreply.gitlab.com> Date: Thu, 18 Jan 2024 19:22:25 +0000 Subject: [PATCH] Add new file --- nongnu/packages/brave.scm | 56 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 nongnu/packages/brave.scm diff --git a/nongnu/packages/brave.scm b/nongnu/packages/brave.scm new file mode 100644 index 00000000..ed9abf89 --- /dev/null +++ b/nongnu/packages/brave.scm @@ -0,0 +1,56 @@ +(use-modules (ice-9 popen) + (ice-9 rdelim)) + +(define (get-hash path) + (let* ((hash-command (string-append "guix hash -rx '" path "'")) + (hash-pipe (open-input-pipe hash-command)) + (hash (read-line hash-pipe))) + (close-pipe hash-pipe) + hash)) + +(define version "1.61.120") +(define url (string-append "https://github.com/brave/brave-browser/archive/refs/tags/v" version ".tar.gz")) +(define file-path (string-append "/tmp/" version ".tar.gz")) + +;; Download file +(system (string-append "wget -O " file-path " " url)) + +(define-module (my-packages brave) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix build-system gnu) + #:use-module ((guix licenses) #:prefix license:)) + +;; Calculate hash +(define hash (get-hash file-path)) + +(define-public brave + (package + (name "brave") + (version version) + (source (origin + (method url-fetch) + (uri url) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 (base32 hash)))) + (build-system gnu-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-before 'configure 'pre-configure + (lambda _ + (mkdir "build") + (invoke "npm" "install") + (invoke "npm" "run" "init") + (invoke "npm" "run" "build") + (invoke "npm" "start") + (system* "cp" "-r" "build/*" "/gnu/store") + #t))))) + (inputs + `(("node" ,node) + ("git" ,git) + ("python3" ,python))) + (home-page "https://www.brave.com") + (synopsis "Fast, private and secure browser for PC, Mac and mobile") + (description "An open source browser derived from Chrome that focuses on privacy") + (license license:bsd-3))) ;; Update the license if different