Skip to content

Commit 2a106b2

Browse files
Add nix derivation
1 parent b3caa80 commit 2a106b2

File tree

3 files changed

+40
-14
lines changed

3 files changed

+40
-14
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,15 @@ Better [gal](https://github.com/19pdh/gal) - media gallery generator.
55
It supports images and videos
66

77
## Usage
8+
9+
```
10+
galier [SRC DIR] [OUTPUT DIR]
11+
```
12+
13+
## Caching results
14+
15+
Since video transcoding is a cpu intensive task this script will check if file
16+
exists in output folder. In order to regenerate video you need to remove/rename
17+
file in its destination.
18+
19+
Other files (htmls, images) will always be overwritten.

default.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
(import (
2+
fetchTarball {
3+
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
4+
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
5+
) {
6+
src = ./.;
7+
}).defaultNix

flake.nix

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
{
2-
description = "Yet another photo gallery generator.";
2+
description = "Yet another photo and video gallery generator.";
33

44
outputs = { self, nixpkgs }: {
55

66
packages.x86_64-linux.gal =
77
with import nixpkgs { system = "x86_64-linux"; };
8-
stdenv.mkDerivation {
9-
pname = "gal";
10-
version = "0.2";
8+
let
9+
pname = "galier";
10+
version = "0.1";
11+
install = writeScriptBin "install" ''
12+
${toybox}/bin/mkdir -p $out/bin $out/share/galier
13+
${toybox}/bin/cp $src/galier $out/bin
14+
${toybox}/bin/cp $src/style.css $out/share/galier
1115
12-
src = self;
13-
14-
installPhase = ''
15-
mkdir -p $out/bin $out/share/gal
16-
cp gal $out/bin
17-
cp style.css $out/share/gal
18-
19-
sed -i 's:convert:${imagemagick}/bin/convert:g' $out/bin/gal
20-
sed -i 's:cwebp:${libwebp}/bin/cwebp:g' $out/bin/gal
21-
sed -i "s:cp style.css:cp $out/share/gal/style.css:g" $out/bin/gal
16+
${toybox}/bin/sed -i 's:convert:${imagemagick}/bin/convert:g' $out/bin/galier
17+
${toybox}/bin/sed -i 's:cwebp:${libwebp}/bin/cwebp:g' $out/bin/galier
18+
${toybox}/bin/sed -i 's:ffmpeg:${ffmpeg}/bin/ffmpeg:g' $out/bin/galier
19+
${toybox}/bin/sed -i 's:ffprobe:${ffmpeg}/bin/ffprobe:g' $out/bin/galier
20+
${toybox}/bin/sed -i "s:cp style.css:cp $out/share/galier/style.css:g" $out/bin/galier
2221
'';
22+
23+
in
24+
derivation {
25+
name = "${pname}-${version}";
26+
builder = "${bash}/bin/bash";
27+
args = [ "${install}/bin/install" ];
28+
src = self;
29+
system = "x86_64-linux";
2330
};
2431

2532
defaultPackage.x86_64-linux = self.packages.x86_64-linux.gal;

0 commit comments

Comments
 (0)