]> infiniteadaptability.org Git - channel/commitdiff
services: add nitter
authoralex <[email protected]>
Sat, 6 Dec 2025 18:31:58 +0000 (10:31 -0800)
committeralex <[email protected]>
Sat, 6 Dec 2025 20:46:09 +0000 (12:46 -0800)
This is a partially complete package/service implementation. The
services can't be fully completed because nim packges can't be built
by guix currently (network/git access is required).

infiniteadaptability/packages/nitter.scm [new file with mode: 0644]
infiniteadaptability/services/nitter.scm [new file with mode: 0644]

diff --git a/infiniteadaptability/packages/nitter.scm b/infiniteadaptability/packages/nitter.scm
new file mode 100644 (file)
index 0000000..93494fb
--- /dev/null
@@ -0,0 +1,411 @@
+(define-module (infiniteadaptability packages nitter)
+  #:use-module (gnu)
+  #:use-module (gnu packages certs)
+  #:use-module (gnu packages nim)
+  #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
+  #:use-module (guix build utils)
+  #:use-module (guix build-system gnu)
+  #:use-module (guix download)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module ((guix licenses)
+                #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module ((guix search-paths)
+                #:select ($SSL_CERT_DIR $SSL_CERT_FILE))
+  #:export (nitter))
+
+(define %cachedir
+  "./cache-home/.nimble/pkgcache")
+
+(define nim-packages
+  (origin
+    (method url-fetch)
+    (file-name "nim-official-packages")
+    (uri
+     "https://raw.githubusercontent.com/nim-lang/packages/master/packages.json")
+    (sha256 (base32 "1cvf9fdhrgypsq4b713d61wvx35dj8wqzm80f448asmr3y4sanis"))))
+
+(define ws-0.5.0
+  (origin
+    (method git-fetch)
+    (file-name "ws_0_5_0-checkout")
+    (uri (git-reference (url "https://github.com/treeform/ws")
+                        (commit "0.5.0")))
+    (sha256 (base32 "0j8z9jlvzb1h60v7rryvh2wx6vg99lra6i62whf3fknc53l641fz"))))
+
+(define ws
+  (origin
+    (method git-fetch)
+    (file-name "ws-checkout")
+    (uri (git-reference (url "https://github.com/treeform/ws")
+                        (commit "5ac521b72d7d4860fb394e5e1f9f08cf480e9822")))
+    (sha256 (base32 "0qv9knjdvhigmmarsyivpkaawyb0yjip2rycdnasqjsgf31pa26a"))))
+
+(define asynctools_pr_fix_compilation
+  (origin
+    (method git-fetch)
+    (file-name "asynctools_pr_fix_compilation-checkout")
+    (uri (git-reference (url "https://github.com/timotheecour/asynctools")
+                        (commit "b365f94ad134b1cbc031a64e4ecd3bebacd4ed15")))
+    (sha256 (base32 "0n54hkknxm5hdx68jc2syyxzs4nbz2hh5rwxa34chk12kbp326s2"))))
+
+(define sha1
+  (origin
+    (method git-fetch)
+    (file-name "sha1-checkout")
+    (uri (git-reference (url "https://github.com/onionhammer/sha1")
+                        (commit "92ccc5800bb0ac4865b275a2ce3c1544e98b48bc")))
+    (sha256 (base32 "00zvvd8ssy22srg74xzapknmgmi82v534npjdrk5805shswfhqdm"))))
+
+(define asynctools_pr_fix
+  (origin
+    (method git-fetch)
+    (file-name "asynctools_pr_fix-checkout")
+    (uri (git-reference (url "https://github.com/iffy/asynctools")
+                        (commit "17dbf4cd2fda1e59b32383fe1d817b3af01cd4ce")))
+    (sha256 (base32 "0wnikgrpir5iy8mp32y33ld07z0mwfdmbvh6k69hc0knz96hpfjv"))))
+
+(define dotenv_2_0_2
+  (origin
+    (method git-fetch)
+    (file-name "dotenv_2_0_2-checkout")
+    (uri (git-reference (url "https://github.com/euantorano/dotenv.nim")
+                        (commit "2.0.2")))
+    (sha256 (base32 "0dk0ixgpxmaz2kf12a3fvzdaknn38qnwgdhp7yag0m5fbhhz2kjc"))))
+
+(define dotenv_2_0_0
+  (origin
+    (method git-fetch)
+    (file-name "dotenv_2_0_0-checkout")
+    (uri (git-reference (url "https://github.com/euantorano/dotenv.nim")
+                        (commit "2.0.0")))
+    (sha256 (base32 "066r1zkragh2rrmw8gfy1849lldcqs4ccblmg1zkl35j2ajc3rc4"))))
+
+(define httpbeast_0_4_1
+  (origin
+    (method git-fetch)
+    (file-name "httpbeast_0_4_1-checkout")
+    (uri (git-reference (url "https://github.com/dom96/httpbeast")
+                        (commit "v0.4.1")))
+    (sha256 (base32 "1x12ypfj341gjg3rh7zjq1wns8rngfyky6gqgb92lyhlvs7h4xzj"))))
+
+(define httpbeast_0_3_0
+  (origin
+    (method git-fetch)
+    (file-name "httpbeast_0_3_0-checkout")
+    (uri (git-reference (url "https://github.com/dom96/httpbeast")
+                        (commit "v0.3.0")))
+    (sha256 (base32 "0v6qhyhavs5z1klsnkkxbp7s7pipmqh5flnbvqdjnciyd0rim7j2"))))
+
+(define asynctools
+  (origin
+    (method git-fetch)
+    (file-name "asynctools-checkout")
+    (uri (git-reference (url "https://github.com/cheatfate/asynctools")
+                        (commit "0e6bdc3ed5bae8c7cc9")))
+    (sha256 (base32 "111dzyvqlg1r1jngcz3d9px8kfbxpcdi8phs26bxkmbxzjkwrmmv"))))
+
+(define jester
+  (origin
+    (method git-fetch)
+    (file-name "jester-checkout")
+    (uri (git-reference (url "https://github.com/dom96/jester")
+                        (commit "baca3f")))
+    (sha256 (base32 "0i8rxsbp5yd9dasis650vqppika43mzfsls4fc7cz8k5j8xpd6zc"))))
+
+(define karax
+  (origin
+    (method git-fetch)
+    (file-name "karax-checkout")
+    (uri (git-reference (url "https://github.com/karaxnim/karax")
+                        (commit "5cf360c")))
+    (sha256 (base32 "1fh0jcjlw0vfqmr5dmhk436g569qvcpml9f981x28wmvm1511z2c"))))
+
+(define sass
+  (origin
+    (method git-fetch)
+    (file-name "sass-checkout")
+    (uri (git-reference (url "https://github.com/dom96/sass")
+                        (commit "7dfdd03")))
+    (sha256 (base32 "19d78787k97l5cis81800hxa9qjr0yzjshlzdp727gh6pn8kc8fj"))))
+
+(define nimcrypto
+  (origin
+    (method git-fetch)
+    (file-name "nimcrypto-checkout")
+    (uri (git-reference (url "https://github.com/cheatfate/nimcrypto")
+                        (commit "a079df9")))
+    (sha256 (base32 "1dmdmgb6b9m5f8dyxk781nnd61dsk3hdxqks7idk9ncnpj9fng65"))))
+
+(define markdown
+  (origin
+    (method git-fetch)
+    (file-name "markdown-checkout")
+    (uri (git-reference (url "https://github.com/soasme/nim-markdown")
+                        (commit "158efe3")))
+    (sha256 (base32 "1701q0i8yd9rrjraf5fzgcvilwnwgw3wyzzfwpr2drmn3x9pd8fj"))))
+
+(define packedjson
+  (origin
+    (method git-fetch)
+    (file-name "packedjson-checkout")
+    (uri (git-reference (url "https://github.com/Araq/packedjson")
+                        (commit "9e6fbb6")))
+    (sha256 (base32 "09yxshkfpacgl6x8f77snjcwz37r519vh7rrnqrnh5npvgk3h24j"))))
+
+(define supersnappy
+  (origin
+    (method git-fetch)
+    (file-name "supersnappy-checkout")
+    (uri (git-reference (url "https://github.com/guzba/supersnappy")
+                        (commit "6c94198")))
+    (sha256 (base32 "0gxy7ijm4d2i4dkb64wwq51gns0i2d3d3rrd9cra7fyiahaph4xi"))))
+
+(define redpool
+  (origin
+    (method git-fetch)
+    (file-name "redpool-checkout")
+    (uri (git-reference (url "https://github.com/zedeus/redpool")
+                        (commit "8b7c1db")))
+    (sha256 (base32 "10xh5fhwnahnq1nf6j69vvnbi55kixa0ari630gr6cdx80arvbs6"))))
+
+(define nimredis
+  (origin
+    (method git-fetch)
+    (file-name "nimredis-checkout")
+    (uri (git-reference (url "https://github.com/zedeus/redis")
+                        (commit "d0a0e6f")))
+    (sha256 (base32 "166kzflb3wgwvqnv9flyynp8b35xby617lxmk0yas8i4m6vjl00f"))))
+
+(define zippy
+  (origin
+    (method git-fetch)
+    (file-name "zippy-checkout")
+    (uri (git-reference (url "https://github.com/guzba/zippy")
+                        (commit "ca5989a")))
+    (sha256 (base32 "0rk31ispck48ilvzs0lxpp7z6y238a7d7dh7lmlfwi5i7hx13la6"))))
+
+(define flatty
+  (origin
+    (method git-fetch)
+    (file-name "flatty-checkout")
+    (uri (git-reference (url "https://github.com/treeform/flatty")
+                        (commit "e668085")))
+    (sha256 (base32 "0886lk20rg1pq56jsz1jjd8vrdz46lgdaxvp97az06mcawhbabbz"))))
+
+(define jsony
+  (origin
+    (method git-fetch)
+    (file-name "jsony-checkout")
+    (uri (git-reference (url "https://github.com/treeform/jsony")
+                        (commit "1de1f08")))
+    (sha256 (base32 "0rj205cs3v6g80h8ys9flbdq4wyd1csmkwdxv0lz21972zcsrcfh"))))
+
+(define oauth
+  (origin
+    (method git-fetch)
+    (file-name "oauth-checkout")
+    (uri (git-reference (url "https://github.com/CORDEA/oauth")
+                        (commit "b8c163b")))
+    (sha256 (base32 "0k5slyzjngbdr6g0b0dykhqmaf8r8n2klbkg2gpid4ckm8hg62v5"))))
+
+(define nitter
+  (let ((version "0.1.0")
+        (commit "e40c61a6ae76431c570951cc4925f38523b00a82")
+        (revision 0))
+    (package
+      (name "nitter")
+      (version (if (zero? revision) version
+                   (string-append version "-"
+                                  (number->string revision) "."
+                                  (string-take commit 7))))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/zedeus/nitter")
+               (commit commit)))
+         (sha256
+          (base32 "1xqgrbycdg8c25py630d18414kj0jgnj46sqaxl0zrh2gcvjiv30"))
+         (file-name (string-append "nitter-" version "-checkout"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            (delete 'configure)
+            (add-after 'unpack 'copy-deps:www
+              (lambda _
+                (setenv "HOME" "./cache-home")
+                (mkdir-p #$%cachedir)
+                (copy-recursively #$(this-package-input
+                                     "nim-official-packages")
+                 "./cache-home/.nimble/packages_official.json"
+                 #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "jester-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_dom96jester_#baca3f")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "karax-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_karaxnimkarax_#5cf360c")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "sass-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_dom96sass_#7dfdd03")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "nimcrypto-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_cheatfatenimcrypto_#a079df9")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "markdown-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_soasmenimmarkdown_#158efe3")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "packedjson-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_Araqpackedjson_#9e6fbb6")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "supersnappy-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_guzbasupersnappy_#6c94198")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "redpool-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_zedeusredpool_#8b7c1db")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "nimredis-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_zedeusredis_#d0a0e6f")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "zippy-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_guzbazippy_#ca5989a")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "flatty-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_treeformflatty_#e668085")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "jsony-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_treeformjsony_#1de1f08")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "ws-checkout")
+                                  (string-append #$%cachedir
+                                                 "/githubcom_treeformws")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "ws_0_5_0-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_treeformws_0.5.0")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input
+                                     "asynctools_pr_fix_compilation-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_timotheecourasynctools_#pr_fix_compilation")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "sha1-checkout")
+                                  (string-append #$%cachedir
+                                                 "/githubcom_onionhammersha1")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input
+                                     "asynctools_pr_fix-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_iffyasynctools_#pr_fix_for_latest")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input
+                                     "dotenv_2_0_0-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_euantoranodotenv_2.0.0")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input
+                                     "dotenv_2_0_2-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_euantoranodotenv_2.0.2")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input
+                                     "httpbeast_0_3_0-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_dom96httpbeast_0.3.0")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input
+                                     "httpbeast_0_4_1-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_dom96httpbeast_0.4.1")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "asynctools-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_cheatfateasynctools_#0e6bdc3ed5bae8c7cc9")
+                                  #:keep-permissions? #f)
+                (copy-recursively #$(this-package-input "oauth-checkout")
+                                  (string-append #$%cachedir
+                                   "/githubcom_CORDEAoauth_#b8c163b")
+                                  #:keep-permissions? #f)))
+            (replace 'build
+              (lambda* (#:key inputs #:allow-other-keys)
+                (let* ((nim (assoc-ref inputs "nim"))
+                       (nimble (string-append nim "/bin/nimble")))
+                  (setenv "HOME" "./cache-home")
+                  (mkdir-p "./cache-home")
+                  (invoke nimble "--nimbleDir:./cache-home/.nimble" "lock"
+                          "--verbose" "--debug")
+                  (invoke nimble
+                          "--nimbleDir:./cache-home/.nimble"
+                          "--offline"
+                          "setup"
+                          "--verbose"
+                          "--debug")
+                  (invoke nimble
+                          "build"
+                          "--nimbleDir:./cache-home/.nimble"
+                          "--offline"
+                          "-d:danger"
+                          "--mm:refc"
+                          "--verbose")
+                  (invoke nimble "scss")
+                  (invoke nimble "md")))))))
+      (inputs (list jester
+                    karax
+                    sass
+                    nimcrypto
+                    markdown
+                    packedjson
+                    supersnappy
+                    redpool
+                    nimredis
+                    zippy
+                    flatty
+                    jsony
+                    oauth
+                    ws-0.5.0
+                    ws
+                    asynctools_pr_fix_compilation
+                    sha1
+                    asynctools_pr_fix
+                    dotenv_2_0_2
+                    dotenv_2_0_0
+                    httpbeast_0_4_1
+                    httpbeast_0_3_0
+                    asynctools
+                    nss-certs
+                    nim
+                    nim-packages
+                    git))
+      (home-page "https://github.com/zedeus/nitter")
+      (synopsis
+       "A free and open source alternative Twitter front-end focused on privacy and performance.")
+      (description
+       "A free and open source alternative Twitter front-end focused on privacy and performance.
+Inspired by the Invidious project.
+
+    No JavaScript or ads
+    All requests go through the backend, client never talks to Twitter
+    Prevents Twitter from tracking your IP or JavaScript fingerprint
+    Uses Twitter's unofficial API (no developer account required)
+    Lightweight (for @nim_lang, 60KB vs 784KB from twitter.com)
+    RSS feeds
+    Themes
+    Mobile support (responsive design)
+    AGPLv3 licensed, no proprietary instances permitted")
+      (license license:agpl3))))
diff --git a/infiniteadaptability/services/nitter.scm b/infiniteadaptability/services/nitter.scm
new file mode 100644 (file)
index 0000000..ef4253c
--- /dev/null
@@ -0,0 +1,42 @@
+(define-module (infiniteadaptability services nitter)
+  #:use-module (gnu)
+  #:use-module (gnu services)
+  #:use-module (gnu services shepherd)
+  #:use-module (guix records)
+  ;; #:use-module (infiniteadaptability packages nitter)
+  #:export (nitter-configuration nitter-service-type))
+
+(define-record-type* <nitter-configuration> nitter-configuration
+                     make-nitter-configuration
+  nitter-configuration?
+
+  (nitter nitter-configuration-nitter ; executable name
+          (default "./nitter"))
+
+  (working-directory nitter-configuration-working-directory ; absolute path
+          (default "/home/nitter/nitter"))
+
+  (user nitter-configuration-user
+        (default "nitter")))
+
+(define (nitter-service config)
+  "Return a <nitter-service> for nitter with CONFIG."
+  (list (shepherd-service (documentation "nitter service")
+                          (provision '(nitter))
+                          (requirement '(networking))
+                          (auto-start? #f)
+                          (start #~(make-forkexec-constructor (list #$(nitter-configuration-nitter
+                                                                       config))
+                                                              #:user #$(nitter-configuration-user
+                                                                        config)
+                                                             #:directory #$(nitter-configuration-working-directory config)
+                                                              #:log-file (string-append
+                                                                          "/var/log/nitter.log")))
+                          (stop #~(make-kill-destructor)))))
+
+(define nitter-service-type
+  (service-type (name 'nitter)
+                (default-value (nitter-configuration))
+                (description "Nitter service")
+                (extensions (list (service-extension
+                                   shepherd-root-service-type nitter-service)))))