ctucx.git: nixfiles

ctucx' nixfiles

commit 88e069d49c65b4dc7afad305774269fa1e2db68a
parent 683e5ac15e8d808ec6d915569846a03ea0459aab
Author: Leah (ctucx) <leah@ctu.cx>
Date: Thu, 9 Jun 2022 21:22:23 +0200

pkgs: add gallery
2 files changed, 56 insertions(+), 48 deletions(-)
M
machines/osterei/websites/photos.ctu.cx.nix
|
49
+------------------------------------------------
A
pkgs/gallery.nim
|
55
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff --git a/machines/osterei/websites/photos.ctu.cx.nix b/machines/osterei/websites/photos.ctu.cx.nix
@@ -2,54 +2,7 @@
 
 let
 
-  nimexif = pkgs.nimPackages.buildNimPackage {
-    name = "nimexif";
-    src  = pkgs.fetchgit {
-      url    = "https://cgit.ctu.cx/nimexif";
-      rev    = "c01ab3532975370c3b35b1056f52d02c7df616e0";
-      sha256 = "0h3pzpm1h3gmijmfak994y98xr2my7wv31xh3b2wv1p4w8lsv3s1";
-    };
-
-    libexif = pkgs.libexif;
-
-    patchPhase = ''
-      substituteAllInPlace nimexif/libexif_prewrapped.nim
-      cp nimexif/libexif_prewrapped.nim nimexif/libexif.nim;
-   '';
-  };
-
-  nimjpg = pkgs.nimPackages.buildNimPackage {
-    name = "nimjpg";
-    src  = pkgs.fetchgit {
-      url    = "https://cgit.ctu.cx/nimjpg";
-      rev    = "cf530668cf92d9d509744b54b93bd4101a5ae6c5";
-      sha256 = "03mbbs6wk67llh3ln871jwyvyl2qrv1m5rivlgmg2jlj8462m0sg";
-    };
-
-    buildInputs = [ nimexif ];
-  };
-
-  moustachu = pkgs.fetchFromGitHub {
-    owner  = "fenekku";
-    repo   = "moustachu";
-    rev    = "0.14.0";
-    sha256 = "16ij1igddmily9g1kbkmhv6kvmnzyhdy10ifidf32frkraypkdm3";
-  };
-
-  gallery = pkgs.nimPackages.buildNimPackage {
-    name = "gallery";
-
-    nimBinOnly  = true;
-    nimRelease  = true;
-
-    buildInputs = [ nimexif nimjpg moustachu ];
-
-    src = pkgs.fetchgit {
-      url    = "https://cgit.ctu.cx/gallery";
-      rev    = "010cafd5f54fbcce2add550c2b52b96e33d26f25";
-      sha256 = "0lzq0lf4xx30nnbc1a4glal0nd99z2q4cvzddhfa868n9r0zcrph";
-    };
-  };
+  gallery = pkgs.callPackage ../../../pkgs/gallery.nim {};
 
   galleryConfig = {
     SourceDir  = "/mnt/photos.ctu.cx";
diff --git a/pkgs/gallery.nim b/pkgs/gallery.nim
@@ -0,0 +1,55 @@
+{ nimPackages, fetchgit, fetchFromGitHub, libexif }:
+
+let
+
+  nimexif = nimPackages.buildNimPackage {
+    name = "nimexif";
+    src  = fetchgit {
+      url    = "https://cgit.ctu.cx/nimexif";
+      rev    = "c01ab3532975370c3b35b1056f52d02c7df616e0";
+      sha256 = "0h3pzpm1h3gmijmfak994y98xr2my7wv31xh3b2wv1p4w8lsv3s1";
+    };
+
+    libexif = libexif;
+
+    patchPhase = ''
+      substituteAllInPlace nimexif/libexif_prewrapped.nim
+      cp nimexif/libexif_prewrapped.nim nimexif/libexif.nim;
+   '';
+  };
+
+  nimjpg = nimPackages.buildNimPackage {
+    name = "nimjpg";
+    src  = fetchgit {
+      url    = "https://cgit.ctu.cx/nimjpg";
+      rev    = "cf530668cf92d9d509744b54b93bd4101a5ae6c5";
+      sha256 = "03mbbs6wk67llh3ln871jwyvyl2qrv1m5rivlgmg2jlj8462m0sg";
+    };
+
+    buildInputs = [ nimexif ];
+  };
+
+  moustachu = fetchFromGitHub {
+    owner  = "fenekku";
+    repo   = "moustachu";
+    rev    = "0.14.0";
+    sha256 = "16ij1igddmily9g1kbkmhv6kvmnzyhdy10ifidf32frkraypkdm3";
+  };
+
+in nimPackages.buildNimPackage rec {
+
+  name = "gallery";
+
+  nimBinOnly  = true;
+  nimRelease  = true;
+
+  buildInputs = [ nimexif nimjpg moustachu ];
+
+  src = fetchgit {
+    url    = "https://cgit.ctu.cx/gallery";
+    rev    = "d0e26efc98e61bdd66a28aaa5da2023adb4878d4";
+    sha256 = "0lzq0lf4xx30nnbc1a4glal0nd99z2q4cvzddhfa868n9r0zcrph";
+  };
+
+}
+