From f9b99bed263d627665043578ea8d7d78366cbbd4 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Fri, 13 Aug 2021 07:52:00 +0200 Subject: [PATCH] sourcehut.pagessrht: init at 0.4.8 --- .../version-management/sourcehut/default.nix | 2 + ...pages-fix-syntax-error-in-schema.sql.patch | 27 ++++++++++++++ .../version-management/sourcehut/pages.nix | 37 +++++++++++++++++++ .../version-management/sourcehut/update.sh | 2 +- 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch create mode 100644 pkgs/applications/version-management/sourcehut/pages.nix diff --git a/pkgs/applications/version-management/sourcehut/default.nix b/pkgs/applications/version-management/sourcehut/default.nix index 401a1437b7d9..00810f208cc5 100644 --- a/pkgs/applications/version-management/sourcehut/default.nix +++ b/pkgs/applications/version-management/sourcehut/default.nix @@ -22,6 +22,7 @@ let listssrht = self.callPackage ./lists.nix { }; mansrht = self.callPackage ./man.nix { }; metasrht = self.callPackage ./meta.nix { }; + pagessrht = self.callPackage ./pages.nix { }; pastesrht = self.callPackage ./paste.nix { }; todosrht = self.callPackage ./todo.nix { }; @@ -40,6 +41,7 @@ with python.pkgs; recurseIntoAttrs { listssrht = toPythonApplication listssrht; mansrht = toPythonApplication mansrht; metasrht = toPythonApplication metasrht; + pagessrht = pagessrht; pastesrht = toPythonApplication pastesrht; todosrht = toPythonApplication todosrht; } diff --git a/pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch b/pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch new file mode 100644 index 000000000000..9b3f6fbc6fb6 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/pages-fix-syntax-error-in-schema.sql.patch @@ -0,0 +1,27 @@ +From 3df160ad289b25574322f587095d00d6641f057c Mon Sep 17 00:00:00 2001 +From: Juan Picca +Date: Wed, 21 Jul 2021 08:26:56 -0300 +Subject: [PATCH] Fix syntax error in schema.sql + +--- + schema.sql | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/schema.sql b/schema.sql +index 168377f..2e473ea 100644 +--- a/schema.sql ++++ b/schema.sql +@@ -28,8 +28,8 @@ CREATE TABLE sites ( + user_id integer NOT NULL references "user"(id), + domain varchar NOT NULL, + protocol protocol NOT NULL, +- version varchar NOT NULL +- UNIQUE (domain, protocol), ++ version varchar NOT NULL, ++ UNIQUE (domain, protocol) + ); + + COMMIT; +-- +2.32.0 + diff --git a/pkgs/applications/version-management/sourcehut/pages.nix b/pkgs/applications/version-management/sourcehut/pages.nix new file mode 100644 index 000000000000..420045ec8374 --- /dev/null +++ b/pkgs/applications/version-management/sourcehut/pages.nix @@ -0,0 +1,37 @@ +{ lib +, fetchFromSourcehut +, buildGoModule +}: +let + version = "0.4.8"; + + src = fetchFromSourcehut { + owner = "~sircmpwn"; + repo = "pages.sr.ht"; + rev = version; + sha256 = "sha256-z9w8v5e6LY6VUEczltyD55KEUUH7Gw1vUO00KPmT+D8="; + }; + +in +buildGoModule { + inherit src version; + pname = "pagessrht"; + vendorSha256 = "sha256-xOd9i+PNlLxZrw/+z/C9V+AbOLEociW2YHY+x1K+mJI="; + + patches = [ + # Upstream after 0.4.8 + ./pages-fix-syntax-error-in-schema.sql.patch + ]; + + postInstall = '' + mkdir -p $out/share/sql/ + cp -r -t $out/share/sql/ schema.sql migrations + ''; + + meta = with lib; { + homepage = "https://git.sr.ht/~sircmpwn/pages.sr.ht"; + description = "Web hosting service for the sr.ht network"; + license = licenses.agpl3; + maintainers = with maintainers; [ eadwu ]; + }; +} diff --git a/pkgs/applications/version-management/sourcehut/update.sh b/pkgs/applications/version-management/sourcehut/update.sh index e172c2da0404..6733046d000b 100755 --- a/pkgs/applications/version-management/sourcehut/update.sh +++ b/pkgs/applications/version-management/sourcehut/update.sh @@ -62,7 +62,7 @@ if [ $# -gt 0 ]; then services=("$@") else services=( "srht" "buildsrht" "dispatchsrht" "gitsrht" "hgsrht" "hubsrht" "listssrht" "mansrht" - "metasrht" "pastesrht" "todosrht" "scmsrht" ) + "metasrht" "pagessrht" "pastesrht" "todosrht" "scmsrht" ) fi for service in "${services[@]}"; do