Commit 80a615b

HPCesia <me@hpcesia.com>
2026-05-02 06:30:08
new packages: shimmie2, shimmie2-unwrapped
1 parent 91300ed
pkgs/shimmie2/default.nix
@@ -0,0 +1,79 @@
+{
+  writeShellApplication,
+  bubblewrap,
+  php,
+  shimmie2-unwrapped,
+  defaultDataDir ? "$HOME/.shimmie2",
+}:
+writeShellApplication {
+  name = "shimmie2";
+
+  derivationArgs = {
+    inherit (shimmie2-unwrapped) meta version;
+  };
+
+  runtimeInputs = [bubblewrap php];
+  text = ''
+    show_help() {
+      cat <<EOF
+    Usage: shimmie2 [OPTIONS]
+
+    Wrapper of shimmie2, an easy-to-install community image gallery (aka booru)
+
+    Options:
+      -h, --help                Show this help message
+      -a, --address ADDRESS     Set the service address (default: 127.0.0.1:9000)
+      -d, --data-dir DIR        Set the data directory mapping (default: ${defaultDataDir})
+      --                        Pass all subsequent arguments directly to the PHP process
+
+    Example:
+      shimmie2 -a 0.0.0.0:9000 -- -d upload_max_filesize=100M -d post_max_size=100M
+    EOF
+    }
+
+    ADDRESS="127.0.0.1:9000"
+    DATA_DIR="${defaultDataDir}"
+    PHP_ARGS=()
+
+    while [[ "$#" -gt 0 ]]; do
+      case $1 in
+        -h|--help)
+          show_help
+          exit 0
+          ;;
+        -a|--address)
+          ADDRESS="$2"
+          shift
+          ;;
+        -d|--data-dir)
+          DATA_DIR="$2"
+          shift
+          ;;
+        --)
+          shift
+          PHP_ARGS=("$@")
+          break
+          ;;
+        *)
+          echo "Unknown parameter: $1"
+          show_help
+          exit 1
+          ;;
+      esac
+      shift
+    done
+
+    mkdir -p "$DATA_DIR"
+
+    APP_ROOT="${shimmie2-unwrapped}/share/php/${shimmie2-unwrapped.pname}"
+
+    echo "Starting Shimmie2 on $ADDRESS..."
+    echo "Mapping data dir to writeable $DATA_DIR"
+
+    exec bwrap \
+      --dev-bind / / \
+      --bind "$DATA_DIR" "$APP_ROOT/data" \
+      --chdir "$APP_ROOT" \
+      php "''${PHP_ARGS[@]}" -S "$ADDRESS" tests/router.php
+  '';
+}
pkgs/shimmie2/unwrapped.nix
@@ -0,0 +1,39 @@
+{
+  lib,
+  php,
+  fetchFromGitHub,
+}:
+(
+  php.buildComposerProject2 (finalAttrs: {
+    pname = "shimmie2-unwrapped";
+    version = "2.12.2";
+
+    src = fetchFromGitHub {
+      owner = "shish";
+      repo = "shimmie2";
+      tag = "v${finalAttrs.version}";
+      hash = "sha256-hhQ37nrnndBgv5NRZ8wuwqCSPNNk4LlhLBlRdf+vlGE=";
+    };
+
+    vendorHash = "sha256-tSDAv+/2ftciOBaFGk1chvAztijiOHKhQfgdItzo9i0=";
+
+    postInstall = ''
+      mkdir -p $out/share/php/${finalAttrs.pname}/data
+    '';
+
+    meta = {
+      description = "An easy-to-install community image gallery (aka booru)";
+      homepage = "https://github.com/shish/shimmie2";
+      licence = lib.licenses.gpl2;
+      platforms = lib.platforms.linux;
+    };
+  })
+).overrideAttrs (_: prev: {
+  # Fix FOD nix store path reference error
+  # See https://phip1611.de/blog/fixing-illegal-path-references-in-fixed-output-derivation-in-nix/
+  composerVendor = prev.composerVendor.overrideAttrs {
+    preInstall = ''
+      rm -rf vendor/ifixit/php-akismet/.git/hooks
+    '';
+  };
+})
default.nix
@@ -30,4 +30,7 @@
       musly-player = callPackage ./pkgs/musly-player {};
 
       particle-music = callPackage ./pkgs/particle-music {};
+
+      shimmie2-unwrapped = callPackage ./pkgs/shimmie2/unwrapped.nix {};
+      shimmie2 = callPackage ./pkgs/shimmie2 {};
     }))
README.md
@@ -6,13 +6,15 @@
 
 ### Common
 
-| **Path**         | **Name**                         | **Version** | **License**     | **Description**                  |
-| ---------------- | -------------------------------- | ----------- | --------------- | -------------------------------- |
-| `dwproton-bin`   | [dwproton-bin][dwproton]         | `10.0-26`   | BSD-3-Clause    | Modifed Proton builds            |
-| `harmonoid`      | [harmonoid][harmonoid]           | `0.3.22`    | **Unfree**      | Music player                     |
-| `localbooru-bin` | [localbooru-bin][localbooru]     | `1.6.1`     | GPL-3.0         | Local booru collection           |
-| `musly-player`   | [musly-player][musly]            | `1.0.8`     | CC-BY-NC-SA 4.0 | Subsonic-compatible music client |
-| `particle-music` | [particle-music][particle-music] | `2.1.2`     | Apache-2.0      | Music player                     |
+| **Path**             | **Name**                         | **Version** | **License**     | **Description**                  |
+| -------------------- | -------------------------------- | ----------- | --------------- | -------------------------------- |
+| `dwproton-bin`       | [dwproton-bin][dwproton]         | `10.0-26`   | BSD-3-Clause    | Modifed Proton builds            |
+| `harmonoid`          | [harmonoid][harmonoid]           | `0.3.22`    | **Unfree**      | Music player                     |
+| `localbooru-bin`     | [localbooru-bin][localbooru]     | `1.6.1`     | GPL-3.0         | Local booru collection           |
+| `musly-player`       | [musly-player][musly]            | `1.0.8`     | CC-BY-NC-SA 4.0 | Subsonic-compatible music client |
+| `particle-music`     | [particle-music][particle-music] | `2.1.2`     | Apache-2.0      | Music player                     |
+| `shimmie2`           | [shimmie2][shimmie2]             | `2.12.2`    | GPL-2.0         | Image gallery (aka booru)        |
+| `shimmie2-unwrapped` | [shimmie2-unwrapped][shimmie2]   | `2.12.2`    | GPL-2.0         | Image gallery (aka booru)        |
 
 ### Helix Plugins
 
@@ -30,3 +32,4 @@
 [localbooru]: https://github.com/resucutie/localbooru
 [musly]: https://github.com/dddevid/Musly
 [particle-music]: https://github.com/AfalpHy/ParticleMusic
+[shimmie2]: https://github.com/shish/shimmie2