desktop.scm (9844B)


      1 (define-module (mt packages desktop)
      2   #:use-module (guix packages)
      3   #:use-module (guix licenses)
      4   #:use-module (guix download)
      5   #:use-module (guix git)
      6   #:use-module (guix git-download)
      7   #:use-module (guix build-system cargo)
      8   #:use-module (guix build-system copy)
      9   #:use-module (guix build-system meson)
     10   #:use-module (guix build-system trivial)
     11   #:use-module (guix gexp)
     12   #:use-module (gnu packages)
     13   #:use-module (gnu packages authentication)
     14   #:use-module (gnu packages base)
     15   #:use-module (gnu packages bash)
     16   #:use-module (gnu packages freedesktop)
     17   #:use-module (gnu packages gnome)
     18   #:use-module (gnu packages golang-crypto)
     19   #:use-module (gnu packages glib)
     20   #:use-module (gnu packages gtk)
     21   #:use-module (gnu packages man)
     22   #:use-module (gnu packages pkg-config)
     23   #:use-module (gnu packages shells)
     24   #:use-module (gnu packages version-control)
     25   #:use-module (gnu packages wm)
     26   #:use-module (gnu packages xdisorg)
     27   #:use-module (nonguix build-system chromium-binary)
     28   #:use-module (mt packages rust-crates))
     29 
     30 ;; TODO: Verify that this isn't mega scuffed (read: validate deps)
     31 (define-public webcord
     32   (package
     33     (name "webcord")
     34     (version "4.12.1")
     35     (source
     36      (origin
     37        (method url-fetch)
     38        (uri
     39         (string-append
     40          "https://github.com/SpacingBat3/WebCord/releases/download/v"
     41          version "/webcord_" version "_amd64.deb"))
     42        (sha256
     43         (base32 "0icm9wf1bg5mlr9zkvw8hm45ihq2qhz1a8ancxjrlsp5pji04fyx"))))
     44     (supported-systems '("x86_64-linux"))
     45     (build-system chromium-binary-build-system)
     46     (arguments
     47      (list #:validate-runpath? #f ; TODO: fails on wrapped binary and included other files
     48            #:wrapper-plan
     49            #~'(("lib/webcord/webcord" (("out" "/lib/webcord"))))
     50            #:phases
     51            #~(modify-phases %standard-phases
     52                (replace 'binary-unpack
     53                  (lambda _
     54                    (mkdir "binary")
     55                    (chdir "binary")
     56                    (invoke "ar" "x" "../webcord_4.12.1_amd64.deb")
     57                    (invoke "tar" "xvf" "data.tar.zst")
     58                    (invoke "rm" "-rvf"
     59                            "control.tar.zst"
     60                            "data.tar.zst"
     61                            "../webcord_4.12.1_amd64.deb")
     62                      ))
     63                (add-after 'binary-unpack 'setup-cwd
     64                  (lambda _
     65                    (copy-recursively "usr/" ".")
     66                    ;; Remove unneeded files.
     67                    (delete-file-recursively "usr")
     68                    ;; Fix the .desktop file binary location.
     69                    (substitute* '("share/applications/webcord.desktop")
     70                      (("Exec=webcord")
     71                       (string-append "Exec=" #$output "/bin/webcord"))
     72 )))
     73                )))
     74     (home-page "https://github.com/SpacingBat3/WebCord/")
     75     (synopsis "A Discord and SpaceBar electron-based client implemented without Discord API.")
     76     (description #f)
     77     (license #f)))
     78 
     79 ;; TODO: Make my own suckless wayland widget engine
     80 
     81 ;; Thanks, bdunahu!
     82 (define-public eww
     83   (let ((commit "fddb4a09b107237819e661151e007b99b5cab36d")
     84         (revision "2"))
     85     (package
     86       (name "eww")
     87       (version (git-version "0.6.0" revision commit))
     88       (source
     89        (origin
     90          (method git-fetch)
     91          (uri (git-reference
     92                 (url "https://github.com/elkowar/eww")
     93                 (commit commit)))
     94          (file-name (git-file-name name version))
     95          (sha256
     96           (base32 "0ihgcxppywpcp24zhws1if6h7cxbrq2vd53wyh36j5mxylpbi59w"))))
     97       (build-system cargo-build-system)
     98       (arguments
     99        `(#:install-source? #f
    100          #:cargo-install-paths '("crates/eww")))
    101       (inputs (cons* gdk-pixbuf
    102                      glib
    103                      gtk+
    104                      gtk-layer-shell
    105                      libdbusmenu
    106                      (cargo-inputs 'eww #:module '(mt packages rust-crates))))
    107       (native-inputs (list pkg-config))
    108       (home-page "https://elkowar.github.io/eww")
    109       (synopsis "Widget system that works in any window manager")
    110       (description
    111        "Eww (Elkowars Wacky Widgets) is a standalone widget system made in Rust
    112 that allows you to implement your own, custom widgets in any window manager.
    113 
    114 Configured in yuck, a language based around S-expressions and themed using CSS,
    115 it is easy to customize and provides all the flexibility you need.")
    116       (license expat))))
    117 
    118 (define-public gruvbox-plus-icon-pack
    119   (package
    120     (name "gruvbox-plus-icon-pack")
    121     (version "6.3.0")
    122     (source (origin
    123               (method url-fetch/zipbomb)
    124               (uri (string-append
    125                     "https://github.com/SylEleuth/gruvbox-plus-icon-pack/releases/download/v"
    126                     version "/gruvbox-plus-icon-pack-" version ".zip"))
    127               (sha256
    128                (base32
    129                 "0m8r0lifrgva8f79h66hgyaarjqq5km1fj2mx7jaaq21jw5kd8rw"))))
    130    (build-system copy-build-system)
    131    (arguments
    132     `(#:install-plan `(("Gruvbox-Plus-Dark" "share/icons/")
    133                        ("Gruvbox-Plus-Light" "share/icons/"))))
    134    (home-page "https://github.com/SylEleuth/gruvbox-plus-icon-pack")
    135    (synopsis "Gruvbox Plus icon pack for Linux desktops based on Gruvbox color theme.")
    136    (description #f)
    137    (license gpl3+)))
    138 
    139 (define-public lavalauncher
    140   (package
    141     (name "lavalauncher")
    142     (version "2.1.1")
    143     (source (origin
    144               (method url-fetch)
    145               (uri (string-append "https://git.sr.ht/~leon_plickat/lavalauncher/archive/v"
    146                                   version ".tar.gz"))
    147               (sha256
    148                (base32
    149                 "0fvw970yx4p8yvbw99q8ca6c3kwq92fk8ja3smbws651007dn7lm"))))
    150     (build-system meson-build-system)
    151     (native-inputs
    152      (list pkg-config
    153            scdoc))
    154     (inputs
    155      (list wayland
    156            wayland-protocols
    157            libxkbcommon
    158            cairo
    159            librsvg))
    160     (home-page "https://git.sr.ht/~leon_plickat/lavalauncher")
    161     (synopsis "LavaLauncher is a simple launcher panel for Wayland desktops.")
    162     (description #f)
    163     (license gpl3+)))
    164 
    165 ;; Add some extra options to sway, generally for ricing
    166 (define-public sway-with-options
    167   (package
    168    (inherit sway)
    169    (source (origin
    170             (inherit (package-source sway))
    171             (patches
    172              (list
    173               ;; Replace the hardcoded border width with an option
    174               (local-file "patches/sway-border-width.diff")))))))
    175 
    176 ;; dash is a good POSIX shell for scripts in my experience
    177 (define dash-w-sh-symlink
    178   (package
    179     (inherit dash)
    180     (arguments
    181      `(#:phases
    182        (modify-phases %standard-phases
    183          (add-after 'install 'install-sh-symlink
    184            (lambda* (#:key outputs #:allow-other-keys)
    185              ;; Add a `sh' -> `dash' link.
    186              (let ((out (assoc-ref outputs "out")))
    187                (with-directory-excursion (string-append out "/bin")
    188                  (symlink "dash" "sh")
    189                  #t)))))))))
    190 
    191 ;; TODO: Rewrite sta.sh with libage somehow? This is slightly jank.
    192 ;; I will probably do a C or Rust rewrite in the future.
    193 (define-public age-with-stdin-passphrase
    194   (package
    195     (inherit age)
    196     (source (origin
    197               (inherit (package-source age))
    198               (patches (list
    199                         (local-file "patches/age-passphrase-from-stdin.patch")))))))
    200 
    201 ;; Package
    202 (define-public stash
    203   (package
    204     (name "stash")
    205     (version "0.1.0-1")
    206     ;; Use local directory as source
    207     (source (origin
    208               (method git-fetch)
    209               (uri (git-reference
    210                      (url "git://monastech.xyz/stash")
    211                      (commit "f71553bbc412bfa989fb6ef51fb9a186fcd5521b")))
    212               (sha256
    213                (base32
    214                 "1pz4gb98q6ncxxbwzank09xf2038d6jmh5phrd5k9918spf9ly79"))))
    215     (build-system trivial-build-system)
    216     (arguments
    217      `(#:modules ((guix build utils))
    218        #:builder
    219        (begin
    220          (use-modules (guix build utils))
    221          (let* ((bin-dir  (string-append %output "/bin"))
    222                 (bin      (string-append bin-dir "/sta.sh"))
    223                 (get-input-bin (lambda (input-name bin-name)
    224                                  (string-append
    225                                   (assoc-ref %build-inputs input-name)
    226                                   (string-append "/bin/" bin-name))))
    227                 (wrapper-helper (lambda (var value)
    228                                   `(,var ":" = (,(string-append
    229                                                   "${" var ":=" value "}")))))
    230                 (copy-script (lambda (file dest)
    231                                (copy-file file dest)
    232                                (patch-shebang dest
    233                                               (list (string-append
    234                                                      (assoc-ref %build-inputs "dash")
    235                                                       "/bin")))
    236                                (chmod dest #o555))))
    237            (mkdir-p bin-dir)
    238            (copy-script (string-append (assoc-ref %build-inputs "source") "/sta.sh")
    239                         bin)
    240            (wrap-program bin #:sh (get-input-bin "bash-minimal" "bash")
    241              (wrapper-helper "TOFI" (get-input-bin "tofi" "tofi"))
    242              (wrapper-helper "AGE" (get-input-bin "age" "age"))
    243              (wrapper-helper "AGEKEYGEN" (get-input-bin "age" "age-keygen"))
    244              (wrapper-helper "OATHTOOL" (get-input-bin "oath-toolkit" "oathtool")))))))
    245     (inputs (list bash-minimal ;; Needed for wrap-program
    246                   dash-w-sh-symlink
    247                   tofi
    248                   age-with-stdin-passphrase
    249                   oath-toolkit))
    250     (home-page "https://git.loquat.dev/stash")
    251     (synopsis "Simple password manager shell script")
    252     (description #f)
    253     (license gpl3+)))
    254 
    255 webcord