commit 2bf3a002106afd8f3d1ab9e3bfff4561e3a88ba4
parent d0e26efc98e61bdd66a28aaa5da2023adb4878d4
Author: Leah (ctucx) <git@ctu.cx>
Date: Sat, 10 Dec 2022 14:36:46 +0100
parent d0e26efc98e61bdd66a28aaa5da2023adb4878d4
Author: Leah (ctucx) <git@ctu.cx>
Date: Sat, 10 Dec 2022 14:36:46 +0100
add flake.nix
3 files changed, 127 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore @@ -3,4 +3,5 @@ out/* foobar/* test.conf -testconfig.conf- \ No newline at end of file +testconfig.conf +result
diff --git a/flake.lock b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1670543317, + "narHash": "sha256-4mMR56rtxKr+Gwz399jFr4i76SQZxsLWxxyfQlPXRm0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7a6a010c3a1d00f8470a5ca888f2f927f1860a19", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +}
diff --git a/flake.nix b/flake.nix @@ -0,0 +1,81 @@ +{ + description = "static-site-generator for image-galleries"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; + }; + + outputs = { self, nixpkgs, flake-utils }: { + + overlay = final: prev: { + + ctucx-gallery = ( + let + nimexif = final.nimPackages.buildNimPackage { + name = "nimexif"; + src = final.fetchgit { + url = "https://cgit.ctu.cx/nimexif"; + rev = "c01ab3532975370c3b35b1056f52d02c7df616e0"; + sha256 = "0h3pzpm1h3gmijmfak994y98xr2my7wv31xh3b2wv1p4w8lsv3s1"; + }; + + libexif = final.libexif; + + patchPhase = '' + substituteAllInPlace nimexif/libexif_prewrapped.nim + cp nimexif/libexif_prewrapped.nim nimexif/libexif.nim; + ''; + }; + + nimjpg = final.nimPackages.buildNimPackage { + name = "nimjpg"; + src = final.fetchgit { + url = "https://cgit.ctu.cx/nimjpg"; + rev = "cf530668cf92d9d509744b54b93bd4101a5ae6c5"; + sha256 = "03mbbs6wk67llh3ln871jwyvyl2qrv1m5rivlgmg2jlj8462m0sg"; + }; + + buildInputs = [ nimexif ]; + }; + + moustachu = final.fetchFromGitHub { + owner = "fenekku"; + repo = "moustachu"; + rev = "0.14.0"; + sha256 = "16ij1igddmily9g1kbkmhv6kvmnzyhdy10ifidf32frkraypkdm3"; + }; + + in final.nimPackages.buildNimPackage { + name = "ctucx.gallery"; + src = self; + + buildInputs = [ final.libexif nimexif nimjpg moustachu ]; + + nimBinOnly = true; + nimRelease = true; + } + ); + + }; + + } // (flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlay ]; + }; + + in rec { + + packages.default = pkgs.ctucx-gallery; + packages.ctucx-gallery = pkgs.ctucx-gallery; + + apps.default = { + type = "app"; + program = "${pkgs.ctucx-gallery}/bin/gallery"; + }; + + } + )); +}+ \ No newline at end of file