commit c460a7d103b192ce93c156fe11eaaecebf4bfb3e
parent 36f20ee80e86e08a08c74ffa6a688b1e49473503
Author: Katja (ctucx) <git@ctu.cx>
Date: Wed, 5 Mar 2025 21:37:55 +0100
parent 36f20ee80e86e08a08c74ffa6a688b1e49473503
Author: Katja (ctucx) <git@ctu.cx>
Date: Wed, 5 Mar 2025 21:37:55 +0100
flake: refactor, remove `flake-utils` dependency
2 files changed, 75 insertions(+), 113 deletions(-)
diff --git a/flake.lock b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1717696253, @@ -36,24 +18,8 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", "nixpkgs": "nixpkgs" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root",
diff --git a/flake.nix b/flake.nix @@ -1,86 +1,83 @@ { - description = "static-site-generator for image-galleries"; - - inputs = { - flake-utils.url = "github:numtide/flake-utils"; - nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; - }; - - outputs = { self, nixpkgs, flake-utils }: { - - overlay = final: prev: { - - ctucx-gallery = ( - let - nimexif = final.stdenv.mkDerivation { - 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; - ''; - - installPhase = '' - mkdir -p $out - cp -r nimexif $out - ''; - }; - - nimjpg = final.fetchgit { - url = "https://cgit.ctu.cx/nimjpg"; - rev = "cf530668cf92d9d509744b54b93bd4101a5ae6c5"; - sha256 = "03mbbs6wk67llh3ln871jwyvyl2qrv1m5rivlgmg2jlj8462m0sg"; - }; + description = "static-site-generator for image-galleries"; - moustachu = final.fetchFromGitHub { - owner = "fenekku"; - repo = "moustachu"; - rev = "0.14.0"; - sha256 = "16ij1igddmily9g1kbkmhv6kvmnzyhdy10ifidf32frkraypkdm3"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + + outputs = inputs: let + forAllSystems = function: + inputs.nixpkgs.lib.genAttrs [ + "x86_64-linux" + "aarch64-linux" + "aarch64-darwin" + ] (system: function (import inputs.nixpkgs { + system = system; + overlays = [ inputs.self.overlays.default ]; + })); + + in { + + packages = forAllSystems (pkgs: { + default = pkgs.ctucx-gallery; + ctucx-gallery = pkgs.ctucx-gallery; + }); + + apps = forAllSystems (pkgs: { + default.type = "app"; + default.program = "${pkgs.ctucx-gallery}/bin/gallery"; + }); + + overlays.default = final: prev: { + ctucx-gallery = let + nimexif = final.stdenv.mkDerivation { + name = "nimexif"; + src = final.fetchgit { + url = "https://cgit.ctu.cx/nimexif"; + rev = "c01ab3532975370c3b35b1056f52d02c7df616e0"; + sha256 = "0h3pzpm1h3gmijmfak994y98xr2my7wv31xh3b2wv1p4w8lsv3s1"; }; - in final.buildNimPackage { - name = "ctucx.gallery"; - src = self; - - nimFlags = [ - "--path:${nimexif}" - "--path:${nimjpg}" - "--path:${moustachu}/src" - ]; - - buildInputs = [ final.libexif ]; - - nimRelease = true; - } - ); - - }; - - } // (flake-utils.lib.eachDefaultSystem (system: - let - pkgs = import nixpkgs { - inherit system; - overlays = [ self.overlay ]; + libexif = final.libexif; + + patchPhase = '' + substituteAllInPlace nimexif/libexif_prewrapped.nim + cp nimexif/libexif_prewrapped.nim nimexif/libexif.nim; + ''; + + installPhase = '' + mkdir -p $out + cp -r nimexif $out + ''; + }; + + nimjpg = final.fetchgit { + url = "https://cgit.ctu.cx/nimjpg"; + rev = "cf530668cf92d9d509744b54b93bd4101a5ae6c5"; + sha256 = "03mbbs6wk67llh3ln871jwyvyl2qrv1m5rivlgmg2jlj8462m0sg"; + }; + + moustachu = final.fetchFromGitHub { + owner = "fenekku"; + repo = "moustachu"; + rev = "0.14.0"; + sha256 = "16ij1igddmily9g1kbkmhv6kvmnzyhdy10ifidf32frkraypkdm3"; + }; + + in final.buildNimPackage { + name = "ctucx.gallery"; + src = inputs.self; + + buildInputs = [ final.libexif ]; + + nimRelease = true; + nimFlags = [ + "--path:${nimexif}" + "--path:${nimjpg}" + "--path:${moustachu}/src" + ]; }; + }; - 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 +}