From 300671d0dd52dc12a144010717581f0a6ba5b124 Mon Sep 17 00:00:00 2001 From: pacien Date: Wed, 26 Oct 2022 02:08:12 +0200 Subject: flake: add example as a package This allows quickly testing compiling the example gallery with a given version of ldgallery. For example: ```sh nix build github:ldgallery/ldgallery?rev=commithash#example -o result python -m http.server --directory result ``` GitHub: closes #339 --- flake.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 99221c7..688601c 100644 --- a/flake.nix +++ b/flake.nix @@ -117,6 +117,19 @@ ]; }; + example = pkgs.stdenv.mkDerivation { + pname = "ldgallery-example"; + version = ldgalleryVersion; + src = ./example; + nativeBuildInputs = [ ldgallery ]; + buildPhase = '' + # Need UTF-8: https://github.com/ldgallery/ldgallery/issues/341 + export LC_ALL=C.UTF-8 + ldgallery --input-dir src --output-dir $out --with-viewer + ''; + installPhase = ":"; + }; + default = ldgallery; }; -- cgit v1.2.3 From 0fddc74a3f9add47841124b4d77b097f4646d14f Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 30 Oct 2022 01:05:45 +0200 Subject: compiler: fix support for non-utf8 terminals The compiler echoes the names of the files being processed. Those file names may contain UTF-8 characters. However, some consoles may not support those. This is notably the case of the Windows CMD or on Linux with the legacy C locale. This caused the following error: ldgallery: : commitBuffer: invalid argument (invalid character) This patch adds automatic transliteration when a non-UTF8 terminal is detected, so that neither the compiler or the terminal crash due to UTF8 characters. GitHub: closes #341 --- flake.nix | 2 -- 1 file changed, 2 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 688601c..93d4f2e 100644 --- a/flake.nix +++ b/flake.nix @@ -123,8 +123,6 @@ src = ./example; nativeBuildInputs = [ ldgallery ]; buildPhase = '' - # Need UTF-8: https://github.com/ldgallery/ldgallery/issues/341 - export LC_ALL=C.UTF-8 ldgallery --input-dir src --output-dir $out --with-viewer ''; installPhase = ":"; -- cgit v1.2.3 From e959f54b07aa3a2675a942bd5d9e621c2c15cd88 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 12 Nov 2022 03:58:54 +0100 Subject: flake: add devshell and VM sandbox --- flake.nix | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 93d4f2e..d9dbbd9 100644 --- a/flake.nix +++ b/flake.nix @@ -22,14 +22,27 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; flake-utils.url = "github:numtide/flake-utils"; + flaky-utils.url = "git+https://cgit.pacien.net/libs/flaky-utils"; }; - outputs = { self, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils, flaky-utils }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; ldgalleryVersion = "2.1"; + devTools = with pkgs; [ + # generic + tmux - in rec { + # viewer + nodejs-16_x + yarn + + # compiler + stack + ]; + + in pkgs.lib.fold pkgs.lib.recursiveUpdate { } [ + (rec { packages = rec { compiler = pkgs.haskell.lib.compose.overrideCabal (super: { pname = "ldgallery-compiler"; @@ -138,5 +151,25 @@ default = ldgallery; }; - }); + + devShell = flaky-utils.lib.mkDevShell { + inherit pkgs; + tools = devTools; + shell = null; + }; + }) + + (flaky-utils.lib.mkSandboxSystem { + inherit nixpkgs system; + restrictNetwork = false; + patchQemu9p = true; + config = { + environment.systemPackages = devTools; + virtualisation.forwardPorts = [ + { from = "host"; host.port = 8085; guest.port = 8085; } # vue-cli + ]; + }; + }) + + ]); } -- cgit v1.2.3 From 63da076b8e0d31ea25332847612e39a983c6c474 Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 13 Nov 2022 02:05:37 +0100 Subject: flake: update flaky-utils, use single pkgs instance --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index d9dbbd9..9954790 100644 --- a/flake.nix +++ b/flake.nix @@ -160,7 +160,7 @@ }) (flaky-utils.lib.mkSandboxSystem { - inherit nixpkgs system; + inherit pkgs; restrictNetwork = false; patchQemu9p = true; config = { -- cgit v1.2.3 From 7ac1c8c481fa2bec52ed6094af8e38bcb406b76f Mon Sep 17 00:00:00 2001 From: pacien Date: Sun, 13 Nov 2022 02:05:56 +0100 Subject: flake: avoid making a new pkgs instance --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 9954790..753d9eb 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ outputs = { self, nixpkgs, flake-utils, flaky-utils }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { inherit system; }; + pkgs = nixpkgs.legacyPackages.${system}; ldgalleryVersion = "2.1"; devTools = with pkgs; [ # generic -- cgit v1.2.3 From f645345af53c3188b19f3fa4306cb20965195e2b Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 15 Nov 2022 02:06:43 +0100 Subject: flake: update flaky-utils, use tools argument --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 753d9eb..00fb44e 100644 --- a/flake.nix +++ b/flake.nix @@ -163,8 +163,8 @@ inherit pkgs; restrictNetwork = false; patchQemu9p = true; + tools = devTools; config = { - environment.systemPackages = devTools; virtualisation.forwardPorts = [ { from = "host"; host.port = 8085; guest.port = 8085; } # vue-cli ]; -- cgit v1.2.3 From f41aea79933d46ed6f57f22a8f389608c4b22876 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 19 Nov 2022 18:35:58 +0100 Subject: flake/sandbox: increase allocated resources for viewer build --- flake.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 00fb44e..8a5fb99 100644 --- a/flake.nix +++ b/flake.nix @@ -165,6 +165,10 @@ patchQemu9p = true; tools = devTools; config = { + # The viewer's build and devel server are resource-hungry. + virtualisation.cores = 2; + virtualisation.memorySize = 2 * 1024; + virtualisation.forwardPorts = [ { from = "host"; host.port = 8085; guest.port = 8085; } # vue-cli ]; -- cgit v1.2.3 From 8e0cda290d85d0a126093c9950c8030cfcb9d800 Mon Sep 17 00:00:00 2001 From: pacien Date: Sat, 19 Nov 2022 18:54:02 +0100 Subject: viewer/build: use poll-based live reload in sandbox Continuing to use a watch-based approach by default elsewhere. --- flake.nix | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 8a5fb99..6b7110a 100644 --- a/flake.nix +++ b/flake.nix @@ -164,6 +164,10 @@ restrictNetwork = false; patchQemu9p = true; tools = devTools; + envVars = { + # File modification watch doesn't work through the VM for live reload. + VUE_APP_WEBPACK_WATCH_POLL = "1000"; + }; config = { # The viewer's build and devel server are resource-hungry. virtualisation.cores = 2; -- cgit v1.2.3 From d9a93e2ea3b3bee9818b365e2b3600cc0765fcef Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 1 Dec 2022 19:57:59 +0100 Subject: flake: update input for ghc 9.2 --- flake.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 6b7110a..b0c9586 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,8 @@ description = "A static web gallery generator with tags"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + # GHC 9.2: https://github.com/NixOS/nixpkgs/pull/202022 + nixpkgs.url = "github:NixOS/nixpkgs/445f264"; flake-utils.url = "github:numtide/flake-utils"; flaky-utils.url = "git+https://cgit.pacien.net/libs/flaky-utils"; }; -- cgit v1.2.3 From d266ee66cf3e366fbeb6d92c03dedff3b7aa3f14 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 16 Feb 2023 22:54:42 +0100 Subject: Revert "compiler: fix support for non-utf8 terminals" The reverted changeset fixed some crash due to character encoding mismatch in terminal emulators. Doing so, it made it possible for the compiler to complete without reporting any error, while outputting wrongly encoded files. It's better to revert that changeset until all the encoding issue are solved consistently. This reverts commit 0fddc74a3f9add47841124b4d77b097f4646d14f. --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index b0c9586..714e26d 100644 --- a/flake.nix +++ b/flake.nix @@ -137,6 +137,8 @@ src = ./example; nativeBuildInputs = [ ldgallery ]; buildPhase = '' + # Need UTF-8: https://github.com/ldgallery/ldgallery/issues/341 + export LC_ALL=C.UTF-8 ldgallery --input-dir src --output-dir $out --with-viewer ''; installPhase = ":"; -- cgit v1.2.3 From e939712a284dff9af6d81cc1fcd4e7f7ec9ad503 Mon Sep 17 00:00:00 2001 From: pacien Date: Fri, 17 Feb 2023 22:52:05 +0100 Subject: project: release v2.2 --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 714e26d..a5a4f46 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ # ldgallery - A static generator which turns a collection of tagged # pictures into a searchable web gallery. # -# Copyright (C) 2019-2022 Pacien TRAN-GIRARD +# Copyright (C) 2019-2023 Pacien TRAN-GIRARD # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -29,7 +29,7 @@ outputs = { self, nixpkgs, flake-utils, flaky-utils }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; - ldgalleryVersion = "2.1"; + ldgalleryVersion = "2.2"; devTools = with pkgs; [ # generic tmux -- cgit v1.2.3