🗝
summary refs log tree commit diff
path: root/packages
diff options
context:
space:
mode:
authormia <mia@mia.jetzt>2024-06-08 22:56:05 -0700
committermia <mia@mia.jetzt>2024-06-08 22:56:05 -0700
commit8cf813ff033bbc98a7dd40db6ac11e2e35c7e997 (patch)
treea451059194cbd4ba90993ebdaced4749448ec4df /packages
downloadasylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.tar.gz
asylum-8cf813ff033bbc98a7dd40db6ac11e2e35c7e997.zip
initial commit
Diffstat (limited to 'packages')
-rw-r--r--packages/.gitignore9
-rw-r--r--packages/aur.ini8
-rw-r--r--packages/aur.py121
-rw-r--r--packages/cgit-syntect-bat/.gitignore1
-rw-r--r--packages/cgit-syntect-bat/PKGBUILD28
-rw-r--r--packages/cgit-syntect/.gitignore1
-rw-r--r--packages/cgit-syntect/PKGBUILD29
-rw-r--r--packages/dissociate/.gitignore1
-rw-r--r--packages/dissociate/PKGBUILD31
-rw-r--r--packages/dissociate/dissociate.hook9
-rw-r--r--packages/dissociate/dissociate.service11
-rw-r--r--packages/dissociate/dissociate.sysusers1
-rw-r--r--packages/dissociate/dissociate.tmpfiles2
-rw-r--r--packages/init.py42
-rw-r--r--packages/local.py51
-rw-r--r--packages/official.py58
-rw-r--r--packages/packages.inil52
-rw-r--r--packages/searxng/.gitignore1
-rw-r--r--packages/searxng/PKGBUILD50
-rw-r--r--packages/searxng/searxng.hook9
-rw-r--r--packages/searxng/searxng.service18
-rw-r--r--packages/searxng/searxng.socket10
-rw-r--r--packages/searxng/searxng.sysusers1
-rwxr-xr-xpackages/searxng/update.sh15
-rw-r--r--packages/update.py10
25 files changed, 569 insertions, 0 deletions
diff --git a/packages/.gitignore b/packages/.gitignore
new file mode 100644
index 0000000..05ced4a
--- /dev/null
+++ b/packages/.gitignore
@@ -0,0 +1,9 @@
+/*/pkg
+/*/src
+
+python-httpx-socks
+cgit-pink
+fw-ectool-git
+iceshrimp.net-git
+python-fasttext-predict
+python-pytomlpp
diff --git a/packages/aur.ini b/packages/aur.ini
new file mode 100644
index 0000000..811e200
--- /dev/null
+++ b/packages/aur.ini
@@ -0,0 +1,8 @@
+cgit-pink = 87afbcd732af921d9127cbbbe4aeb8f823f72d97
+fw-ectool-git = r2762.39d64fb
+iceshrimp.net-git = v2024.1.alpha+33a3601
+
+; searxng deps
+python-fasttext-predict = 043cd051e2e43ba72a9776745fde07bbb290d44a
+python-httpx-socks = bad01dbdd429fe4e14694a55f911f7810d7a39de
+python-pytomlpp = d021d021f4d38927799f38e1c91e10d70b94257b
diff --git a/packages/aur.py b/packages/aur.py
new file mode 100644
index 0000000..85658e1
--- /dev/null
+++ b/packages/aur.py
@@ -0,0 +1,121 @@
+import shlex
+import subprocess
+
+from local import build_push
+
+from commia.prelude import *
+from commia.util import check_continue, read_ini
+
+packages = read_ini("packages/aur.ini")["default"]
+ini = Path("packages/aur.ini").read_text()
+git_ignore = Path("packages/.gitignore").read_text()
+
+print("initializing new packages")
+
+for name, fix in packages.items():
+    if not Path(f"packages/{name}").exists():
+        print(f"cloning {name}")
+        run_check(
+            [
+                "git",
+                "clone",
+                f"https://aur.archlinux.org/{name}.git",
+                f"packages/{name}",
+            ]
+        )
+        if name.endswith("-git"):
+            for line in Path(f"packages/{name}/PKGBUILD").read_text().splitlines():
+                if not line.startswith("pkgver="):
+                    continue
+                ver = shlex.split(line[len("pkgver=") :])[0]
+                ini = ini.replace(f"{name} = ?", f"{name} = {ver}")
+                break
+        else:
+            if fix == "?":
+                commit = subprocess.check_output(
+                    ["git", "rev-parse", "HEAD"], cwd=f"packages/{name}", text=True
+                ).strip()
+                ini = ini.replace(f"{name} = ?", f"{name} = {commit}")
+            else:
+                run_check(["git", "checkout", fix], cwd=f"packages/{name}")
+        if not name in git_ignore:
+            git_ignore += f"{name}\n"
+            Path("packages/.gitignore").write_text(git_ignore)
+
+Path("packages/aur.ini").write_text(ini)
+
+print("checking for new versions")
+
+queue = []
+
+for name, current in packages.items():
+    if name.endswith("-git"):
+        continue
+    print(f"checking {name}")
+    path = Path(f"packages/{name}")
+    run_check(["git", "fetch"], cwd=path)
+    head = subprocess.check_output(
+        ["git", "rev-parse", "HEAD"], cwd=path, text=True
+    ).strip()
+    origin = subprocess.check_output(
+        ["git", "rev-parse", "origin/HEAD"], cwd=path, text=True
+    ).strip()
+    if current == origin:
+        print("no updates")
+        continue
+    if head != origin:
+        print()
+        run_check(["git", "diff", current, origin, ":!.SRCINFO"], cwd=path)
+        print()
+        if not check_continue():
+            continue
+    run_check(["git", "checkout", origin], cwd=path)
+    queue.append((name, current, origin))
+    print("build queued")
+
+
+for name, current in packages.items():
+    if not name.endswith("-git"):
+        continue
+    print(f"checking {name}")
+    path = Path(f"packages/{name}")
+    # update git
+    run_check(["git", "fetch"], cwd=path)
+    head = subprocess.check_output(
+        ["git", "rev-parse", "HEAD"], cwd=path, text=True
+    ).strip()
+    origin = subprocess.check_output(
+        ["git", "rev-parse", "origin/HEAD"], cwd=path, text=True
+    ).strip()
+    if head != origin:
+        print()
+        run_check(["git", "diff", head, origin, ":!.SRCINFO"], cwd=path)
+        print()
+        if not check_continue():
+            continue
+    run_check(["git", "checkout", origin], cwd=path)
+    # check for new version
+    run_check(["makepkg", "--noprepare", "--nobuild"], cwd=path)
+    ver = None
+    for line in Path(f"packages/{name}/PKGBUILD").read_text().splitlines():
+        if not line.startswith("pkgver="):
+            continue
+        ver = shlex.split(line[len("pkgver=") :])[0]
+        break
+    else:
+        raise Exception("couldn't find pkgver!")
+    if current == ver:
+        print("no update")
+        continue
+    queue.append((name, current, ver))
+
+if len(queue) == 0:
+    print("nothing to build")
+    exit()
+
+print("building new versions")
+
+for name, old, new in queue:
+    build_push(name)
+    ini = ini.replace(f"{name} = {old}", f"{name} = {new}")
+    Path("packages/aur.ini").write_text(ini)
diff --git a/packages/cgit-syntect-bat/.gitignore b/packages/cgit-syntect-bat/.gitignore
new file mode 100644
index 0000000..7c0560f
--- /dev/null
+++ b/packages/cgit-syntect-bat/.gitignore
@@ -0,0 +1 @@
+/bat/
diff --git a/packages/cgit-syntect-bat/PKGBUILD b/packages/cgit-syntect-bat/PKGBUILD
new file mode 100644
index 0000000..f4f83c2
--- /dev/null
+++ b/packages/cgit-syntect-bat/PKGBUILD
@@ -0,0 +1,28 @@
+pkgname=cgit-syntect-bat
+pkgver=0.24.0
+pkgrel=1
+pkgdesc="syntax pack based on bat for cgit-syntect"
+arch=(any)
+url="https://github.com/sharkdp/bat"
+makedepends=(bat cgit-syntect)
+source=("git+$url#commit=v$pkgver")
+sha256sums=(SKIP)
+
+pkgver() {
+	bat --version | sed -n 's/^bat \([0-9]\+\.[0-9]\+\.[0-9]\+\).*$/\1/p'
+}
+
+prepare() {
+	sed -i 's/bat .*//' bat/assets/create.sh # don't automatically build
+	sed -i 's/local submodule_prompt=unspecified/local submodule_prompt=y/' bat/assets/create.sh # don't prompt user
+	sed -i 's/^trap reverse_patches .*$//' bat/assets/create.sh # don't reverse patches
+}
+
+build() {
+	bat/assets/create.sh # prepare submodules and patches
+	MODE=compile cgit-syntect $srcdir/bat/assets/syntaxes syntax.packdump # compile syntaxes
+}
+
+package() {
+	install -Dm0755 -t "$pkgdir/usr/share/cgit-syntect" syntax.packdump
+}
diff --git a/packages/cgit-syntect/.gitignore b/packages/cgit-syntect/.gitignore
new file mode 100644
index 0000000..42b3b8e
--- /dev/null
+++ b/packages/cgit-syntect/.gitignore
@@ -0,0 +1 @@
+/cgit-syntect-*.tar*
diff --git a/packages/cgit-syntect/PKGBUILD b/packages/cgit-syntect/PKGBUILD
new file mode 100644
index 0000000..d20277c
--- /dev/null
+++ b/packages/cgit-syntect/PKGBUILD
@@ -0,0 +1,29 @@
+pkgname=cgit-syntect
+pkgver=0.2.0
+pkgrel=1
+pkgdesc="syntax highlighting for cgit based on syntect"
+arch=(x86_64 aarch64)
+url="https://git.mia.jetzt/cgit-syntect"
+license=(ISC)
+depends=(oniguruma)
+makedepends=(cargo oniguruma)
+options=(!lto)
+source=("https://git.mia.jetzt/cgit-syntect/snapshot/cgit-syntect-$pkgver.tar.gz")
+sha512sums=(SKIP)
+
+prepare() {
+	export RUSTUP_TOOLCHAIN=stable
+	cd $pkgname-$pkgver
+	cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
+}
+
+build() {
+	export RUSTUP_TOOLCHAIN=stable
+	export CARGO_TARGET_DIR=target
+	cd $pkgname-$pkgver
+	cargo build --frozen --release --all-features
+}
+
+package() {
+	install -Dm0755 -t "$pkgdir/usr/bin/" "$pkgname-$pkgver/target/release/$pkgname"
+}
diff --git a/packages/dissociate/.gitignore b/packages/dissociate/.gitignore
new file mode 100644
index 0000000..e422045
--- /dev/null
+++ b/packages/dissociate/.gitignore
@@ -0,0 +1 @@
+/dissociate-*.tar*
diff --git a/packages/dissociate/PKGBUILD b/packages/dissociate/PKGBUILD
new file mode 100644
index 0000000..f4ed01a
--- /dev/null
+++ b/packages/dissociate/PKGBUILD
@@ -0,0 +1,31 @@
+pkgname=dissociate
+pkgver=0.4.0
+pkgrel=1
+pkgdesc="simple authentication server"
+arch=(any)
+url="https://git.mia.jetzt/dissociate"
+makedepends=(cargo)
+source=("$url/snapshot/dissociate-$pkgver.tar.gz" $pkgname.service $pkgname.sysusers $pkgname.tmpfiles $pkgname.hook)
+sha256sums=(SKIP SKIP SKIP SKIP SKIP)
+
+prepare() {
+	export RUSTUP_TOOLCHAIN=stable
+	cd $pkgname-$pkgver
+	echo '[workspace]' >> Cargo.toml
+	cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
+}
+
+build() {
+	export RUSTUP_TOOLCHAIN=stable
+	export CARGO_TARGET_DIR=target
+	cd $pkgname-$pkgver
+	cargo build --frozen --release --all-features
+}
+
+package() {
+	install -Dm0755 -t "$pkgdir/usr/bin/" "$srcdir/$pkgname-$pkgver/target/release/$pkgname"
+	install -Dm0644 "$srcdir/$pkgname.service" "$pkgdir/usr/lib/systemd/system/$pkgname.service"
+	install -Dm0644 "$srcdir/$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
+	install -Dm0644 "$srcdir/$pkgname.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
+	install -Dm0644 "$srcdir/$pkgname.hook" "$pkgdir/usr/share/libalpm/hooks/$pkgname.hook"
+}
diff --git a/packages/dissociate/dissociate.hook b/packages/dissociate/dissociate.hook
new file mode 100644
index 0000000..2d0c7a7
--- /dev/null
+++ b/packages/dissociate/dissociate.hook
@@ -0,0 +1,9 @@
+[Trigger]
+Type = Package
+Operation = Upgrade
+Target = dissociate
+
+[Action]
+Description = Restarting dissociate daemon...
+When = PostTransaction
+Exec = /bin/bash -c '/usr/bin/systemctl is-active dissociate.service -q && /usr/bin/systemctl restart dissociate.service || /usr/bin/true'
diff --git a/packages/dissociate/dissociate.service b/packages/dissociate/dissociate.service
new file mode 100644
index 0000000..180bfb3
--- /dev/null
+++ b/packages/dissociate/dissociate.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=dissociate server
+
+[Service]
+Type=simple
+User=dissociate
+Group=dissociate
+ExecStart=/usr/bin/dissociate serve /etc/dissociate/config.toml
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packages/dissociate/dissociate.sysusers b/packages/dissociate/dissociate.sysusers
new file mode 100644
index 0000000..5b5e836
--- /dev/null
+++ b/packages/dissociate/dissociate.sysusers
@@ -0,0 +1 @@
+u dissociate - "dissociate server user"
diff --git a/packages/dissociate/dissociate.tmpfiles b/packages/dissociate/dissociate.tmpfiles
new file mode 100644
index 0000000..2be0fef
--- /dev/null
+++ b/packages/dissociate/dissociate.tmpfiles
@@ -0,0 +1,2 @@
+d /etc/dissociate 750 dissociate dissociate -
+d /var/lib/dissociate 750 dissociate dissociate -
diff --git a/packages/init.py b/packages/init.py
new file mode 100644
index 0000000..d556548
--- /dev/null
+++ b/packages/init.py
@@ -0,0 +1,42 @@
+import shlex
+import subprocess
+
+from commia.prelude import *
+from commia.util import read_ini
+
+packages = read_ini("packages/aur.ini")["default"]
+
+ini = Path("packages/aur.ini").read_text()
+git_ignore = Path("packages/.gitignore").read_text()
+
+for name, fix in packages.items():
+    if not Path(f"packages/{name}").exists():
+        print(f"cloning {name}")
+        run_check(
+            [
+                "git",
+                "clone",
+                f"https://aur.archlinux.org/{name}.git",
+                f"packages/{name}",
+            ]
+        )
+        if name.endswith("-git"):
+            for line in Path(f"packages/{name}/PKGBUILD").read_text().splitlines():
+                if not line.startswith("pkgver="):
+                    continue
+                ver = shlex.split(line[len("pkgver=") :])[0]
+                ini = ini.replace(f"{name} = ?", f"{name} = {ver}")
+                break
+        else:
+            if fix == "?":
+                commit = subprocess.check_output(
+                    ["git", "rev-parse", "HEAD"], cwd=f"packages/{name}", text=True
+                ).strip()
+                ini = ini.replace(f"{name} = ?", f"{name} = {commit}")
+            else:
+                run_check(["git", "checkout", fix], cwd=f"packages/{name}")
+        if not name in git_ignore:
+            git_ignore += f"{name}\n"
+            Path("packages/.gitignore").write_text(git_ignore)
+
+Path("packages/aur.ini").write_text(ini)
diff --git a/packages/local.py b/packages/local.py
new file mode 100644
index 0000000..3ef4ea9
--- /dev/null
+++ b/packages/local.py
@@ -0,0 +1,51 @@
+import os
+import shutil
+import subprocess
+import sys
+
+from commia.prelude import *
+from commia.ssh import ssh_args, ssh_opt_args
+
+
+def build_push(name):
+    path = Path(f"packages/{name}")
+    git_ignore = (path / ".gitignore").exists()
+    for pkg in path.glob("*.pkg.tar"):
+        os.remove(pkg)
+    env = {"PKGEXT": ".pkg.tar", **os.environ}
+    run_check(["makepkg", "--clean", "--syncdeps", "--cleanbuild"], cwd=path, env=env)
+    for pkg in path.glob("*.pkg.tar"):
+        run_sc(["scp", *ssh_opt_args(), pkg.as_posix(), f"asylum:/tmp/{pkg.name}"])
+        run_check(
+            [*ssh_args(), "pacman", "-U", f"/tmp/{pkg.name}"], input="y\n".encode()
+        )
+        run_sc(
+            ["sftp", "-b", "-", *ssh_opt_args(), "asylum"],
+            input=f"rm /tmp/{pkg.name}".encode(),
+        )
+        os.remove(pkg)
+    if git_ignore:
+        ignored = subprocess.check_output(
+            [
+                "git",
+                "ls-files",
+                "--others",
+                "--directory",
+                "--ignored",
+                "--exclude-from=.gitignore",
+            ],
+            cwd=path,
+            text=True,
+        )
+        for name in ignored.splitlines():
+            if ".." in name or name.startswith("/"):
+                continue
+            if (path / name).is_dir():
+                shutil.rmtree(path / name)
+            else:
+                os.remove(path / name)
+
+
+if __name__ == "__main__":
+    for name in sys.argv[1:]:
+        build_push(name)
diff --git a/packages/official.py b/packages/official.py
new file mode 100644
index 0000000..785f1cd
--- /dev/null
+++ b/packages/official.py
@@ -0,0 +1,58 @@
+from commia.prelude import *
+from commia.ssh import ssh_args
+from commia.util import check_continue, read_ini, read_inilist
+
+sections = read_inilist("packages/packages.inil", ["explicit", "ignore", "deny"])
+aur = set(read_ini("packages/aur.ini")["default"].keys())
+
+pac_explicit = set(
+    run_sc([*ssh_args(), "pacman", "-Qqe"], text=True).stdout.splitlines()
+)
+pac_all = set(run_sc([*ssh_args(), "pacman", "-Qq"], text=True).stdout.splitlines())
+
+explicit_check = sections["explicit"] - pac_explicit
+to_install = explicit_check - pac_all
+to_mark_explicit = explicit_check.intersection(pac_all)
+to_mark_dep = pac_explicit - (sections["explicit"].union(sections["ignore"]).union(aur))
+
+for package in to_install:
+    deps = set(
+        run_sc(
+            [*ssh_args(), "pacman", "-Sp", "--print-format", "%n", package]
+        ).stdout.splitlines()
+    )
+    deny = deps & sections["deny"]
+    for deny in deny:
+        print(f"package {package} depends on banned package {deny}")
+        exit(1)
+
+for package in sections["deny"]:
+    if run_silent([*ssh_args(), "pacman", "-Q", package]).returncode == 0:
+        print(f"banned package {package} already installed")
+        exit(1)
+
+if len(to_install) > 0:
+    print("to install:", " ".join(to_install))
+
+if len(to_mark_explicit) > 0:
+    print("to mark explicit:", " ".join(to_mark_explicit))
+
+if len(to_mark_dep) > 0:
+    print("to mark dependency:", " ".join(to_mark_dep))
+
+if len(to_install) + len(to_mark_explicit) + len(to_mark_dep) > 0 and check_continue():
+    if len(to_install) > 0:
+        run_check([*ssh_args(), "pacman", "-Sy", "--noconfirm", *to_install])
+
+    if len(to_mark_explicit) > 0:
+        run_check([*ssh_args(), "pacman", "-D", "--asexplicit", *to_mark_explicit])
+
+    if len(to_mark_dep) > 0:
+        run_check([*ssh_args(), "pacman", "-D", "--asdep", *to_mark_dep])
+
+cleanup = run_silent([*ssh_args(), "pacman", "-Qdtq"], text=True).stdout.splitlines()
+if len(cleanup) > 0:
+    print("to cleanup:", " ".join(cleanup))
+    if not check_continue():
+        exit()
+    run_check([*ssh_args(), "pacman", "-Rs", "--noconfirm", *cleanup])
diff --git a/packages/packages.inil b/packages/packages.inil
new file mode 100644
index 0000000..f2d5e71
--- /dev/null
+++ b/packages/packages.inil
@@ -0,0 +1,52 @@
+[explicit]
+base
+btop
+fcgiwrap
+git
+intel-ucode
+linux
+linux-firmware
+lowdown
+man-db
+man-pages
+micro
+mkinitcpio-dropbear
+mkinitcpio-netconf
+mkinitcpio-utils
+nginx
+nginx-mod-njs
+nushell
+openssh
+python
+ufw
+which
+wireguard-tools
+
+; shell
+starship
+zsh
+zsh-autosuggestions
+zsh-syntax-highlighting
+
+;neofetch
+
+libftdi ; missing dep of fw-ectool
+
+[ignore]
+cgit-syntect
+cgit-syntect-bat
+dissociate
+withdrawal
+searxng
+
+; aur
+cgit-pink
+fw-ectool-git
+iceshrimp.net-git
+; searxng deps
+python-fasttext-predict
+python-httpx-socks
+python-pytomlpp
+
+[deny]
+sudo
diff --git a/packages/searxng/.gitignore b/packages/searxng/.gitignore
new file mode 100644
index 0000000..274bcf0
--- /dev/null
+++ b/packages/searxng/.gitignore
@@ -0,0 +1 @@
+/searxng/
diff --git a/packages/searxng/PKGBUILD b/packages/searxng/PKGBUILD
new file mode 100644
index 0000000..c51e1ae
--- /dev/null
+++ b/packages/searxng/PKGBUILD
@@ -0,0 +1,50 @@
+# adapted from searxng-git 1.0.0.r3824.gac430a9ea-1
+
+pkgname=searxng
+_date=2024.05.31
+_commit=18fb701be
+pkgver=$_date+$_commit
+pkgrel=1
+pkgdesc="A privacy-respecting, hackable metasearch engine"
+arch=(any)
+url="https://github.com/searxng/searxng"
+makedepends=(python python-setuptools)
+depends=(
+	python-async-timeout
+	python-babel
+	python-brotli
+	python-certifi
+	python-dateutil
+	python-fasttext-predict
+	python-flask
+	python-flask-babel
+	python-h2
+	python-httpx
+	python-httpx-socks
+	python-jinja
+	python-lxml
+	python-markdown-it-py
+	python-pygments
+	python-pytomlpp
+	python-redis
+	python-setproctitle
+	python-uvloop
+	python-yaml
+	gunicorn
+)
+source=("git+$url#commit=$_commit" searxng.sysusers searxng.service searxng.socket)
+sha256sums=(SKIP SKIP SKIP SKIP)
+
+package() {
+	cd "$srcdir/searxng"
+	local _site_packages="$(python -c 'import site; print(site.getsitepackages()[0])')"
+
+	python setup.py install --root="$pkgdir" --optimize=1
+	python -m searx.version freeze
+
+	install -Dm644 "$srcdir/searxng.sysusers" "$pkgdir/usr/lib/sysusers.d/searxng.conf"
+	install -Dm644 "$srcdir/searxng/searx/version_frozen.py" "$pkgdir$_site_packages/searx/version_frozen.py"
+	install -Dm644 "$srcdir/searxng/LICENSE" "$pkgdir/usr/share/licenses/searxng/LICENSE"
+	install -Dm644 "$srcdir/searxng.service" "$pkgdir/usr/lib/systemd/system/searxng.service"
+	install -Dm644 "$srcdir/searxng.socket" "$pkgdir/usr/lib/systemd/system/searxng.socket"
+}
diff --git a/packages/searxng/searxng.hook b/packages/searxng/searxng.hook
new file mode 100644
index 0000000..6a99f07
--- /dev/null
+++ b/packages/searxng/searxng.hook
@@ -0,0 +1,9 @@
+[Trigger]
+Type = Package
+Operation = Upgrade
+Target = searxng
+
+[Action]
+Description = Restarting searxng daemon...
+When = PostTransaction
+Exec = /bin/bash -c '/usr/bin/systemctl is-active searxng.service -q && /usr/bin/systemctl restart searxng.service || /usr/bin/true'
diff --git a/packages/searxng/searxng.service b/packages/searxng/searxng.service
new file mode 100644
index 0000000..604df1c
--- /dev/null
+++ b/packages/searxng/searxng.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=searxng daemon
+Requires=searxng.socket
+After=network.target
+
+[Service]
+Type=notify
+User=searxng
+Group=searxng
+RuntimeDirectory=searxng
+ExecStart=/usr/bin/gunicorn searx.webapp
+ExecReload=/bin/kill -s HUP $MAINPID
+KillMode=mixed
+TimeoutStopSec=5
+PrivateTmp=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/packages/searxng/searxng.socket b/packages/searxng/searxng.socket
new file mode 100644
index 0000000..a599564
--- /dev/null
+++ b/packages/searxng/searxng.socket
@@ -0,0 +1,10 @@
+[Unit]
+Description=searxng socket
+
+[Socket]
+ListenStream=/run/searxng.sock
+SocketUser=http
+SocketMode=600
+
+[Install]
+WantedBy=sockets.target
diff --git a/packages/searxng/searxng.sysusers b/packages/searxng/searxng.sysusers
new file mode 100644
index 0000000..025903c
--- /dev/null
+++ b/packages/searxng/searxng.sysusers
@@ -0,0 +1 @@
+u searxng - "Searxng server user"
diff --git a/packages/searxng/update.sh b/packages/searxng/update.sh
new file mode 100755
index 0000000..a4d3bde
--- /dev/null
+++ b/packages/searxng/update.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+set -e
+
+pushd packages/searxng >/dev/null
+pushd searxng >/dev/null
+git fetch
+date=$(git show -s --date=format:%Y.%m.%d --format=%cd)
+commit=$(git show -s --format=%h)
+popd >/dev/null
+sed -i "s/_date=.*/_date=$date/" PKGBUILD
+sed -i "s/_commit=.*/_commit=$commit/" PKGBUILD
+popd >/dev/null
+
+echo rebuilding
+python packages/local.py searxng
diff --git a/packages/update.py b/packages/update.py
new file mode 100644
index 0000000..70e9959
--- /dev/null
+++ b/packages/update.py
@@ -0,0 +1,10 @@
+import io
+import shutil
+import sys
+from threading import Thread
+
+from commia.prelude import *
+from commia.ssh import ssh_args
+from commia.util import getch
+
+run_check([*ssh_args(), "pacman", "-Syu"])