aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorpacien2023-02-17 22:57:38 +0100
committerpacien2023-02-17 22:57:38 +0100
commit46cd42de44e402fbf33522d999fa2649729ffaa8 (patch)
tree1281beefda5d9b6d2411bc47ec1327fbf0b38dde /flake.nix
parent11bbbae2850b9c45da697a8ed9626495a50a38c0 (diff)
parente939712a284dff9af6d81cc1fcd4e7f7ec9ad503 (diff)
downloadldgallery-46cd42de44e402fbf33522d999fa2649729ffaa8.tar.gz
Merge branch 'develop': release v2.2v2.2
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix71
1 files changed, 63 insertions, 8 deletions
diff --git a/flake.nix b/flake.nix
index 99221c7..a5a4f46 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,7 +1,7 @@
1# ldgallery - A static generator which turns a collection of tagged 1# ldgallery - A static generator which turns a collection of tagged
2# pictures into a searchable web gallery. 2# pictures into a searchable web gallery.
3# 3#
4# Copyright (C) 2019-2022 Pacien TRAN-GIRARD 4# Copyright (C) 2019-2023 Pacien TRAN-GIRARD
5# 5#
6# This program is free software: you can redistribute it and/or modify 6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU Affero General Public License as 7# it under the terms of the GNU Affero General Public License as
@@ -20,16 +20,30 @@
20 description = "A static web gallery generator with tags"; 20 description = "A static web gallery generator with tags";
21 21
22 inputs = { 22 inputs = {
23 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; 23 # GHC 9.2: https://github.com/NixOS/nixpkgs/pull/202022
24 nixpkgs.url = "github:NixOS/nixpkgs/445f264";
24 flake-utils.url = "github:numtide/flake-utils"; 25 flake-utils.url = "github:numtide/flake-utils";
26 flaky-utils.url = "git+https://cgit.pacien.net/libs/flaky-utils";
25 }; 27 };
26 28
27 outputs = { self, nixpkgs, flake-utils }: 29 outputs = { self, nixpkgs, flake-utils, flaky-utils }:
28 flake-utils.lib.eachDefaultSystem (system: let 30 flake-utils.lib.eachDefaultSystem (system: let
29 pkgs = import nixpkgs { inherit system; }; 31 pkgs = nixpkgs.legacyPackages.${system};
30 ldgalleryVersion = "2.1"; 32 ldgalleryVersion = "2.2";
31 33 devTools = with pkgs; [
32 in rec { 34 # generic
35 tmux
36
37 # viewer
38 nodejs-16_x
39 yarn
40
41 # compiler
42 stack
43 ];
44
45 in pkgs.lib.fold pkgs.lib.recursiveUpdate { } [
46 (rec {
33 packages = rec { 47 packages = rec {
34 compiler = pkgs.haskell.lib.compose.overrideCabal (super: { 48 compiler = pkgs.haskell.lib.compose.overrideCabal (super: {
35 pname = "ldgallery-compiler"; 49 pname = "ldgallery-compiler";
@@ -117,6 +131,19 @@
117 ]; 131 ];
118 }; 132 };
119 133
134 example = pkgs.stdenv.mkDerivation {
135 pname = "ldgallery-example";
136 version = ldgalleryVersion;
137 src = ./example;
138 nativeBuildInputs = [ ldgallery ];
139 buildPhase = ''
140 # Need UTF-8: https://github.com/ldgallery/ldgallery/issues/341
141 export LC_ALL=C.UTF-8
142 ldgallery --input-dir src --output-dir $out --with-viewer
143 '';
144 installPhase = ":";
145 };
146
120 default = ldgallery; 147 default = ldgallery;
121 }; 148 };
122 149
@@ -127,5 +154,33 @@
127 154
128 default = ldgallery; 155 default = ldgallery;
129 }; 156 };
130 }); 157
158 devShell = flaky-utils.lib.mkDevShell {
159 inherit pkgs;
160 tools = devTools;
161 shell = null;
162 };
163 })
164
165 (flaky-utils.lib.mkSandboxSystem {
166 inherit pkgs;
167 restrictNetwork = false;
168 patchQemu9p = true;
169 tools = devTools;
170 envVars = {
171 # File modification watch doesn't work through the VM for live reload.
172 VUE_APP_WEBPACK_WATCH_POLL = "1000";
173 };
174 config = {
175 # The viewer's build and devel server are resource-hungry.
176 virtualisation.cores = 2;
177 virtualisation.memorySize = 2 * 1024;
178
179 virtualisation.forwardPorts = [
180 { from = "host"; host.port = 8085; guest.port = 8085; } # vue-cli
181 ];
182 };
183 })
184
185 ]);
131} 186}