about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README.md12
-rw-r--r--default.nix7
-rw-r--r--flake.nix35
-rwxr-xr-xgalier2
4 files changed, 41 insertions, 15 deletions
diff --git a/README.md b/README.md
index 2c7b068..84fe675 100644
--- a/README.md
+++ b/README.md
@@ -5,3 +5,15 @@ Better [gal](https://github.com/19pdh/gal) - media gallery generator.
 It supports images and videos
 
 ## Usage
+
+```
+galier [SRC DIR] [OUTPUT DIR]
+```
+
+## Caching results
+
+Since video transcoding is a cpu intensive task this script will check if file
+exists in output folder. In order to regenerate video you need to remove/rename
+file in its destination.
+
+Other files (htmls, images) will always be overwritten.
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..39bacff
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,7 @@
+(import (
+  fetchTarball {
+    url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
+    sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
+) {
+  src =  ./.;
+}).defaultNix
diff --git a/flake.nix b/flake.nix
index 4958116..09d5429 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,25 +1,32 @@
 {
-  description = "Yet another photo gallery generator.";
+  description = "Yet another photo and video gallery generator.";
 
   outputs = { self, nixpkgs }: {
 
     packages.x86_64-linux.gal =
     with import nixpkgs { system = "x86_64-linux"; };
-    stdenv.mkDerivation {
-      pname = "gal";
-      version = "0.2";
+    let
+      pname = "galier";
+      version = "0.1";
+      install = writeScriptBin "install" ''
+        ${toybox}/bin/mkdir -p $out/bin $out/share/galier
+        ${toybox}/bin/cp $src/galier $out/bin
+        ${toybox}/bin/cp $src/style.css $out/share/galier
 
-      src = self;
-
-      installPhase = ''
-        mkdir -p $out/bin $out/share/gal
-        cp gal $out/bin
-        cp style.css $out/share/gal
-
-        sed -i 's:convert:${imagemagick}/bin/convert:g' $out/bin/gal
-        sed -i 's:cwebp:${libwebp}/bin/cwebp:g' $out/bin/gal
-        sed -i "s:cp style.css:cp $out/share/gal/style.css:g" $out/bin/gal
+        ${toybox}/bin/sed -i 's:convert:${imagemagick}/bin/convert:g' $out/bin/galier
+        ${toybox}/bin/sed -i 's:cwebp:${libwebp}/bin/cwebp:g' $out/bin/galier
+        ${toybox}/bin/sed -i 's:ffmpeg:${ffmpeg}/bin/ffmpeg:g' $out/bin/galier
+        ${toybox}/bin/sed -i 's:ffprobe:${ffmpeg}/bin/ffprobe:g' $out/bin/galier
+        ${toybox}/bin/sed -i "s:cp style.css:cp $out/share/galier/style.css:g" $out/bin/galier
       '';
+
+    in
+    derivation {
+      name = "${pname}-${version}";
+      builder = "${bash}/bin/bash";
+      args = [ "${install}/bin/install" ];
+      src = self;
+      system = "x86_64-linux";
     };
 
     defaultPackage.x86_64-linux = self.packages.x86_64-linux.gal;
diff --git a/galier b/galier
index 15ea3c1..80f5cee 100755
--- a/galier
+++ b/galier
@@ -25,7 +25,7 @@ mkdir -p $2/{photos,vids,thumbs}
 
 ## Generate index.html menu file
 src=`dirname $(readlink -f $0)`
-cp $src/style.css $OUTPUT
+cp $src/../share/galier/style.css $OUTPUT
 chmod 644 $OUTPUT/style.css
 echo "Generating index.html"