(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